@adamjanicki/ui 1.8.3 → 1.8.4
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/build/components/Accordion/Accordion.js +1 -0
- package/build/components/Accordion/index.d.ts +1 -0
- package/build/components/Accordion/index.js +1 -0
- package/build/components/Alert/Alert.js +1 -0
- package/build/components/Alert/index.d.ts +1 -0
- package/build/components/Alert/index.js +1 -0
- package/build/components/Animated/Animated.js +1 -0
- package/build/components/Animated/index.d.ts +1 -0
- package/build/components/Animated/index.js +1 -0
- package/build/components/Avatar/Avatar.js +1 -0
- package/build/components/Avatar/index.d.ts +1 -0
- package/build/components/Avatar/index.js +1 -0
- package/build/components/Badge/Badge.js +1 -0
- package/build/components/Badge/index.d.ts +1 -0
- package/build/components/Badge/index.js +1 -0
- package/build/components/Banner/Banner.js +1 -0
- package/build/components/Banner/index.d.ts +1 -0
- package/build/components/Banner/index.js +1 -0
- package/build/components/Box/Box.js +1 -0
- package/build/components/Box/index.d.ts +1 -0
- package/build/components/Box/index.js +1 -0
- package/{components → build/components}/Button/Button.d.ts +0 -21
- package/build/components/Button/Button.js +1 -0
- package/build/components/Button/IconButton.d.ts +25 -0
- package/build/components/Button/IconButton.js +1 -0
- package/build/components/Button/index.d.ts +3 -0
- package/build/components/Button/index.js +1 -0
- package/build/components/Carousel/Carousel.js +1 -0
- package/build/components/Carousel/index.d.ts +1 -0
- package/build/components/Carousel/index.js +1 -0
- package/build/components/ClickOutside/ClickOutside.js +1 -0
- package/build/components/ClickOutside/index.d.ts +1 -0
- package/build/components/ClickOutside/index.js +1 -0
- package/build/components/ErrorBoundary/ErrorBoundary.js +1 -0
- package/build/components/ErrorBoundary/index.d.ts +1 -0
- package/build/components/ErrorBoundary/index.js +1 -0
- package/build/components/Hamburger/DoubleCross.js +1 -0
- package/build/components/Hamburger/DoubleFlip.js +1 -0
- package/build/components/Hamburger/DoubleSpin.js +1 -0
- package/build/components/Hamburger/Hamburger.js +1 -0
- package/build/components/Hamburger/TripleFade.js +1 -0
- package/build/components/Hamburger/TripleFlip.js +1 -0
- package/build/components/Hamburger/TriplePrestige.js +1 -0
- package/build/components/Hamburger/TripleSpin.js +1 -0
- package/{components → build/components}/Hamburger/index.d.ts +2 -3
- package/build/components/Hamburger/index.js +1 -0
- package/build/components/Icon/Icon.js +1 -0
- package/build/components/Icon/icons.js +1 -0
- package/build/components/Icon/index.d.ts +1 -0
- package/build/components/Icon/index.js +1 -0
- package/build/components/Input/IconInput.js +1 -0
- package/build/components/Input/Input.js +1 -0
- package/build/components/Input/TextArea.js +1 -0
- package/build/components/Input/index.d.ts +3 -0
- package/build/components/Input/index.js +1 -0
- package/build/components/Layer/Layer.js +1 -0
- package/build/components/Layer/index.d.ts +1 -0
- package/build/components/Layer/index.js +1 -0
- package/build/components/Modal/Modal.js +1 -0
- package/build/components/Modal/index.d.ts +1 -0
- package/build/components/Modal/index.js +1 -0
- package/build/components/Select/Select.js +1 -0
- package/build/components/Select/index.d.ts +1 -0
- package/build/components/Select/index.js +1 -0
- package/build/components/Spinner/Spinner.js +1 -0
- package/build/components/Spinner/index.d.ts +1 -0
- package/build/components/Spinner/index.js +1 -0
- package/build/components/ui.js +1 -0
- package/build/functions/assertDefined.js +1 -0
- package/build/functions/classNames.js +1 -0
- package/build/functions/getDeviceType.js +1 -0
- package/build/functions/index.d.ts +4 -0
- package/build/functions/index.js +1 -0
- package/build/functions/scrollToId.js +1 -0
- package/build/hooks/index.js +1 -0
- package/build/hooks/useFocusTrap.js +1 -0
- package/build/hooks/useMediaQuery.js +1 -0
- package/build/hooks/useMergeRefs.js +1 -0
- package/build/hooks/useScroll.js +1 -0
- package/build/hooks/useScrollLock.js +1 -0
- package/build/hooks/useScrollToHash.js +1 -0
- package/build/hooks/useWindowResize.js +1 -0
- package/{index.d.ts → build/index.d.ts} +1 -3
- package/build/index.js +1 -0
- package/{components/Link → build/navigation}/Link.d.ts +4 -4
- package/build/navigation/Link.js +1 -0
- package/build/navigation/PathParamsContext.js +1 -0
- package/build/navigation/Route.js +1 -0
- package/build/navigation/Router.js +1 -0
- package/build/navigation/RouterContext.js +1 -0
- package/{router → build/navigation}/Routes.d.ts +1 -1
- package/build/navigation/Routes.js +1 -0
- package/build/navigation/history.js +1 -0
- package/build/navigation/hooks/useLocation.js +1 -0
- package/build/navigation/hooks/useNavigate.js +1 -0
- package/build/navigation/hooks/usePathParams.js +1 -0
- package/build/navigation/hooks/useRouterContext.js +1 -0
- package/build/navigation/hooks/useSearchParams.js +1 -0
- package/build/navigation/href.js +1 -0
- package/{router → build/navigation}/index.d.ts +1 -0
- package/build/navigation/index.js +1 -0
- package/build/navigation/path.js +1 -0
- package/build/navigation/string.js +1 -0
- package/build/navigation/types.js +0 -0
- package/build/utils/transformVfx.js +1 -0
- package/{utils → build/utils}/types.d.ts +1 -1
- package/build/utils/types.js +0 -0
- package/package.json +19 -8
- package/components/Accordion/Accordion.js +0 -56
- package/components/Accordion/index.d.ts +0 -2
- package/components/Accordion/index.js +0 -2
- package/components/Alert/Alert.js +0 -31
- package/components/Alert/index.d.ts +0 -2
- package/components/Alert/index.js +0 -2
- package/components/Animated/Animated.js +0 -94
- package/components/Animated/index.d.ts +0 -2
- package/components/Animated/index.js +0 -2
- package/components/Avatar/Avatar.js +0 -57
- package/components/Avatar/index.d.ts +0 -2
- package/components/Avatar/index.js +0 -2
- package/components/Badge/Badge.js +0 -31
- package/components/Badge/index.d.ts +0 -2
- package/components/Badge/index.js +0 -2
- package/components/Banner/Banner.js +0 -31
- package/components/Banner/index.d.ts +0 -2
- package/components/Banner/index.js +0 -2
- package/components/Box/Box.js +0 -3
- package/components/Box/index.d.ts +0 -2
- package/components/Box/index.js +0 -2
- package/components/Button/Button.js +0 -52
- package/components/Button/index.d.ts +0 -3
- package/components/Button/index.js +0 -3
- package/components/Carousel/Carousel.js +0 -106
- package/components/Carousel/index.d.ts +0 -2
- package/components/Carousel/index.js +0 -2
- package/components/ClickOutside/ClickOutside.js +0 -55
- package/components/ClickOutside/index.d.ts +0 -2
- package/components/ClickOutside/index.js +0 -2
- package/components/ErrorBoundary/ErrorBoundary.js +0 -61
- package/components/ErrorBoundary/index.d.ts +0 -2
- package/components/ErrorBoundary/index.js +0 -2
- package/components/Hamburger/DoubleCross.js +0 -39
- package/components/Hamburger/DoubleFlip.js +0 -39
- package/components/Hamburger/DoubleSpin.js +0 -40
- package/components/Hamburger/Hamburger.js +0 -66
- package/components/Hamburger/TripleFade.js +0 -40
- package/components/Hamburger/TripleFlip.js +0 -40
- package/components/Hamburger/TriplePrestige.js +0 -40
- package/components/Hamburger/TripleSpin.js +0 -41
- package/components/Hamburger/index.js +0 -9
- package/components/Icon/Icon.js +0 -32
- package/components/Icon/icons.js +0 -179
- package/components/Icon/index.d.ts +0 -2
- package/components/Icon/index.js +0 -2
- package/components/Input/IconInput.js +0 -33
- package/components/Input/Input.js +0 -31
- package/components/Input/TextArea.js +0 -31
- package/components/Input/index.d.ts +0 -5
- package/components/Input/index.js +0 -5
- package/components/Layer/Layer.js +0 -63
- package/components/Layer/index.d.ts +0 -2
- package/components/Layer/index.js +0 -2
- package/components/Link/Link.js +0 -75
- package/components/Link/index.d.ts +0 -3
- package/components/Link/index.js +0 -3
- package/components/Modal/Modal.js +0 -48
- package/components/Modal/index.d.ts +0 -2
- package/components/Modal/index.js +0 -2
- package/components/Select/Select.js +0 -34
- package/components/Select/index.d.ts +0 -2
- package/components/Select/index.js +0 -2
- package/components/Spinner/Spinner.js +0 -31
- package/components/Spinner/index.d.ts +0 -2
- package/components/Spinner/index.js +0 -2
- package/components/ui.js +0 -44
- package/functions/assertDefined.js +0 -13
- package/functions/classNames.js +0 -16
- package/functions/getDeviceType.js +0 -17
- package/functions/index.d.ts +0 -5
- package/functions/index.js +0 -5
- package/functions/scrollToId.js +0 -17
- package/hooks/index.js +0 -7
- package/hooks/useFocusTrap.js +0 -48
- package/hooks/useMediaQuery.js +0 -28
- package/hooks/useMergeRefs.js +0 -24
- package/hooks/useScroll.js +0 -23
- package/hooks/useScrollLock.js +0 -45
- package/hooks/useScrollToHash.js +0 -21
- package/hooks/useWindowResize.js +0 -13
- package/index.js +0 -31
- package/router/PathParamsContext.js +0 -3
- package/router/Route.js +0 -6
- package/router/Router.js +0 -36
- package/router/RouterContext.js +0 -3
- package/router/Routes.js +0 -31
- package/router/history.js +0 -46
- package/router/hooks/useLocation.js +0 -10
- package/router/hooks/useNavigate.js +0 -10
- package/router/hooks/usePathParams.js +0 -15
- package/router/hooks/useRouterContext.js +0 -9
- package/router/hooks/useSearchParams.js +0 -47
- package/router/href.js +0 -43
- package/router/index.js +0 -7
- package/router/path.js +0 -38
- package/router/string.js +0 -6
- package/router/types.js +0 -1
- package/utils/transformVfx.js +0 -212
- package/utils/types.js +0 -1
- /package/{components → build/components}/Accordion/Accordion.d.ts +0 -0
- /package/{components → build/components}/Alert/Alert.d.ts +0 -0
- /package/{components → build/components}/Animated/Animated.d.ts +0 -0
- /package/{components → build/components}/Avatar/Avatar.d.ts +0 -0
- /package/{components → build/components}/Badge/Badge.d.ts +0 -0
- /package/{components → build/components}/Banner/Banner.d.ts +0 -0
- /package/{components → build/components}/Box/Box.d.ts +0 -0
- /package/{components → build/components}/Carousel/Carousel.d.ts +0 -0
- /package/{components → build/components}/ClickOutside/ClickOutside.d.ts +0 -0
- /package/{components → build/components}/ErrorBoundary/ErrorBoundary.d.ts +0 -0
- /package/{components → build/components}/Hamburger/DoubleCross.d.ts +0 -0
- /package/{components → build/components}/Hamburger/DoubleFlip.d.ts +0 -0
- /package/{components → build/components}/Hamburger/DoubleSpin.d.ts +0 -0
- /package/{components → build/components}/Hamburger/Hamburger.d.ts +0 -0
- /package/{components → build/components}/Hamburger/TripleFade.d.ts +0 -0
- /package/{components → build/components}/Hamburger/TripleFlip.d.ts +0 -0
- /package/{components → build/components}/Hamburger/TriplePrestige.d.ts +0 -0
- /package/{components → build/components}/Hamburger/TripleSpin.d.ts +0 -0
- /package/{components → build/components}/Icon/Icon.d.ts +0 -0
- /package/{components → build/components}/Icon/icons.d.ts +0 -0
- /package/{components → build/components}/Input/IconInput.d.ts +0 -0
- /package/{components → build/components}/Input/Input.d.ts +0 -0
- /package/{components → build/components}/Input/TextArea.d.ts +0 -0
- /package/{components → build/components}/Layer/Layer.d.ts +0 -0
- /package/{components → build/components}/Modal/Modal.d.ts +0 -0
- /package/{components → build/components}/Select/Select.d.ts +0 -0
- /package/{components → build/components}/Spinner/Spinner.d.ts +0 -0
- /package/{components → build/components}/ui.d.ts +0 -0
- /package/{functions → build/functions}/assertDefined.d.ts +0 -0
- /package/{functions → build/functions}/classNames.d.ts +0 -0
- /package/{functions → build/functions}/getDeviceType.d.ts +0 -0
- /package/{functions → build/functions}/scrollToId.d.ts +0 -0
- /package/{hooks → build/hooks}/index.d.ts +0 -0
- /package/{hooks → build/hooks}/useFocusTrap.d.ts +0 -0
- /package/{hooks → build/hooks}/useMediaQuery.d.ts +0 -0
- /package/{hooks → build/hooks}/useMergeRefs.d.ts +0 -0
- /package/{hooks → build/hooks}/useScroll.d.ts +0 -0
- /package/{hooks → build/hooks}/useScrollLock.d.ts +0 -0
- /package/{hooks → build/hooks}/useScrollToHash.d.ts +0 -0
- /package/{hooks → build/hooks}/useWindowResize.d.ts +0 -0
- /package/{router → build/navigation}/PathParamsContext.d.ts +0 -0
- /package/{router → build/navigation}/Route.d.ts +0 -0
- /package/{router → build/navigation}/Router.d.ts +0 -0
- /package/{router → build/navigation}/RouterContext.d.ts +0 -0
- /package/{router → build/navigation}/history.d.ts +0 -0
- /package/{router → build/navigation}/hooks/useLocation.d.ts +0 -0
- /package/{router → build/navigation}/hooks/useNavigate.d.ts +0 -0
- /package/{router → build/navigation}/hooks/usePathParams.d.ts +0 -0
- /package/{router → build/navigation}/hooks/useRouterContext.d.ts +0 -0
- /package/{router → build/navigation}/hooks/useSearchParams.d.ts +0 -0
- /package/{router → build/navigation}/href.d.ts +0 -0
- /package/{router → build/navigation}/path.d.ts +0 -0
- /package/{router → build/navigation}/string.d.ts +0 -0
- /package/{router → build/navigation}/types.d.ts +0 -0
- /package/{style.css → build/style.css} +0 -0
- /package/{utils → build/utils}/transformVfx.d.ts +0 -0
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
24
|
-
import React from "react";
|
|
25
|
-
import classNames from "../../functions/classNames";
|
|
26
|
-
import Box from "../Box/Box";
|
|
27
|
-
import Icon from "../Icon";
|
|
28
|
-
import ui from "../ui";
|
|
29
|
-
var Select = React.forwardRef(function (_a, ref) {
|
|
30
|
-
var className = _a.className, options = _a.options, vfx = _a.vfx, getOptionLabel = _a.getOptionLabel, selectProps = _a.selectProps, value = _a.value, onChange = _a.onChange, rest = __rest(_a, ["className", "options", "vfx", "getOptionLabel", "selectProps", "value", "onChange"]);
|
|
31
|
-
var selectClassName = (selectProps || {}).className;
|
|
32
|
-
return (_jsxs(Box, __assign({ vfx: __assign({ pos: "relative", width: "fit", axis: "x", align: "center", radius: "rounded", backgroundColor: "default", color: "default", padding: "none" }, vfx), className: classNames("aui-select-container", (selectProps === null || selectProps === void 0 ? void 0 : selectProps.disabled) ? "aui-select-disabled" : undefined, className) }, rest, { children: [_jsx(ui.select, __assign({}, selectProps, { value: value, onChange: onChange, className: classNames("aui-select", selectClassName), ref: ref, children: options.map(function (option, index) { return (_jsx("option", { value: option, children: (getOptionLabel === null || getOptionLabel === void 0 ? void 0 : getOptionLabel(option)) || option }, index)); }) })), _jsx(Icon, { icon: "chevron-down", className: "aui-select-icon", "aria-hidden": true })] })));
|
|
33
|
-
});
|
|
34
|
-
export default Select;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
|
-
import classNames from "../../functions/classNames";
|
|
25
|
-
var Spinner = function (_a) {
|
|
26
|
-
var className = _a.className, props = __rest(_a, ["className"]);
|
|
27
|
-
return (
|
|
28
|
-
// Designed on 2023-08-18
|
|
29
|
-
_jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg" }, props, { viewBox: "0 0 512 512", className: classNames("aui-spinner", className), children: _jsx("path", { fill: "currentColor", d: "M256,0C114.62,0,0,114.62,0,256S114.62,512,256,512c70.64,0,134.59-28.61,180.91-74.88l-31.11-31.11c-38.35,38.3-91.31,61.99-149.8,61.99-117.08,0-212-94.92-212-212S138.92,44,256,44V0Z" }) })));
|
|
30
|
-
};
|
|
31
|
-
export default Spinner;
|
package/components/ui.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
var __assign = (this && this.__assign) || function () {
|
|
2
|
-
__assign = Object.assign || function(t) {
|
|
3
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
-
s = arguments[i];
|
|
5
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
-
t[p] = s[p];
|
|
7
|
-
}
|
|
8
|
-
return t;
|
|
9
|
-
};
|
|
10
|
-
return __assign.apply(this, arguments);
|
|
11
|
-
};
|
|
12
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
-
var t = {};
|
|
14
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
-
t[p] = s[p];
|
|
16
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
-
t[p[i]] = s[p[i]];
|
|
20
|
-
}
|
|
21
|
-
return t;
|
|
22
|
-
};
|
|
23
|
-
import React from "react";
|
|
24
|
-
import { classNames } from "../functions";
|
|
25
|
-
import transformVfx from "../utils/transformVfx";
|
|
26
|
-
function createVfxElement(tag) {
|
|
27
|
-
var Component = React.forwardRef(function (_a, ref) {
|
|
28
|
-
var vfx = _a.vfx, className = _a.className, props = __rest(_a, ["vfx", "className"]);
|
|
29
|
-
return React.createElement(tag, __assign(__assign({}, props), { ref: ref, className: classNames(className, transformVfx(vfx)) }));
|
|
30
|
-
});
|
|
31
|
-
return Component;
|
|
32
|
-
}
|
|
33
|
-
var ui = new Proxy({}, {
|
|
34
|
-
get: function (cache, tag) {
|
|
35
|
-
var cachedComponent = cache[tag];
|
|
36
|
-
if (cachedComponent) {
|
|
37
|
-
return cachedComponent;
|
|
38
|
-
}
|
|
39
|
-
var component = createVfxElement(tag);
|
|
40
|
-
cache[tag] = component;
|
|
41
|
-
return component;
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
export default ui;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Assert a value is defined
|
|
3
|
-
*
|
|
4
|
-
* @param value the value to assert presence of
|
|
5
|
-
* @param message optional error message
|
|
6
|
-
* @returns the present value
|
|
7
|
-
*/
|
|
8
|
-
export default function assertDefined(value, message) {
|
|
9
|
-
if (value === undefined) {
|
|
10
|
-
throw new Error(message || "Unexpected undefined value");
|
|
11
|
-
}
|
|
12
|
-
return value;
|
|
13
|
-
}
|
package/functions/classNames.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reduce a list of classnames into one string
|
|
3
|
-
*
|
|
4
|
-
* @param classNames list of class names to concatenate
|
|
5
|
-
* @returns single aggregated string of classnames
|
|
6
|
-
*/
|
|
7
|
-
export default function classNames() {
|
|
8
|
-
var classNames = [];
|
|
9
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
10
|
-
classNames[_i] = arguments[_i];
|
|
11
|
-
}
|
|
12
|
-
return (classNames
|
|
13
|
-
.map(function (className) { return className === null || className === void 0 ? void 0 : className.trim(); })
|
|
14
|
-
.filter(Boolean)
|
|
15
|
-
.join(" ") || undefined);
|
|
16
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Best effort checks to determine the device being used
|
|
3
|
-
*
|
|
4
|
-
* @returns the type of device
|
|
5
|
-
*/
|
|
6
|
-
export default function getDeviceType() {
|
|
7
|
-
if (!navigator)
|
|
8
|
-
return "desktop";
|
|
9
|
-
var _a = navigator.userAgent, userAgent = _a === void 0 ? "" : _a, _b = navigator.maxTouchPoints, maxTouchPoints = _b === void 0 ? 0 : _b, platform = navigator.platform;
|
|
10
|
-
var isTouchScreen = maxTouchPoints > 0;
|
|
11
|
-
var isMobileUserAgent = /mobi|android|iphone|ipod|ipad/i.test(userAgent);
|
|
12
|
-
var isNewIpad = platform === "MacIntel" && maxTouchPoints > 1;
|
|
13
|
-
if ((isMobileUserAgent && isTouchScreen) || isNewIpad) {
|
|
14
|
-
return "mobile";
|
|
15
|
-
}
|
|
16
|
-
return "desktop";
|
|
17
|
-
}
|
package/functions/index.d.ts
DELETED
package/functions/index.js
DELETED
package/functions/scrollToId.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Scroll to the element with the given id
|
|
3
|
-
* @param id the id of the element to scroll to
|
|
4
|
-
* @param behavior behavior of the scroll
|
|
5
|
-
*/
|
|
6
|
-
export default function scrollToId(id, behavior) {
|
|
7
|
-
try {
|
|
8
|
-
// catch cases where hash is not a valid id
|
|
9
|
-
var element = document.getElementById(id);
|
|
10
|
-
if (element) {
|
|
11
|
-
element.scrollIntoView({ behavior: behavior });
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
catch (_a) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
}
|
package/hooks/index.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { default as useScrollLock } from "./useScrollLock";
|
|
2
|
-
export { default as useMediaQuery } from "./useMediaQuery";
|
|
3
|
-
export { default as useScroll } from "./useScroll";
|
|
4
|
-
export { default as useFocusTrap } from "./useFocusTrap";
|
|
5
|
-
export { default as useScrollToHash } from "./useScrollToHash";
|
|
6
|
-
export { default as useWindowResize } from "./useWindowResize";
|
|
7
|
-
export { default as useMergeRefs } from "./useMergeRefs";
|
package/hooks/useFocusTrap.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef } from "react";
|
|
2
|
-
var selector = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), iframe, object, embed, [tabindex="0"], [contenteditable]';
|
|
3
|
-
/**
|
|
4
|
-
* A hook for trapping focus within an element.
|
|
5
|
-
*
|
|
6
|
-
* @param isActive true if the element is active, false otherwise
|
|
7
|
-
* `true` by default
|
|
8
|
-
* @returns ref object that must be passed to the element that should be trapped
|
|
9
|
-
*/
|
|
10
|
-
var useFocusTrap = function (isActive) {
|
|
11
|
-
if (isActive === void 0) { isActive = true; }
|
|
12
|
-
var trapRef = useRef(null);
|
|
13
|
-
useEffect(function () {
|
|
14
|
-
var trap = trapRef.current;
|
|
15
|
-
if (!isActive || !trap)
|
|
16
|
-
return;
|
|
17
|
-
var handleKeyDown = function (event) {
|
|
18
|
-
if (event.key !== "Tab")
|
|
19
|
-
return;
|
|
20
|
-
var focusableElements = trap.querySelectorAll(selector);
|
|
21
|
-
if (!focusableElements.length) {
|
|
22
|
-
event.preventDefault();
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
var first = focusableElements[0];
|
|
26
|
-
var last = focusableElements[focusableElements.length - 1];
|
|
27
|
-
var active = document.activeElement;
|
|
28
|
-
if (event.shiftKey) {
|
|
29
|
-
if (active === first || !trap.contains(active)) {
|
|
30
|
-
last.focus();
|
|
31
|
-
event.preventDefault();
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
if (active === last || !trap.contains(active)) {
|
|
36
|
-
first.focus();
|
|
37
|
-
event.preventDefault();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
trap.addEventListener("keydown", handleKeyDown, true);
|
|
42
|
-
return function () {
|
|
43
|
-
trap.removeEventListener("keydown", handleKeyDown, true);
|
|
44
|
-
};
|
|
45
|
-
}, [isActive]);
|
|
46
|
-
return trapRef;
|
|
47
|
-
};
|
|
48
|
-
export default useFocusTrap;
|
package/hooks/useMediaQuery.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* A hook for watching media queries.
|
|
4
|
-
*
|
|
5
|
-
* @param config the configuration for the hook
|
|
6
|
-
* @returns true if the media query matches, false otherwise
|
|
7
|
-
*/
|
|
8
|
-
var useMediaQuery = function (config) {
|
|
9
|
-
var onMatch = config.onMatch, onUnmatch = config.onUnmatch, query = config.query;
|
|
10
|
-
var _a = useState(false), matches = _a[0], setMatches = _a[1];
|
|
11
|
-
useEffect(function () {
|
|
12
|
-
var mediaQuery = window.matchMedia(query);
|
|
13
|
-
var listener = function (event) {
|
|
14
|
-
if (event.matches) {
|
|
15
|
-
onMatch === null || onMatch === void 0 ? void 0 : onMatch();
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
onUnmatch === null || onUnmatch === void 0 ? void 0 : onUnmatch();
|
|
19
|
-
}
|
|
20
|
-
setMatches(event.matches);
|
|
21
|
-
};
|
|
22
|
-
mediaQuery.addEventListener("change", listener);
|
|
23
|
-
setMatches(mediaQuery.matches);
|
|
24
|
-
return function () { return mediaQuery.removeEventListener("change", listener); };
|
|
25
|
-
}, [onMatch, onUnmatch, query]);
|
|
26
|
-
return matches;
|
|
27
|
-
};
|
|
28
|
-
export default useMediaQuery;
|
package/hooks/useMergeRefs.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useCallback } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Simple hook that merges N refs into one callback
|
|
4
|
-
*
|
|
5
|
-
* @param refs all the refs you want to merge
|
|
6
|
-
* @returns one combined ref
|
|
7
|
-
*/
|
|
8
|
-
var useMergeRefs = function () {
|
|
9
|
-
var refs = [];
|
|
10
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
11
|
-
refs[_i] = arguments[_i];
|
|
12
|
-
}
|
|
13
|
-
return useCallback(function (node) {
|
|
14
|
-
refs.forEach(function (ref) {
|
|
15
|
-
if (typeof ref === "function") {
|
|
16
|
-
ref(node);
|
|
17
|
-
}
|
|
18
|
-
else if (ref && typeof ref === "object") {
|
|
19
|
-
ref.current = node;
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}, [refs]);
|
|
23
|
-
};
|
|
24
|
-
export default useMergeRefs;
|
package/hooks/useScroll.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* A hook getting the current scroll position of the window.
|
|
4
|
-
* @returns an object containing the current scroll position of the window.
|
|
5
|
-
*/
|
|
6
|
-
var useScroll = function () {
|
|
7
|
-
var _a = useState({
|
|
8
|
-
scrollX: window.scrollX,
|
|
9
|
-
scrollY: window.scrollY,
|
|
10
|
-
}), scroll = _a[0], setScroll = _a[1];
|
|
11
|
-
useEffect(function () {
|
|
12
|
-
var onScroll = function () {
|
|
13
|
-
setScroll({
|
|
14
|
-
scrollX: window.scrollX,
|
|
15
|
-
scrollY: window.scrollY,
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
window.addEventListener("scroll", onScroll);
|
|
19
|
-
return function () { return window.removeEventListener("scroll", onScroll); };
|
|
20
|
-
}, []);
|
|
21
|
-
return scroll;
|
|
22
|
-
};
|
|
23
|
-
export default useScroll;
|
package/hooks/useScrollLock.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
var globalLockCount = 0;
|
|
3
|
-
var lockScroll = function () {
|
|
4
|
-
globalLockCount += 1;
|
|
5
|
-
if (globalLockCount > 1) {
|
|
6
|
-
return function () {
|
|
7
|
-
globalLockCount -= 1;
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
var scrollPosition = window.scrollY;
|
|
11
|
-
var style = document.body.style;
|
|
12
|
-
var overflow = style.overflow, position = style.position, top = style.top, width = style.width;
|
|
13
|
-
style.overflow = "hidden";
|
|
14
|
-
style.position = "fixed";
|
|
15
|
-
style.top = "-".concat(scrollPosition, "px");
|
|
16
|
-
style.width = "100%";
|
|
17
|
-
return function () {
|
|
18
|
-
globalLockCount -= 1;
|
|
19
|
-
if (globalLockCount > 0) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
style.overflow = overflow;
|
|
23
|
-
style.position = position;
|
|
24
|
-
style.top = top;
|
|
25
|
-
style.width = width;
|
|
26
|
-
window.scrollTo({
|
|
27
|
-
top: scrollPosition,
|
|
28
|
-
left: 0,
|
|
29
|
-
behavior: "instant",
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
/**
|
|
34
|
-
* Hook to lock and unlock the scroll position on enable change or mount/unmount.
|
|
35
|
-
* @param enable whether to lock the scroll position. Defaults to `true`. Useful for using in something that stays mounted.
|
|
36
|
-
*/
|
|
37
|
-
var useScrollLock = function (enable) {
|
|
38
|
-
if (enable === void 0) { enable = true; }
|
|
39
|
-
useEffect(function () {
|
|
40
|
-
if (enable) {
|
|
41
|
-
return lockScroll();
|
|
42
|
-
}
|
|
43
|
-
}, [enable]);
|
|
44
|
-
};
|
|
45
|
-
export default useScrollLock;
|
package/hooks/useScrollToHash.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import scrollToId from "../functions/scrollToId";
|
|
3
|
-
/**
|
|
4
|
-
* A hook for scrolling to a hash on the page.
|
|
5
|
-
*/
|
|
6
|
-
var useScrollToHash = function (config) {
|
|
7
|
-
if (config === void 0) { config = {}; }
|
|
8
|
-
var _a = config.active, active = _a === void 0 ? true : _a, behavior = config.behavior, delay = config.delay;
|
|
9
|
-
useEffect(function () {
|
|
10
|
-
var hash = window.location.hash;
|
|
11
|
-
if (!active || (hash === null || hash === void 0 ? void 0 : hash.length) <= 1)
|
|
12
|
-
return;
|
|
13
|
-
var id = hash.substring(1);
|
|
14
|
-
if (delay !== undefined) {
|
|
15
|
-
var timeout_1 = setTimeout(function () { return scrollToId(id, behavior); }, delay);
|
|
16
|
-
return function () { return clearTimeout(timeout_1); };
|
|
17
|
-
}
|
|
18
|
-
scrollToId(id, behavior);
|
|
19
|
-
}, [active, behavior, delay]);
|
|
20
|
-
};
|
|
21
|
-
export default useScrollToHash;
|
package/hooks/useWindowResize.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* A hook that listens for window resize events.
|
|
4
|
-
*
|
|
5
|
-
* @param callback the callback function fired when the window is resized.
|
|
6
|
-
*/
|
|
7
|
-
var useWindowResize = function (callback) {
|
|
8
|
-
useEffect(function () {
|
|
9
|
-
window.addEventListener("resize", callback);
|
|
10
|
-
return function () { return window.removeEventListener("resize", callback); };
|
|
11
|
-
}, [callback]);
|
|
12
|
-
};
|
|
13
|
-
export default useWindowResize;
|
package/index.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
// Components
|
|
2
|
-
export { default as Accordion } from "./components/Accordion";
|
|
3
|
-
export { default as Alert } from "./components/Alert";
|
|
4
|
-
export { default as Animated } from "./components/Animated";
|
|
5
|
-
export { default as Avatar } from "./components/Avatar";
|
|
6
|
-
export { default as Badge } from "./components/Badge";
|
|
7
|
-
export { default as Banner } from "./components/Banner";
|
|
8
|
-
export { default as Box } from "./components/Box";
|
|
9
|
-
export { default as Button } from "./components/Button";
|
|
10
|
-
export * from "./components/Button";
|
|
11
|
-
export { default as Carousel } from "./components/Carousel";
|
|
12
|
-
export { default as ClickOutside } from "./components/ClickOutside";
|
|
13
|
-
export { default as ErrorBoundary } from "./components/ErrorBoundary";
|
|
14
|
-
export { default as Hamburger } from "./components/Hamburger";
|
|
15
|
-
export * from "./components/Hamburger";
|
|
16
|
-
export { default as Icon } from "./components/Icon";
|
|
17
|
-
export { default as Input } from "./components/Input";
|
|
18
|
-
export * from "./components/Input";
|
|
19
|
-
export { default as Layer } from "./components/Layer";
|
|
20
|
-
export { default as Link } from "./components/Link";
|
|
21
|
-
export * from "./components/Link";
|
|
22
|
-
export { default as Modal } from "./components/Modal";
|
|
23
|
-
export { default as Select } from "./components/Select";
|
|
24
|
-
export { default as Spinner } from "./components/Spinner";
|
|
25
|
-
export { default as ui } from "./components/ui";
|
|
26
|
-
// Hooks
|
|
27
|
-
export * from "./hooks";
|
|
28
|
-
// Functions
|
|
29
|
-
export * from "./functions";
|
|
30
|
-
// Router
|
|
31
|
-
export * from "./router";
|
package/router/Route.js
DELETED
package/router/Router.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import RouterContext from "./RouterContext";
|
|
4
|
-
import { createHistory, getCurrentLocation } from "./history";
|
|
5
|
-
import { getHref, normalizeBasename } from "./href";
|
|
6
|
-
export default function Router(_a) {
|
|
7
|
-
var children = _a.children, _b = _a.basename, basename = _b === void 0 ? "" : _b;
|
|
8
|
-
basename = normalizeBasename(basename);
|
|
9
|
-
var historyRef = React.useRef(null);
|
|
10
|
-
if (!historyRef.current)
|
|
11
|
-
historyRef.current = createHistory();
|
|
12
|
-
var history = historyRef.current;
|
|
13
|
-
var _c = React.useState(getCurrentLocation), location = _c[0], setLocation = _c[1];
|
|
14
|
-
// to avoid infinite rerenders
|
|
15
|
-
var locationRef = React.useRef(location);
|
|
16
|
-
React.useLayoutEffect(function () {
|
|
17
|
-
var removeListener = history.addListener(function (nextLocation) {
|
|
18
|
-
locationRef.current = nextLocation;
|
|
19
|
-
setLocation(nextLocation);
|
|
20
|
-
});
|
|
21
|
-
return function () {
|
|
22
|
-
removeListener();
|
|
23
|
-
history.cleanup();
|
|
24
|
-
};
|
|
25
|
-
}, [history]);
|
|
26
|
-
var navigate = React.useCallback(function (to) {
|
|
27
|
-
var currentPathname = locationRef.current.pathname;
|
|
28
|
-
history.push(getHref(to, currentPathname, basename).url);
|
|
29
|
-
}, [history, basename]);
|
|
30
|
-
var contextValue = React.useMemo(function () { return ({
|
|
31
|
-
location: location,
|
|
32
|
-
navigate: navigate,
|
|
33
|
-
basename: basename,
|
|
34
|
-
}); }, [location, navigate, basename]);
|
|
35
|
-
return (_jsx(RouterContext.Provider, { value: contextValue, children: children }));
|
|
36
|
-
}
|
package/router/RouterContext.js
DELETED
package/router/Routes.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { matchPath } from "./path";
|
|
4
|
-
import PathParamsContext from "./PathParamsContext";
|
|
5
|
-
import Route from "./Route";
|
|
6
|
-
import useRouterContext from "./hooks/useRouterContext";
|
|
7
|
-
import { stripBasename } from "./href";
|
|
8
|
-
function findRouteElements(children) {
|
|
9
|
-
return children.filter(function (child) { return React.isValidElement(child) && child.type === Route; });
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Nested within a router component, this component handles rendering the proper route.
|
|
13
|
-
* Note: sticking any other components besides routes in here will not be rendered
|
|
14
|
-
*/
|
|
15
|
-
export default function Routes(_a) {
|
|
16
|
-
var rawChildren = _a.children, fallback = _a.fallback;
|
|
17
|
-
var router = useRouterContext("<Routes>");
|
|
18
|
-
var location = router.location, basename = router.basename;
|
|
19
|
-
var pathname = stripBasename(location.pathname, basename);
|
|
20
|
-
var children = Array.isArray(rawChildren) ? rawChildren : [rawChildren];
|
|
21
|
-
var routes = findRouteElements(children);
|
|
22
|
-
for (var _i = 0, routes_1 = routes; _i < routes_1.length; _i++) {
|
|
23
|
-
var routeElement = routes_1[_i];
|
|
24
|
-
var _b = routeElement.props, path = _b.path, element = _b.element;
|
|
25
|
-
var pathParams = matchPath(path, pathname);
|
|
26
|
-
if (pathParams) {
|
|
27
|
-
return (_jsx(PathParamsContext.Provider, { value: pathParams, children: element }));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return fallback;
|
|
31
|
-
}
|
package/router/history.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
export function getCurrentLocation() {
|
|
2
|
-
return {
|
|
3
|
-
pathname: window.location.pathname,
|
|
4
|
-
search: window.location.search,
|
|
5
|
-
hash: window.location.hash,
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
export function createHistory() {
|
|
9
|
-
var listeners = new Set();
|
|
10
|
-
var notifyListeners = function () {
|
|
11
|
-
var location = getCurrentLocation();
|
|
12
|
-
listeners.forEach(function (listener) { return listener(location); });
|
|
13
|
-
};
|
|
14
|
-
var listening = false;
|
|
15
|
-
var startListening = function () {
|
|
16
|
-
if (listening)
|
|
17
|
-
return;
|
|
18
|
-
window.addEventListener("popstate", notifyListeners);
|
|
19
|
-
listening = true;
|
|
20
|
-
};
|
|
21
|
-
var stopListening = function () {
|
|
22
|
-
if (!listening)
|
|
23
|
-
return;
|
|
24
|
-
window.removeEventListener("popstate", notifyListeners);
|
|
25
|
-
listening = false;
|
|
26
|
-
};
|
|
27
|
-
return {
|
|
28
|
-
push: function (to) {
|
|
29
|
-
window.history.pushState(null, "", to);
|
|
30
|
-
notifyListeners();
|
|
31
|
-
},
|
|
32
|
-
addListener: function (listener) {
|
|
33
|
-
startListening();
|
|
34
|
-
listeners.add(listener);
|
|
35
|
-
return function () {
|
|
36
|
-
listeners.delete(listener);
|
|
37
|
-
if (listeners.size === 0)
|
|
38
|
-
stopListening();
|
|
39
|
-
};
|
|
40
|
-
},
|
|
41
|
-
cleanup: function () {
|
|
42
|
-
stopListening();
|
|
43
|
-
listeners.clear();
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import useRouterContext from "./useRouterContext";
|
|
2
|
-
/**
|
|
3
|
-
* Get the current location (can only be used within a Router)
|
|
4
|
-
*
|
|
5
|
-
* @returns the current location
|
|
6
|
-
*/
|
|
7
|
-
export default function useLocation() {
|
|
8
|
-
var location = useRouterContext("useLocation()").location;
|
|
9
|
-
return location;
|
|
10
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import useRouterContext from "./useRouterContext";
|
|
2
|
-
/**
|
|
3
|
-
* Get a navigate function (can only be used within a Router)
|
|
4
|
-
*
|
|
5
|
-
* @returns a navigate function
|
|
6
|
-
*/
|
|
7
|
-
export default function useNavigate() {
|
|
8
|
-
var navigate = useRouterContext("useNavigate()").navigate;
|
|
9
|
-
return navigate;
|
|
10
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PathParamsContext from "../PathParamsContext";
|
|
3
|
-
/**
|
|
4
|
-
* Get the params from the current pathname
|
|
5
|
-
*
|
|
6
|
-
* @returns the params from the current path
|
|
7
|
-
* e.g. `{id: "1"}` for `/movie/:id <=> /movie/1`
|
|
8
|
-
*/
|
|
9
|
-
export default function usePathParams() {
|
|
10
|
-
var params = React.useContext(PathParamsContext);
|
|
11
|
-
if (!params) {
|
|
12
|
-
throw new Error("usePathParams() must be used inside of a <Router> component");
|
|
13
|
-
}
|
|
14
|
-
return params;
|
|
15
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import RouterContext from "../RouterContext";
|
|
3
|
-
export default function useRouterContext(name) {
|
|
4
|
-
var routerContext = React.useContext(RouterContext);
|
|
5
|
-
if (!routerContext) {
|
|
6
|
-
throw new Error("".concat(name, " must be used inside of a <Router> component"));
|
|
7
|
-
}
|
|
8
|
-
return routerContext;
|
|
9
|
-
}
|