@adamjanicki/ui 1.5.5 → 1.5.7
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/components/Alert/Alert.d.ts +4 -15
- package/components/Alert/Alert.js +3 -2
- package/components/Animated/Animated.d.ts +6 -16
- package/components/Animated/Animated.js +31 -14
- package/components/Badge/Badge.d.ts +4 -16
- package/components/Badge/Badge.js +2 -1
- package/components/Banner/Banner.d.ts +4 -15
- package/components/Banner/Banner.js +2 -1
- package/components/Box/Box.d.ts +11 -0
- package/components/Box/Box.js +66 -0
- package/components/Box/index.d.ts +2 -0
- package/components/Box/index.js +2 -0
- package/components/Button/Button.d.ts +3 -3
- package/components/Button/Button.js +4 -4
- package/components/Carousel/Carousel.d.ts +6 -12
- package/components/Carousel/Carousel.js +19 -7
- package/components/Hamburger/Hamburger.d.ts +6 -5
- package/components/Input/IconInput.d.ts +2 -2
- package/components/Input/IconInput.js +2 -1
- package/components/Input/Input.d.ts +1 -1
- package/components/Input/Input.js +1 -1
- package/components/Input/TextArea.d.ts +1 -1
- package/components/Input/TextArea.js +1 -1
- package/components/Layer/Layer.d.ts +4 -11
- package/components/Layer/Layer.js +2 -1
- package/components/Link/Link.d.ts +2 -4
- package/components/Link/Link.js +3 -3
- package/components/Select/Select.d.ts +1 -8
- package/components/Select/Select.js +3 -3
- package/components/Spinner/Spinner.d.ts +2 -2
- package/components/Spinner/Spinner.js +1 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +3 -2
- package/style.css +329 -238
- package/utils/types.d.ts +58 -0
- package/components/InlineCode/InlineCode.d.ts +0 -13
- package/components/InlineCode/InlineCode.js +0 -50
- package/components/InlineCode/index.d.ts +0 -2
- package/components/InlineCode/index.js +0 -2
- package/types/index.d.ts +0 -8
- /package/{types/index.js → utils/types.js} +0 -0
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ContentType, CornerType } from "../../types";
|
|
3
|
-
type
|
|
2
|
+
import type { ContentType, CornerType } from "../../utils/types";
|
|
3
|
+
import { type BoxProps } from "../Box/Box";
|
|
4
|
+
type Props = BoxProps & {
|
|
4
5
|
/**
|
|
5
6
|
* The type of alert to display.
|
|
6
7
|
*/
|
|
7
8
|
type: ContentType;
|
|
8
|
-
/**
|
|
9
|
-
* The content to display in the alert.
|
|
10
|
-
*/
|
|
11
|
-
children: React.ReactNode | React.ReactNode[];
|
|
12
|
-
/**
|
|
13
|
-
* [Optional] Additional class names to apply to the alert.
|
|
14
|
-
*/
|
|
15
|
-
className?: string;
|
|
16
|
-
/**
|
|
17
|
-
* [Optional] Additional styles to apply to the alert.
|
|
18
|
-
*/
|
|
19
|
-
style?: React.CSSProperties;
|
|
20
9
|
/**
|
|
21
10
|
* [Optional] The corner style of the alert.
|
|
22
11
|
* @default "rounded"
|
|
23
12
|
*/
|
|
24
13
|
corners?: CornerType;
|
|
25
14
|
};
|
|
26
|
-
declare const Alert: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
declare const Alert: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
27
16
|
export default Alert;
|
|
@@ -23,8 +23,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
24
|
import React from "react";
|
|
25
25
|
import classNames from "../../functions/classNames";
|
|
26
|
+
import Box from "../Box/Box";
|
|
26
27
|
var Alert = React.forwardRef(function (_a, ref) {
|
|
27
|
-
var type = _a.type,
|
|
28
|
-
return (_jsx(
|
|
28
|
+
var type = _a.type, _b = _a.corners, corners = _b === void 0 ? "rounded" : _b, className = _a.className, rest = __rest(_a, ["type", "corners", "className"]);
|
|
29
|
+
return (_jsx(Box, __assign({}, rest, { className: classNames("aui-alert aui-content--".concat(type, " aui-corners--").concat(corners), className), ref: ref })));
|
|
29
30
|
});
|
|
30
31
|
export default Alert;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
type
|
|
2
|
+
import type { Style } from "../../utils/types";
|
|
3
|
+
import { type BoxProps } from "../Box/Box";
|
|
4
|
+
type Props = BoxProps & {
|
|
3
5
|
/**
|
|
4
6
|
* Whether to begin the animation.
|
|
5
7
|
* Set to true to start animation, false to start the exit animation.
|
|
@@ -26,7 +28,7 @@ type Props = {
|
|
|
26
28
|
/**
|
|
27
29
|
* Inline styles to apply to the component while animated
|
|
28
30
|
*/
|
|
29
|
-
style?:
|
|
31
|
+
style?: Style;
|
|
30
32
|
};
|
|
31
33
|
animateFrom?: {
|
|
32
34
|
/**
|
|
@@ -36,20 +38,8 @@ type Props = {
|
|
|
36
38
|
/**
|
|
37
39
|
* Inline styles to apply to the component when not animated
|
|
38
40
|
*/
|
|
39
|
-
style?:
|
|
41
|
+
style?: Style;
|
|
40
42
|
};
|
|
41
|
-
/**
|
|
42
|
-
* Children to render
|
|
43
|
-
*/
|
|
44
|
-
children: React.ReactNode | React.ReactNode[];
|
|
45
|
-
/**
|
|
46
|
-
* [Optional] className to apply to the component always
|
|
47
|
-
*/
|
|
48
|
-
className?: string;
|
|
49
|
-
/**
|
|
50
|
-
* [Optional] Inline styles to apply to the component always
|
|
51
|
-
*/
|
|
52
|
-
style?: React.CSSProperties;
|
|
53
43
|
};
|
|
54
|
-
declare const Animated: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
44
|
+
declare const Animated: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
55
45
|
export default Animated;
|
|
@@ -9,13 +9,25 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
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
|
+
};
|
|
12
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
24
|
import React, { useState, useEffect, useRef } from "react";
|
|
14
25
|
import classNames from "../../functions/classNames";
|
|
26
|
+
import Box from "../Box/Box";
|
|
15
27
|
var Animated = React.forwardRef(function (props, ref) {
|
|
16
|
-
var animated = props.animated, _a = props.duration, duration = _a === void 0 ? 0.25 : _a, _b = props.keepMounted, keepMounted = _b === void 0 ? false : _b, animateTo = props.animateTo, animateFrom = props.animateFrom,
|
|
28
|
+
var animated = props.animated, _a = props.duration, duration = _a === void 0 ? 0.25 : _a, _b = props.keepMounted, keepMounted = _b === void 0 ? false : _b, animateTo = props.animateTo, animateFrom = props.animateFrom, className = props.className, style = props.style, rest = __rest(props, ["animated", "duration", "keepMounted", "animateTo", "animateFrom", "className", "style"]);
|
|
17
29
|
var _c = useState(animated || keepMounted), shouldRender = _c[0], setShouldRender = _c[1];
|
|
18
|
-
var _d = useState(
|
|
30
|
+
var _d = useState(false), isAnimatingForward = _d[0], setIsAnimatingForward = _d[1];
|
|
19
31
|
var timeoutRef = useRef(null);
|
|
20
32
|
var animationFrameRef = useRef(null);
|
|
21
33
|
var clearRefs = function () {
|
|
@@ -29,30 +41,35 @@ var Animated = React.forwardRef(function (props, ref) {
|
|
|
29
41
|
}
|
|
30
42
|
};
|
|
31
43
|
useEffect(function () {
|
|
32
|
-
|
|
33
|
-
if (animated) {
|
|
34
|
-
|
|
35
|
-
// Use requestAnimationFrame so browser paints shouldRender first
|
|
44
|
+
// initiate forward animation
|
|
45
|
+
if (animated && shouldRender) {
|
|
46
|
+
clearRefs();
|
|
36
47
|
animationFrameRef.current = requestAnimationFrame(function () {
|
|
37
|
-
|
|
38
|
-
animationFrameRef.current = null;
|
|
48
|
+
return setIsAnimatingForward(true);
|
|
39
49
|
});
|
|
40
50
|
}
|
|
51
|
+
return clearRefs;
|
|
52
|
+
}, [animated, shouldRender]);
|
|
53
|
+
useEffect(function () {
|
|
54
|
+
// make container element appear on DOM
|
|
55
|
+
if (animated) {
|
|
56
|
+
setShouldRender(true);
|
|
57
|
+
}
|
|
58
|
+
// initiate reverse animation
|
|
41
59
|
else {
|
|
42
|
-
|
|
60
|
+
clearRefs();
|
|
61
|
+
setIsAnimatingForward(false);
|
|
43
62
|
timeoutRef.current = window.setTimeout(function () {
|
|
44
63
|
if (!keepMounted) {
|
|
45
64
|
setShouldRender(false);
|
|
46
65
|
}
|
|
47
|
-
timeoutRef.current = null;
|
|
48
|
-
// convert to ms
|
|
49
66
|
}, duration * 1000);
|
|
50
67
|
}
|
|
51
68
|
return clearRefs;
|
|
52
|
-
}, [animated, duration, keepMounted
|
|
69
|
+
}, [animated, duration, keepMounted]);
|
|
53
70
|
if (!shouldRender)
|
|
54
71
|
return null;
|
|
55
|
-
var currentAnimation =
|
|
56
|
-
return (_jsx(
|
|
72
|
+
var currentAnimation = isAnimatingForward ? animateTo : animateFrom;
|
|
73
|
+
return (_jsx(Box, __assign({ className: classNames(className, currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.className), style: __assign(__assign({ transition: "all ".concat(duration, "s ease-in-out") }, style), currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.style) }, rest, { ref: ref })));
|
|
57
74
|
});
|
|
58
75
|
export default Animated;
|
|
@@ -1,28 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ContentType, CornerType } from "../../types";
|
|
3
|
-
type
|
|
2
|
+
import type { ContentType, CornerType } from "../../utils/types";
|
|
3
|
+
import { type BoxProps } from "../Box/Box";
|
|
4
|
+
type Props = BoxProps & {
|
|
4
5
|
/**
|
|
5
6
|
* The type of badge to display.
|
|
6
7
|
*/
|
|
7
8
|
type: ContentType;
|
|
8
|
-
/**
|
|
9
|
-
* The content to display in the badge.
|
|
10
|
-
* Should be short.
|
|
11
|
-
*/
|
|
12
|
-
children: React.ReactNode | React.ReactNode[];
|
|
13
|
-
/**
|
|
14
|
-
* [Optional] Additional class names to apply to the badge.
|
|
15
|
-
*/
|
|
16
|
-
className?: string;
|
|
17
|
-
/**
|
|
18
|
-
* [Optional] Additional styles to apply to the badge.
|
|
19
|
-
*/
|
|
20
|
-
style?: React.CSSProperties;
|
|
21
9
|
/**
|
|
22
10
|
* [Optional] The corner style of the badge.
|
|
23
11
|
* @default "rounded"
|
|
24
12
|
*/
|
|
25
13
|
corners?: CornerType;
|
|
26
14
|
};
|
|
27
|
-
declare const Badge: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
15
|
+
declare const Badge: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
28
16
|
export default Badge;
|
|
@@ -23,8 +23,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
24
|
import React from "react";
|
|
25
25
|
import classNames from "../../functions/classNames";
|
|
26
|
+
import Box from "../Box/Box";
|
|
26
27
|
var Badge = React.forwardRef(function (_a, ref) {
|
|
27
28
|
var type = _a.type, className = _a.className, _b = _a.corners, corners = _b === void 0 ? "rounded" : _b, rest = __rest(_a, ["type", "className", "corners"]);
|
|
28
|
-
return (_jsx(
|
|
29
|
+
return (_jsx(Box, __assign({}, rest, { className: classNames("aui-badge aui-content--".concat(type, " aui-corners--").concat(corners), className), ref: ref })));
|
|
29
30
|
});
|
|
30
31
|
export default Badge;
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { ContentType } from "../../types";
|
|
3
|
-
type
|
|
2
|
+
import type { ContentType } from "../../utils/types";
|
|
3
|
+
import { type BoxProps } from "../Box/Box";
|
|
4
|
+
type Props = BoxProps & {
|
|
4
5
|
/**
|
|
5
6
|
* The type of badge to display.
|
|
6
7
|
*/
|
|
7
8
|
type: ContentType;
|
|
8
|
-
/**
|
|
9
|
-
* The content to display in the banner.
|
|
10
|
-
*/
|
|
11
|
-
children: React.ReactNode | React.ReactNode[];
|
|
12
|
-
/**
|
|
13
|
-
* [Optional] Additional class names to apply to the banner.
|
|
14
|
-
*/
|
|
15
|
-
className?: string;
|
|
16
|
-
/**
|
|
17
|
-
* [Optional] Additional styles to apply to the banner.
|
|
18
|
-
*/
|
|
19
|
-
style?: React.CSSProperties;
|
|
20
9
|
};
|
|
21
|
-
declare const Banner: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
declare const Banner: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
22
11
|
export default Banner;
|
|
@@ -23,8 +23,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
23
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
24
|
import React from "react";
|
|
25
25
|
import classNames from "../../functions/classNames";
|
|
26
|
+
import Box from "../Box/Box";
|
|
26
27
|
var Banner = React.forwardRef(function (_a, ref) {
|
|
27
28
|
var type = _a.type, className = _a.className, rest = __rest(_a, ["type", "className"]);
|
|
28
|
-
return (_jsx(
|
|
29
|
+
return (_jsx(Box, __assign({}, rest, { className: classNames("aui-content--".concat(type, " aui-banner"), className), ref: ref })));
|
|
29
30
|
});
|
|
30
31
|
export default Banner;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Layout } from "../../utils/types";
|
|
3
|
+
type Props = React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> & {
|
|
4
|
+
/**
|
|
5
|
+
* The organization of the container and its children.
|
|
6
|
+
*/
|
|
7
|
+
layout?: Layout;
|
|
8
|
+
};
|
|
9
|
+
declare const Box: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
10
|
+
export type { Props as BoxProps };
|
|
11
|
+
export default Box;
|
|
@@ -0,0 +1,66 @@
|
|
|
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 React from "react";
|
|
25
|
+
import { classNames } from "../../functions";
|
|
26
|
+
var Box = React.forwardRef(function (_a, ref) {
|
|
27
|
+
var layout = _a.layout, className = _a.className, style = _a.style, rest = __rest(_a, ["layout", "className", "style"]);
|
|
28
|
+
var transformedLayout = transformLayout(layout);
|
|
29
|
+
return (_jsx("div", __assign({}, rest, { className: classNames(transformedLayout.className, className), style: __assign(__assign({}, transformedLayout.style), style), ref: ref })));
|
|
30
|
+
});
|
|
31
|
+
function transformLayout(layout) {
|
|
32
|
+
if (!layout)
|
|
33
|
+
return { className: undefined, style: undefined };
|
|
34
|
+
var axis = layout.axis, gap = layout.gap, align = layout.align, justify = layout.justify, padding = layout.padding, margin = layout.margin, wrap = layout.wrap;
|
|
35
|
+
var style = {};
|
|
36
|
+
var className = "aui-flex-".concat(axis);
|
|
37
|
+
if (align) {
|
|
38
|
+
className = classNames(className, "aui-align-".concat(align));
|
|
39
|
+
}
|
|
40
|
+
if (justify) {
|
|
41
|
+
className = classNames(className, "aui-justify-".concat(justify));
|
|
42
|
+
}
|
|
43
|
+
if (wrap) {
|
|
44
|
+
className = classNames(className, "aui-flex-wrap");
|
|
45
|
+
}
|
|
46
|
+
if (gap) {
|
|
47
|
+
if (typeof gap === "number")
|
|
48
|
+
style.gap = gap;
|
|
49
|
+
else
|
|
50
|
+
className = classNames(className, "aui-gap-".concat(gap));
|
|
51
|
+
}
|
|
52
|
+
if (padding) {
|
|
53
|
+
if (typeof padding === "number")
|
|
54
|
+
style.padding = padding;
|
|
55
|
+
else
|
|
56
|
+
className = classNames(className, "aui-pa-".concat(padding));
|
|
57
|
+
}
|
|
58
|
+
if (margin) {
|
|
59
|
+
if (typeof margin === "number")
|
|
60
|
+
style.margin = margin;
|
|
61
|
+
else
|
|
62
|
+
className = classNames(className, "aui-ma-".concat(margin));
|
|
63
|
+
}
|
|
64
|
+
return { className: className, style: style };
|
|
65
|
+
}
|
|
66
|
+
export default Box;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { CustomLinkElement } from "../Link/Link";
|
|
3
|
-
import { CornerType } from "../../types";
|
|
2
|
+
import { type CustomLinkElement } from "../Link/Link";
|
|
3
|
+
import type { CornerType } from "../../utils/types";
|
|
4
4
|
type DefaultButtonProps = React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement> & {
|
|
5
5
|
/**
|
|
6
6
|
* [Optional] This can be used as a link if the `to` prop is provided
|
|
@@ -26,7 +26,7 @@ type ButtonProps = DefaultButtonProps & {
|
|
|
26
26
|
* Type of button
|
|
27
27
|
* @default "primary"
|
|
28
28
|
*/
|
|
29
|
-
variant?: "primary" | "secondary"
|
|
29
|
+
variant?: "primary" | "secondary";
|
|
30
30
|
/**
|
|
31
31
|
* Type of corners on the button
|
|
32
32
|
* @default "rounded"
|
|
@@ -26,18 +26,18 @@ import { UnstyledLink } from "../Link/Link";
|
|
|
26
26
|
import classNames from "../../functions/classNames";
|
|
27
27
|
export var UnstyledButton = forwardRef(function (_a, ref) {
|
|
28
28
|
var to = _a.to, LinkElement = _a.LinkElement, className = _a.className, props = __rest(_a, ["to", "LinkElement", "className"]);
|
|
29
|
-
className = classNames("
|
|
29
|
+
className = classNames("aui-button-base", className);
|
|
30
30
|
if (to) {
|
|
31
31
|
return (_jsx(UnstyledLink, { to: to, className: className, style: props.style, role: "button", LinkElement: LinkElement, "aria-label": props["aria-label"], children: props.children }));
|
|
32
32
|
}
|
|
33
|
-
return _jsx("button", __assign({}, props, { className: className, ref: ref }));
|
|
33
|
+
return (_jsx("button", __assign({}, props, { className: classNames("aui-action", className), ref: ref })));
|
|
34
34
|
});
|
|
35
35
|
export var IconButton = forwardRef(function (_a, ref) {
|
|
36
36
|
var icon = _a.icon, className = _a.className, props = __rest(_a, ["icon", "className"]);
|
|
37
|
-
return (_jsx(UnstyledButton, __assign({}, props, { className: classNames("
|
|
37
|
+
return (_jsx(UnstyledButton, __assign({}, props, { className: classNames("aui-icon-button", className), ref: ref, children: icon })));
|
|
38
38
|
});
|
|
39
39
|
var Button = forwardRef(function (_a, ref) {
|
|
40
40
|
var _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.corners, corners = _c === void 0 ? "rounded" : _c, className = _a.className, _d = _a.size, size = _d === void 0 ? "regular" : _d, rest = __rest(_a, ["variant", "corners", "className", "size"]);
|
|
41
|
-
return (_jsx(UnstyledButton, __assign({}, rest, { className: classNames("
|
|
41
|
+
return (_jsx(UnstyledButton, __assign({}, rest, { className: classNames("aui-button--".concat(variant, " aui-button-size--").concat(size, " aui-corners--").concat(corners), className), ref: ref })));
|
|
42
42
|
});
|
|
43
43
|
export default Button;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import type { Style } from "../../utils/types";
|
|
3
|
+
import { type BoxProps } from "../Box/Box";
|
|
2
4
|
type ButtonProps = {
|
|
3
5
|
/**
|
|
4
6
|
* Children to render inside the button
|
|
5
7
|
*/
|
|
6
|
-
children?: React.ReactNode;
|
|
8
|
+
children?: React.ReactNode | React.ReactNode[];
|
|
7
9
|
/**
|
|
8
10
|
* Additional class name to apply to the button
|
|
9
11
|
*/
|
|
@@ -11,9 +13,9 @@ type ButtonProps = {
|
|
|
11
13
|
/**
|
|
12
14
|
* Additional styles to apply to the button
|
|
13
15
|
*/
|
|
14
|
-
style?:
|
|
16
|
+
style?: Style;
|
|
15
17
|
};
|
|
16
|
-
type Props = {
|
|
18
|
+
type Props = BoxProps & {
|
|
17
19
|
/**
|
|
18
20
|
* The child elements/slides of the carousel
|
|
19
21
|
*/
|
|
@@ -50,14 +52,6 @@ type Props = {
|
|
|
50
52
|
* [Optional] props to supply to the right arrow button
|
|
51
53
|
*/
|
|
52
54
|
rightArrowProps?: ButtonProps;
|
|
53
|
-
/**
|
|
54
|
-
* [Optional] Additional class name to apply to the carousel.
|
|
55
|
-
*/
|
|
56
|
-
className?: string;
|
|
57
|
-
/**
|
|
58
|
-
* [Optional] Additional styles to apply to the carousel.
|
|
59
|
-
*/
|
|
60
|
-
style?: React.CSSProperties;
|
|
61
55
|
};
|
|
62
|
-
declare const Carousel: React.ForwardRefExoticComponent<Props & React.RefAttributes<HTMLDivElement>>;
|
|
56
|
+
declare const Carousel: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
63
57
|
export default Carousel;
|
|
@@ -9,18 +9,30 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
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
|
+
};
|
|
12
23
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
13
24
|
import React, { useState, useEffect, useRef, useCallback } from "react";
|
|
14
25
|
import { classNames } from "../../functions";
|
|
15
26
|
import Button from "../Button";
|
|
27
|
+
import Box from "../Box/Box";
|
|
16
28
|
var DEFAULT_DURATION_S = 1;
|
|
17
|
-
var Carousel = React.forwardRef(function (
|
|
18
|
-
var
|
|
19
|
-
var children =
|
|
29
|
+
var Carousel = React.forwardRef(function (_a, ref) {
|
|
30
|
+
var _b, _c;
|
|
31
|
+
var children = _a.children, className = _a.className, hideArrows = _a.hideArrows, hideDots = _a.hideDots, dotProps = _a.dotProps, leftArrowProps = _a.leftArrowProps, rightArrowProps = _a.rightArrowProps, autoplayInterval = _a.autoplayInterval, duration = _a.duration, rest = __rest(_a, ["children", "className", "hideArrows", "hideDots", "dotProps", "leftArrowProps", "rightArrowProps", "autoplayInterval", "duration"]);
|
|
20
32
|
// min duration
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
? Math.max(duration,
|
|
33
|
+
duration = Math.max(duration !== null && duration !== void 0 ? duration : DEFAULT_DURATION_S, 0.1);
|
|
34
|
+
autoplayInterval = autoplayInterval
|
|
35
|
+
? Math.max(duration, autoplayInterval)
|
|
24
36
|
: undefined;
|
|
25
37
|
var length = children.length;
|
|
26
38
|
var _d = useState({
|
|
@@ -68,7 +80,7 @@ var Carousel = React.forwardRef(function (props, ref) {
|
|
|
68
80
|
transition: "transform ".concat(duration, "s ease-in-out"),
|
|
69
81
|
}
|
|
70
82
|
: undefined;
|
|
71
|
-
return (_jsxs(
|
|
83
|
+
return (_jsxs(Box, __assign({}, rest, { className: classNames("aui-carousel", className), ref: ref, children: [_jsxs(Box, { className: "aui-carousel-slider", style: __assign(__assign({}, animatingStyles), { flexDirection: delta >= 0 ? "row" : "row-reverse" }), onTransitionEnd: onTransitionEnd, children: [_jsx(Box, { className: "aui-carousel-item", children: children[cur] }), _jsx(Box, { className: "aui-carousel-item", "aria-hidden": true, children: children[next] })] }), length > 1 && (_jsxs(_Fragment, { children: [!hideArrows && (_jsxs(_Fragment, { children: [_jsx(Button, { className: classNames("aui-flex-x aui-align-center aui-justify-center aui-carousel-arrow", leftArrowProps === null || leftArrowProps === void 0 ? void 0 : leftArrowProps.className), style: __assign({ left: 8 }, leftArrowProps === null || leftArrowProps === void 0 ? void 0 : leftArrowProps.style), corners: "pill", "aria-label": "previous", onClick: function () { return startTransition(-1); }, children: (_b = leftArrowProps === null || leftArrowProps === void 0 ? void 0 : leftArrowProps.children) !== null && _b !== void 0 ? _b : "←" }), _jsx(Button, { className: classNames("aui-flex-x aui-align-center aui-justify-center aui-carousel-arrow", rightArrowProps === null || rightArrowProps === void 0 ? void 0 : rightArrowProps.className), style: __assign({ right: 8 }, rightArrowProps === null || rightArrowProps === void 0 ? void 0 : rightArrowProps.style), corners: "pill", "aria-label": "next", onClick: function () { return startTransition(1); }, children: (_c = rightArrowProps === null || rightArrowProps === void 0 ? void 0 : rightArrowProps.children) !== null && _c !== void 0 ? _c : "→" })] })), !hideDots && (_jsx(Box, { layout: { axis: "x", align: "center", gap: "xs" }, className: "aui-carousel-dots", children: children.map(function (_, i) { return (_jsx(Button, { className: classNames("aui-carousel-dot", dotProps === null || dotProps === void 0 ? void 0 : dotProps.className), corners: "pill", disabled: cur === i || animating, onClick: function () { return startTransition(i - cur); }, style: dotProps === null || dotProps === void 0 ? void 0 : dotProps.style }, i)); }) }))] }))] })));
|
|
72
84
|
});
|
|
73
85
|
function safeMod(n, m) {
|
|
74
86
|
return ((n % m) + m) % m;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Style } from "../../utils/types";
|
|
1
2
|
export type Props = {
|
|
2
3
|
/**
|
|
3
4
|
* Size of the button in pixels
|
|
@@ -39,17 +40,17 @@ export type Props = {
|
|
|
39
40
|
/**
|
|
40
41
|
* [Optional] additional styles to apply to the button
|
|
41
42
|
*/
|
|
42
|
-
style?:
|
|
43
|
+
style?: Style;
|
|
43
44
|
/**
|
|
44
45
|
* [Optional] round corners of the bars
|
|
45
46
|
*/
|
|
46
47
|
rounded?: boolean;
|
|
47
48
|
};
|
|
48
49
|
type OpenStyle = {
|
|
49
|
-
outer?:
|
|
50
|
-
top:
|
|
51
|
-
bottom:
|
|
52
|
-
middle?:
|
|
50
|
+
outer?: Style;
|
|
51
|
+
top: Style;
|
|
52
|
+
bottom: Style;
|
|
53
|
+
middle?: Style;
|
|
53
54
|
};
|
|
54
55
|
type InnerProps = Omit<Props, "variant" | "direction"> & {
|
|
55
56
|
double?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { InputProps } from "./Input";
|
|
3
|
-
import { CornerType } from "../../types";
|
|
3
|
+
import type { CornerType, Style } from "../../utils/types";
|
|
4
4
|
type IconInputProps = {
|
|
5
5
|
/**
|
|
6
6
|
* [Optional] Icon to display at the start of the input
|
|
@@ -17,7 +17,7 @@ type IconInputProps = {
|
|
|
17
17
|
/**
|
|
18
18
|
* [Optional] Inline styles to add to the container
|
|
19
19
|
*/
|
|
20
|
-
style?:
|
|
20
|
+
style?: Style;
|
|
21
21
|
/**
|
|
22
22
|
* [Optional] Corner style for the input
|
|
23
23
|
*/
|
|
@@ -12,8 +12,9 @@ var __assign = (this && this.__assign) || function () {
|
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { forwardRef } from "react";
|
|
14
14
|
import classNames from "../../functions/classNames";
|
|
15
|
+
import Box from "../Box";
|
|
15
16
|
var IconInput = forwardRef(function (_a, ref) {
|
|
16
17
|
var startIcon = _a.startIcon, endIcon = _a.endIcon, className = _a.className, style = _a.style, _b = _a.corners, corners = _b === void 0 ? "rounded" : _b, inputProps = _a.inputProps;
|
|
17
|
-
return (_jsxs("
|
|
18
|
+
return (_jsxs(Box, { layout: { axis: "x", align: "center" }, className: classNames("aui-input-default aui-icon-input aui-corners--".concat(corners), className), style: style, ref: ref, children: [startIcon, _jsx("input", __assign({}, inputProps, { className: classNames("aui-input-base aui-corners--".concat(corners), inputProps === null || inputProps === void 0 ? void 0 : inputProps.className) })), endIcon] }));
|
|
18
19
|
});
|
|
19
20
|
export default IconInput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { CornerType } from "../../types";
|
|
2
|
+
import type { CornerType } from "../../utils/types";
|
|
3
3
|
type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
|
|
4
4
|
/**
|
|
5
5
|
* Type of corners on the input
|
|
@@ -25,6 +25,6 @@ import { forwardRef } from "react";
|
|
|
25
25
|
import classNames from "../../functions/classNames";
|
|
26
26
|
var Input = forwardRef(function (_a, ref) {
|
|
27
27
|
var className = _a.className, _b = _a.corners, corners = _b === void 0 ? "rounded" : _b, props = __rest(_a, ["className", "corners"]);
|
|
28
|
-
return (_jsx("input", __assign({}, props, { ref: ref, className: classNames("
|
|
28
|
+
return (_jsx("input", __assign({}, props, { ref: ref, className: classNames("aui-input-base aui-input-default aui-corners--".concat(corners), className) })));
|
|
29
29
|
});
|
|
30
30
|
export default Input;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { CornerType } from "../../types";
|
|
2
|
+
import type { CornerType } from "../../utils/types";
|
|
3
3
|
type TextAreaProps = React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> & {
|
|
4
4
|
/**
|
|
5
5
|
* Type of corners on the text area
|
|
@@ -25,6 +25,6 @@ import { forwardRef } from "react";
|
|
|
25
25
|
import classNames from "../../functions/classNames";
|
|
26
26
|
var TextArea = forwardRef(function (_a, ref) {
|
|
27
27
|
var className = _a.className, _b = _a.rows, rows = _b === void 0 ? 3 : _b, _c = _a.corners, corners = _c === void 0 ? "rounded" : _c, props = __rest(_a, ["className", "rows", "corners"]);
|
|
28
|
-
return (_jsx("textarea", __assign({}, props, { ref: ref, className: classNames("
|
|
28
|
+
return (_jsx("textarea", __assign({}, props, { ref: ref, className: classNames("aui-input-base aui-input-default aui-corners--".concat(corners), className), rows: rows })));
|
|
29
29
|
});
|
|
30
30
|
export default TextArea;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
type
|
|
2
|
+
import { type BoxProps } from "../Box/Box";
|
|
3
|
+
type Props<T extends React.ElementType> = Omit<BoxProps, "children"> & {
|
|
3
4
|
/**
|
|
4
5
|
* Callback that fires when the user clicks outside the layer
|
|
5
6
|
*/
|
|
@@ -8,15 +9,7 @@ type Props = {
|
|
|
8
9
|
* The child of the layer.
|
|
9
10
|
* IMPORTANT: the child must be able to accept a ref
|
|
10
11
|
*/
|
|
11
|
-
children: React.ReactElement
|
|
12
|
-
/**
|
|
13
|
-
* [Optional] Additional class name
|
|
14
|
-
*/
|
|
15
|
-
className?: string;
|
|
16
|
-
/**
|
|
17
|
-
* [Optional] Additional styles
|
|
18
|
-
*/
|
|
19
|
-
style?: React.CSSProperties;
|
|
12
|
+
children: React.ReactElement<React.ComponentPropsWithRef<T>>;
|
|
20
13
|
/**
|
|
21
14
|
* [Optional] Whether to disable the escape key to close the layer
|
|
22
15
|
* @default false
|
|
@@ -33,5 +26,5 @@ type Props = {
|
|
|
33
26
|
*/
|
|
34
27
|
disableScrollLock?: boolean;
|
|
35
28
|
};
|
|
36
|
-
declare const Layer: ({ returnFocusOnEscape, disableScrollLock, ...props }: Props) => React.JSX.Element;
|
|
29
|
+
declare const Layer: <T extends React.ElementType>({ returnFocusOnEscape, disableScrollLock, ...props }: Props<T>) => React.JSX.Element;
|
|
37
30
|
export default Layer;
|
|
@@ -24,6 +24,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
24
24
|
import React, { useEffect } from "react";
|
|
25
25
|
import { useFocusTrap, useScrollLock } from "../../hooks";
|
|
26
26
|
import classNames from "../../functions/classNames";
|
|
27
|
+
import Box from "../Box/Box";
|
|
27
28
|
var BaseLayer = function (_a) {
|
|
28
29
|
var onClose = _a.onClose, children = _a.children, style = _a.style, className = _a.className, _b = _a.disableEscape, disableEscape = _b === void 0 ? false : _b, visible = _a.visible;
|
|
29
30
|
var focusRef = useFocusTrap(visible);
|
|
@@ -40,7 +41,7 @@ var BaseLayer = function (_a) {
|
|
|
40
41
|
document.removeEventListener("keydown", handleEscape);
|
|
41
42
|
};
|
|
42
43
|
}, [onClose, disableEscape]);
|
|
43
|
-
return (_jsx("
|
|
44
|
+
return (_jsx(Box, { layout: { axis: "y", align: "center", justify: "center" }, className: classNames("aui-layer-backdrop", className), style: style, onMouseDown: onClose, children: React.cloneElement(children, {
|
|
44
45
|
ref: focusRef,
|
|
45
46
|
onMouseDown: function (e) {
|
|
46
47
|
var _a, _b;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
type BuiltinLinkProps = Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "href">;
|
|
3
|
-
export type CustomLinkElement =
|
|
3
|
+
export type CustomLinkElement = React.ForwardRefExoticComponent<BuiltinLinkProps & {
|
|
4
4
|
to: string;
|
|
5
|
-
} &
|
|
6
|
-
ref?: React.MutableRefObject<HTMLAnchorElement>;
|
|
7
|
-
}) => React.ReactNode;
|
|
5
|
+
} & React.RefAttributes<HTMLAnchorElement>>;
|
|
8
6
|
type DefaultLinkProps = BuiltinLinkProps & {
|
|
9
7
|
/**
|
|
10
8
|
* URL to navigate to
|