@adamjanicki/ui 1.6.6 → 1.6.8

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.
Files changed (40) hide show
  1. package/components/Accordion/Accordion.js +12 -13
  2. package/components/Alert/Alert.d.ts +1 -6
  3. package/components/Alert/Alert.js +2 -2
  4. package/components/Animated/Animated.d.ts +21 -22
  5. package/components/Animated/Animated.js +2 -2
  6. package/components/Avatar/Avatar.d.ts +1 -6
  7. package/components/Avatar/Avatar.js +4 -4
  8. package/components/Badge/Badge.d.ts +1 -6
  9. package/components/Badge/Badge.js +2 -2
  10. package/components/Banner/Banner.js +2 -2
  11. package/components/Box/Box.d.ts +1 -1
  12. package/components/Button/Button.d.ts +19 -16
  13. package/components/Button/Button.js +18 -10
  14. package/components/Carousel/Carousel.js +16 -3
  15. package/components/Hamburger/Hamburger.d.ts +1 -1
  16. package/components/Icon/Icon.d.ts +2 -1
  17. package/components/Icon/Icon.js +2 -1
  18. package/components/Input/IconInput.d.ts +5 -17
  19. package/components/Input/IconInput.js +16 -3
  20. package/components/Input/Input.d.ts +5 -10
  21. package/components/Input/Input.js +3 -2
  22. package/components/Input/TextArea.d.ts +3 -9
  23. package/components/Input/TextArea.js +3 -2
  24. package/components/Layer/Layer.js +2 -2
  25. package/components/Link/Link.d.ts +7 -5
  26. package/components/Link/Link.js +12 -8
  27. package/components/Modal/Modal.js +12 -2
  28. package/components/Select/Select.d.ts +6 -5
  29. package/components/Select/Select.js +5 -3
  30. package/components/Spinner/Spinner.d.ts +2 -11
  31. package/components/Spinner/Spinner.js +1 -1
  32. package/components/ui.d.ts +5 -5
  33. package/components/ui.js +5 -5
  34. package/package.json +1 -1
  35. package/style.css +1 -1
  36. package/utils/transformVfx.d.ts +2 -0
  37. package/utils/transformVfx.js +103 -0
  38. package/utils/types.d.ts +70 -50
  39. package/utils/transformLayout.d.ts +0 -2
  40. package/utils/transformLayout.js +0 -76
@@ -26,10 +26,9 @@ import Box from "../Box/Box";
26
26
  import Icon from "../Icon";
27
27
  import { UnstyledButton } from "../Button";
28
28
  import Animated from "../Animated";
29
- import { classNames } from "../../functions";
30
29
  var Accordion = React.forwardRef(function (_a, ref) {
31
- var drawers = _a.drawers, className = _a.className, duration = _a.duration, hideDividers = _a.hideDividers, layout = _a.layout, rest = __rest(_a, ["drawers", "className", "duration", "hideDividers", "layout"]);
32
- return (_jsx(Box, __assign({ layout: __assign({ axis: "y" }, layout) }, rest, { className: classNames("aui-accordion aui-corners--rounded", className), ref: ref, children: drawers.map(function (item, i) { return (_jsx(Drawer, { item: item, duration: duration, showDivider: !hideDividers && i < drawers.length - 1 }, i)); }) })));
30
+ var drawers = _a.drawers, duration = _a.duration, hideDividers = _a.hideDividers, vfx = _a.vfx, rest = __rest(_a, ["drawers", "duration", "hideDividers", "vfx"]);
31
+ return (_jsx(Box, __assign({ vfx: __assign({ axis: "y", radius: "rounded", color: "default", backgroundColor: "default", shadow: "subtle", border: true }, vfx) }, rest, { ref: ref, children: drawers.map(function (item, i) { return (_jsx(Drawer, { item: item, duration: duration, showDivider: !hideDividers && i < drawers.length - 1 }, i)); }) })));
33
32
  });
34
33
  var Drawer = function (_a) {
35
34
  var item = _a.item, duration = _a.duration, showDivider = _a.showDivider;
@@ -43,15 +42,15 @@ var Drawer = function (_a) {
43
42
  }, [open, children]);
44
43
  // TODO: change this to use calc-size when supported
45
44
  // https://developer.mozilla.org/en-US/docs/Web/CSS/calc-size#browser_compatibility
46
- return (_jsxs(_Fragment, { children: [_jsxs(Box, { layout: { axis: "y" }, children: [_jsx(UnstyledButton, { onClick: function () { return onOpenChange(!open); }, children: _jsxs(Box, { layout: { axis: "x", align: "center", gap: "s", padding: "m" }, children: [_jsx(Icon, { size: "xs", icon: open ? "chevron-down" : "chevron-right", className: "aui-accordion-arrow" }), _jsx(Box, { className: "aui-accordion-label", children: item.label })] }) }), _jsx(Animated, { style: { overflow: "hidden" }, keepMounted: true, duration: duration, visible: open, animateFrom: {
47
- style: {
48
- visibility: "hidden",
49
- height: 0,
50
- transform: "translateY(-4px)",
51
- opacity: 0.9,
52
- },
53
- }, animateTo: {
54
- style: { height: height, transform: "translateY(0)", opacity: 1 },
55
- }, children: _jsx(Box, { ref: boxRef, children: children }) })] }), showDivider && _jsx("hr", { className: "aui-accordion-hr" })] }));
45
+ return (_jsx(_Fragment, { children: _jsxs(Box, { vfx: { axis: "y", borderBottom: showDivider }, children: [_jsx(UnstyledButton, { onClick: function () { return onOpenChange(!open); }, children: _jsxs(Box, { vfx: { axis: "x", align: "center", gap: "s", padding: "m" }, children: [_jsx(Icon, { vfx: { color: "muted" }, size: "xs", icon: open ? "chevron-down" : "chevron-right" }), _jsx(Box, { vfx: { fontWeight: 6 }, children: item.label })] }) }), _jsx(Animated, { vfx: { overflow: "hidden" }, keepMounted: true, duration: duration, visible: open, animateFrom: {
46
+ style: {
47
+ visibility: "hidden",
48
+ height: 0,
49
+ transform: "translateY(-4px)",
50
+ opacity: 0.9,
51
+ },
52
+ }, animateTo: {
53
+ style: { height: height, transform: "translateY(0)", opacity: 1 },
54
+ }, children: _jsx(Box, { ref: boxRef, children: children }) })] }) }));
56
55
  };
57
56
  export default Accordion;
@@ -1,16 +1,11 @@
1
1
  import React from "react";
2
- import type { ContentType, CornerType } from "../../utils/types";
2
+ import type { ContentType } from "../../utils/types";
3
3
  import { type BoxProps } from "../Box/Box";
4
4
  type Props = BoxProps & {
5
5
  /**
6
6
  * The type of alert to display.
7
7
  */
8
8
  type: ContentType;
9
- /**
10
- * [Optional] The corner style of the alert.
11
- * @default "rounded"
12
- */
13
- corners?: CornerType;
14
9
  };
15
10
  declare const Alert: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
11
  export default Alert;
@@ -25,7 +25,7 @@ import React from "react";
25
25
  import classNames from "../../functions/classNames";
26
26
  import Box from "../Box/Box";
27
27
  var Alert = React.forwardRef(function (_a, ref) {
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 })));
28
+ var type = _a.type, vfx = _a.vfx, className = _a.className, rest = __rest(_a, ["type", "vfx", "className"]);
29
+ return (_jsx(Box, __assign({}, rest, { vfx: __assign({ radius: "rounded", fontWeight: 4, padding: "m" }, vfx), className: classNames("aui-alert aui-content-".concat(type), className), ref: ref })));
30
30
  });
31
31
  export default Alert;
@@ -1,6 +1,20 @@
1
1
  import React from "react";
2
- import type { Style } from "../../utils/types";
2
+ import type { Vfx, Style } from "../../utils/types";
3
3
  import { type BoxProps } from "../Box/Box";
4
+ type AnimationState = {
5
+ /**
6
+ * Class to apply to the component when at this state
7
+ */
8
+ className?: string;
9
+ /**
10
+ * Inline styles to apply to the component at this state
11
+ */
12
+ style?: Style;
13
+ /**
14
+ * The VFX or other organizational css to apply at this state
15
+ */
16
+ vfx?: Vfx;
17
+ };
4
18
  type Props = BoxProps & {
5
19
  /**
6
20
  * Whether to begin the animation and render the component.
@@ -27,28 +41,13 @@ type Props = BoxProps & {
27
41
  */
28
42
  keepMounted?: boolean;
29
43
  /**
30
- * Animation configuration for the enter state
44
+ * Animation css for the start state
31
45
  */
32
- animateTo?: {
33
- /**
34
- * Class name to apply to the component while animated (after state)
35
- */
36
- className?: string;
37
- /**
38
- * Inline styles to apply to the component while animated
39
- */
40
- style?: Style;
41
- };
42
- animateFrom?: {
43
- /**
44
- * Class name to apply to the component when not animated (before state)
45
- */
46
- className?: string;
47
- /**
48
- * Inline styles to apply to the component when not animated
49
- */
50
- style?: Style;
51
- };
46
+ animateTo?: AnimationState;
47
+ /**
48
+ * animation css for the end state
49
+ */
50
+ animateFrom?: AnimationState;
52
51
  /**
53
52
  * The properties to apply a transition
54
53
  * @default ['all']
@@ -25,7 +25,7 @@ import React, { useState, useEffect, useRef } from "react";
25
25
  import classNames from "../../functions/classNames";
26
26
  import Box from "../Box/Box";
27
27
  var Animated = React.forwardRef(function (props, ref) {
28
- var visible = props.visible, _a = props.duration, duration = _a === void 0 ? 0.25 : _a, _b = props.keepMounted, keepMounted = _b === void 0 ? false : _b, _c = props.transitionProperties, transitionProperties = _c === void 0 ? ["all"] : _c, animateTo = props.animateTo, animateFrom = props.animateFrom, className = props.className, style = props.style, rest = __rest(props, ["visible", "duration", "keepMounted", "transitionProperties", "animateTo", "animateFrom", "className", "style"]);
28
+ var visible = props.visible, _a = props.duration, duration = _a === void 0 ? 0.25 : _a, _b = props.keepMounted, keepMounted = _b === void 0 ? false : _b, _c = props.transitionProperties, transitionProperties = _c === void 0 ? ["all"] : _c, animateTo = props.animateTo, animateFrom = props.animateFrom, className = props.className, vfx = props.vfx, style = props.style, rest = __rest(props, ["visible", "duration", "keepMounted", "transitionProperties", "animateTo", "animateFrom", "className", "vfx", "style"]);
29
29
  var forwardDuration = typeof duration === "number" ? duration : duration.forward;
30
30
  var reverseDuration = typeof duration === "number" ? duration : duration.reverse;
31
31
  var instantForward = forwardDuration <= 0;
@@ -82,7 +82,7 @@ var Animated = React.forwardRef(function (props, ref) {
82
82
  else if (phase === "reverse" && !instantReverse) {
83
83
  transition = makeTransition(transitionProperties, reverseDuration);
84
84
  }
85
- return (_jsx(Box, __assign({ className: classNames(className, currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.className), style: __assign(__assign({ transition: transition }, style), currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.style) }, rest, { ref: ref })));
85
+ return (_jsx(Box, __assign({ className: classNames(className, currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.className), style: __assign(__assign({ transition: transition }, style), currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.style), vfx: __assign(__assign({}, vfx), currentAnimation === null || currentAnimation === void 0 ? void 0 : currentAnimation.vfx) }, rest, { ref: ref })));
86
86
  });
87
87
  var makeTransition = function (transitionProperties, duration) {
88
88
  return transitionProperties.length > 0
@@ -1,12 +1,7 @@
1
1
  import React from "react";
2
- import type { CornerType, SizeToken } from "../../utils/types";
2
+ import type { SizeToken } from "../../utils/types";
3
3
  import { type BoxProps } from "../Box/Box";
4
4
  type Props = Omit<BoxProps, "children"> & {
5
- /**
6
- * How to treat the border radius of the avatar
7
- * @default "rounded"
8
- */
9
- corners?: CornerType;
10
5
  /**
11
6
  * Size of the avatar
12
7
  * @default "s"
@@ -25,11 +25,11 @@ import React, { useState } from "react";
25
25
  import Box from "../Box/Box";
26
26
  import { classNames } from "../../functions";
27
27
  var Avatar = React.forwardRef(function (_a, ref) {
28
- var _b = _a.size, size = _b === void 0 ? "s" : _b, backgroundImage = _a.backgroundImage, className = _a.className, style = _a.style, _c = _a.corners, corners = _c === void 0 ? "rounded" : _c, username = _a.username, rest = __rest(_a, ["size", "backgroundImage", "className", "style", "corners", "username"]);
29
- var _d = useState(false), imageError = _d[0], setImageError = _d[1];
28
+ var _b = _a.size, size = _b === void 0 ? "s" : _b, backgroundImage = _a.backgroundImage, className = _a.className, style = _a.style, username = _a.username, vfx = _a.vfx, rest = __rest(_a, ["size", "backgroundImage", "className", "style", "username", "vfx"]);
29
+ var _c = useState(false), imageError = _c[0], setImageError = _c[1];
30
30
  var useFallback = imageError || !backgroundImage;
31
31
  var color = chooseColor(username);
32
- var avatarClassName = "aui-avatar aui-corners--".concat(corners);
32
+ var avatarClassName = null;
33
33
  if (useFallback) {
34
34
  avatarClassName = classNames(avatarClassName, "aui-avatar-".concat(color));
35
35
  }
@@ -45,7 +45,7 @@ var Avatar = React.forwardRef(function (_a, ref) {
45
45
  imageClassName = "aui-avatar-".concat(size);
46
46
  }
47
47
  var fallbackCharacter = username[0];
48
- return (_jsx(Box, __assign({ className: classNames(avatarClassName, className), style: __assign(__assign({}, avatarStyle), style) }, rest, { ref: ref, children: !useFallback ? (_jsx("img", { src: backgroundImage, alt: "", className: imageClassName, onError: function () { return setImageError(true); }, style: imageStyle })) : (fallbackCharacter) })));
48
+ return (_jsx(Box, __assign({ className: classNames(avatarClassName, className), style: __assign(__assign({}, avatarStyle), style), vfx: __assign({ radius: "rounded", overflow: "hidden", fontWeight: 6, textAlign: "center" }, vfx) }, rest, { ref: ref, children: !useFallback ? (_jsx("img", { src: backgroundImage, alt: "", className: imageClassName, onError: function () { return setImageError(true); }, style: imageStyle })) : (fallbackCharacter) })));
49
49
  });
50
50
  var colorOptions = ["red", "yellow", "green", "blue", "purple"];
51
51
  // simple deterministic "hash" to get a background color
@@ -1,16 +1,11 @@
1
1
  import React from "react";
2
- import type { ContentType, CornerType } from "../../utils/types";
2
+ import type { ContentType } from "../../utils/types";
3
3
  import { type BoxProps } from "../Box/Box";
4
4
  type Props = BoxProps & {
5
5
  /**
6
6
  * The type of badge to display.
7
7
  */
8
8
  type: ContentType;
9
- /**
10
- * [Optional] The corner style of the badge.
11
- * @default "rounded"
12
- */
13
- corners?: CornerType;
14
9
  };
15
10
  declare const Badge: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLDivElement>>;
16
11
  export default Badge;
@@ -25,7 +25,7 @@ import React from "react";
25
25
  import classNames from "../../functions/classNames";
26
26
  import Box from "../Box/Box";
27
27
  var Badge = React.forwardRef(function (_a, ref) {
28
- var type = _a.type, className = _a.className, _b = _a.corners, corners = _b === void 0 ? "rounded" : _b, rest = __rest(_a, ["type", "className", "corners"]);
29
- return (_jsx(Box, __assign({}, rest, { className: classNames("aui-badge aui-content--".concat(type, " aui-corners--").concat(corners), className), ref: ref })));
28
+ var type = _a.type, className = _a.className, vfx = _a.vfx, rest = __rest(_a, ["type", "className", "vfx"]);
29
+ return (_jsx(Box, __assign({}, rest, { vfx: __assign({ radius: "rounded", paddingY: "xxs", paddingX: "xs", fontWeight: 5, fontSize: "s", width: "fit" }, vfx), className: classNames("aui-badge aui-content-".concat(type), className), ref: ref })));
30
30
  });
31
31
  export default Badge;
@@ -25,7 +25,7 @@ import React from "react";
25
25
  import classNames from "../../functions/classNames";
26
26
  import Box from "../Box/Box";
27
27
  var Banner = React.forwardRef(function (_a, ref) {
28
- var type = _a.type, className = _a.className, rest = __rest(_a, ["type", "className"]);
29
- return (_jsx(Box, __assign({}, rest, { className: classNames("aui-content--".concat(type, " aui-banner"), className), ref: ref })));
28
+ var type = _a.type, className = _a.className, vfx = _a.vfx, rest = __rest(_a, ["type", "className", "vfx"]);
29
+ return (_jsx(Box, __assign({}, rest, { vfx: __assign({ fontWeight: 4, paddingY: "l", paddingX: "xl", width: "full" }, vfx), className: classNames("aui-content-".concat(type), className), ref: ref })));
30
30
  });
31
31
  export default Banner;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  declare const Box: React.ForwardRefExoticComponent<Omit<React.ClassAttributes<HTMLDivElement> & React.HTMLAttributes<HTMLDivElement> & {
3
- layout?: import("../../utils/types").Layout;
3
+ vfx?: import("../../utils/types").Vfx;
4
4
  }, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
5
  export type BoxProps = React.ComponentProps<typeof Box>;
6
6
  export default Box;
@@ -1,24 +1,13 @@
1
1
  import React from "react";
2
- import type { CornerType, Layout } from "../../utils/types";
3
2
  import { Props as IconProps } from "../Icon/Icon";
4
- type BaseButtonProps = React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>;
5
- type DefaultButtonProps = BaseButtonProps & {
6
- /**
7
- * Additional styles to apply to the layout that are transformed to classNames to be easier to override if needed
8
- */
9
- layout?: Layout;
10
- };
3
+ import ui from "../ui";
4
+ type DefaultButtonProps = React.ComponentProps<typeof ui.button>;
11
5
  export type VisualButtonProps = {
12
6
  /**
13
7
  * Type of button
14
8
  * @default "primary"
15
9
  */
16
10
  variant?: "primary" | "secondary";
17
- /**
18
- * Type of corners on the button
19
- * @default "rounded"
20
- */
21
- corners?: CornerType;
22
11
  /**
23
12
  * [Optional] Size of the button, if wishing to make smaller
24
13
  * @default "regular"
@@ -26,8 +15,10 @@ export type VisualButtonProps = {
26
15
  size?: "regular" | "small";
27
16
  };
28
17
  type ButtonProps = DefaultButtonProps & VisualButtonProps;
29
- export declare const UnstyledButton: React.ForwardRefExoticComponent<Omit<DefaultButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
30
- type IconButtonProps = Omit<BaseButtonProps, "children"> & {
18
+ export declare const UnstyledButton: React.ForwardRefExoticComponent<Omit<Omit<React.ClassAttributes<HTMLButtonElement> & React.ButtonHTMLAttributes<HTMLButtonElement> & {
19
+ vfx?: import("../../utils/types").Vfx;
20
+ }, "ref"> & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
21
+ type IconButtonProps = Omit<DefaultButtonProps, "children"> & {
31
22
  /**
32
23
  * The hover effect to play when the user hovers over the button
33
24
  * @default "dim"
@@ -48,5 +39,17 @@ type IconButtonProps = Omit<BaseButtonProps, "children"> & {
48
39
  };
49
40
  export declare const IconButton: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
50
41
  declare const Button: React.ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
51
- export declare const getButtonClassName: ({ variant, corners, size, }: VisualButtonProps) => string;
42
+ export declare const getButtonProps: ({ variant, size, }: VisualButtonProps) => {
43
+ className: string;
44
+ vfx: {
45
+ readonly radius: "rounded";
46
+ readonly fontWeight: 6;
47
+ readonly fontSize: "xs";
48
+ readonly padding: "xs";
49
+ } | {
50
+ readonly radius: "rounded";
51
+ readonly fontWeight: 6;
52
+ readonly padding: "s";
53
+ };
54
+ };
52
55
  export default Button;
@@ -23,22 +23,30 @@ 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 transformLayout from "../../utils/transformLayout";
27
26
  import Icon from "../Icon/Icon";
27
+ import ui from "../ui";
28
28
  export var UnstyledButton = React.forwardRef(function (_a, ref) {
29
- var className = _a.className, layout = _a.layout, props = __rest(_a, ["className", "layout"]);
30
- return (_jsx("button", __assign({}, props, { className: classNames("aui-action aui-button", transformLayout(layout), className), ref: ref })));
29
+ var className = _a.className, props = __rest(_a, ["className"]);
30
+ return (_jsx(ui.button, __assign({}, props, { className: classNames("aui-action aui-button", className), ref: ref })));
31
31
  });
32
32
  export var IconButton = React.forwardRef(function (_a, ref) {
33
- var icon = _a.icon, size = _a.size, iconProps = _a.iconProps, _b = _a.variant, variant = _b === void 0 ? "dim" : _b, className = _a.className, rest = __rest(_a, ["icon", "size", "iconProps", "variant", "className"]);
34
- return (_jsx(UnstyledButton, __assign({}, rest, { layout: { axis: "x", align: "center", justify: "center" }, className: classNames("aui-".concat(variant), className), ref: ref, children: _jsx(Icon, __assign({ icon: icon, size: size }, iconProps)) })));
33
+ var icon = _a.icon, size = _a.size, vfx = _a.vfx, iconProps = _a.iconProps, _b = _a.variant, variant = _b === void 0 ? "dim" : _b, className = _a.className, rest = __rest(_a, ["icon", "size", "vfx", "iconProps", "variant", "className"]);
34
+ return (_jsx(UnstyledButton, __assign({}, rest, { vfx: __assign({ axis: "x", align: "center", justify: "center" }, vfx), className: classNames("aui-".concat(variant), className), ref: ref, children: _jsx(Icon, __assign({ icon: icon, size: size }, iconProps)) })));
35
35
  });
36
+ var vfxBySize = {
37
+ small: { fontSize: "xs", padding: "xs" },
38
+ regular: { padding: "s" },
39
+ };
36
40
  var Button = React.forwardRef(function (_a, ref) {
37
- var variant = _a.variant, layout = _a.layout, corners = _a.corners, className = _a.className, size = _a.size, rest = __rest(_a, ["variant", "layout", "corners", "className", "size"]);
38
- return (_jsx(UnstyledButton, __assign({}, rest, { className: classNames(getButtonClassName({ variant: variant, corners: corners, size: size }), transformLayout(layout), className), ref: ref })));
41
+ var variant = _a.variant, className = _a.className, vfx = _a.vfx, size = _a.size, rest = __rest(_a, ["variant", "className", "vfx", "size"]);
42
+ var _b = getButtonProps({ variant: variant, size: size }), additionalVfx = _b.vfx, additionalClassName = _b.className;
43
+ return (_jsx(UnstyledButton, __assign({}, rest, { vfx: __assign(__assign({}, additionalVfx), vfx), className: classNames(additionalClassName, className), ref: ref })));
39
44
  });
40
- export var getButtonClassName = function (_a) {
41
- var _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.corners, corners = _c === void 0 ? "rounded" : _c, _d = _a.size, size = _d === void 0 ? "regular" : _d;
42
- return "aui-button--".concat(variant, " aui-button-size--").concat(size, " aui-corners--").concat(corners);
45
+ export var getButtonProps = function (_a) {
46
+ var _b = _a.variant, variant = _b === void 0 ? "primary" : _b, _c = _a.size, size = _c === void 0 ? "regular" : _c;
47
+ return ({
48
+ className: "aui-button-".concat(variant),
49
+ vfx: __assign(__assign({}, vfxBySize[size]), { radius: "rounded", fontWeight: 6 }),
50
+ });
43
51
  };
44
52
  export default Button;
@@ -27,9 +27,10 @@ import Button from "../Button";
27
27
  import Box from "../Box/Box";
28
28
  import Icon from "../Icon";
29
29
  var DEFAULT_DURATION_S = 1;
30
+ var itemVfx = { width: "full", height: "full" };
30
31
  var Carousel = React.forwardRef(function (_a, ref) {
31
32
  var _b, _c;
32
- 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"]);
33
+ var children = _a.children, hideArrows = _a.hideArrows, vfx = _a.vfx, hideDots = _a.hideDots, dotProps = _a.dotProps, leftArrowProps = _a.leftArrowProps, rightArrowProps = _a.rightArrowProps, autoplayInterval = _a.autoplayInterval, duration = _a.duration, rest = __rest(_a, ["children", "hideArrows", "vfx", "hideDots", "dotProps", "leftArrowProps", "rightArrowProps", "autoplayInterval", "duration"]);
33
34
  // min duration
34
35
  duration = Math.max(duration !== null && duration !== void 0 ? duration : DEFAULT_DURATION_S, 0.1);
35
36
  autoplayInterval = autoplayInterval
@@ -81,11 +82,23 @@ var Carousel = React.forwardRef(function (_a, ref) {
81
82
  transition: "transform ".concat(duration, "s ease-in-out"),
82
83
  }
83
84
  : undefined;
84
- return (_jsxs(Box, __assign({}, rest, { className: classNames("aui-carousel", className), ref: ref, children: [_jsxs(Box, { layout: {
85
+ return (_jsxs(Box, __assign({}, rest, { vfx: __assign({ maxWidth: "full", width: "fit", pos: "relative", overflow: "hidden" }, vfx), ref: ref, children: [_jsxs(Box, { vfx: {
85
86
  axis: delta >= 0 ? "x" : "-x",
86
87
  width: "full",
87
88
  height: "full",
88
- }, style: animatingStyles, 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, { layout: { axis: "x", align: "center", justify: "center" }, className: classNames("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(Icon, { icon: "chevron-left", size: "xs", style: { marginRight: 2 } })) }), _jsx(Button, { layout: { axis: "x", align: "center", justify: "center" }, className: classNames("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 : (_jsx(Icon, { icon: "chevron-right", size: "xs", style: { marginLeft: 2 } })) })] })), !hideDots && (_jsx(Box, { layout: { axis: "x", align: "center", gap: "xxs" }, 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)); }) }))] }))] })));
89
+ }, style: animatingStyles, onTransitionEnd: onTransitionEnd, children: [_jsx(Box, { vfx: itemVfx, className: "aui-carousel-item", children: children[cur] }), _jsx(Box, { vfx: itemVfx, className: "aui-carousel-item", "aria-hidden": true, children: children[next] })] }), length > 1 && (_jsxs(_Fragment, { children: [!hideArrows && (_jsxs(_Fragment, { children: [_jsx(Button, { vfx: {
90
+ axis: "x",
91
+ align: "center",
92
+ justify: "center",
93
+ radius: "max",
94
+ padding: "none",
95
+ }, className: classNames("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), "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(Icon, { icon: "chevron-left", size: "xs", style: { marginRight: 2 } })) }), _jsx(Button, { vfx: {
96
+ axis: "x",
97
+ align: "center",
98
+ justify: "center",
99
+ radius: "max",
100
+ padding: "none",
101
+ }, className: classNames("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), "aria-label": "next", onClick: function () { return startTransition(1); }, children: (_c = rightArrowProps === null || rightArrowProps === void 0 ? void 0 : rightArrowProps.children) !== null && _c !== void 0 ? _c : (_jsx(Icon, { icon: "chevron-right", size: "xs", style: { marginLeft: 2 } })) })] })), !hideDots && (_jsx(Box, { vfx: { axis: "x", align: "center", gap: "xxs" }, 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), vfx: { radius: "max", padding: "none" }, disabled: cur === i || animating, onClick: function () { return startTransition(i - cur); }, style: dotProps === null || dotProps === void 0 ? void 0 : dotProps.style }, i)); }) }))] }))] })));
89
102
  });
90
103
  function safeMod(n, m) {
91
104
  return ((n % m) + m) % m;
@@ -42,7 +42,7 @@ export type Props = {
42
42
  */
43
43
  style?: Style;
44
44
  /**
45
- * [Optional] round corners of the bars
45
+ * [Optional] round borders of the bars
46
46
  */
47
47
  rounded?: boolean;
48
48
  };
@@ -1,7 +1,8 @@
1
1
  import React from "react";
2
2
  import { type IconType } from "./icons";
3
3
  import type { SizeToken } from "../../utils/types";
4
- export type Props = Omit<React.DetailedHTMLProps<React.SVGAttributes<SVGSVGElement>, SVGSVGElement>, "children" | "viewBox"> & {
4
+ import ui from "../ui";
5
+ export type Props = Omit<React.ComponentProps<typeof ui.svg>, "children" | "viewBox"> & {
5
6
  /**
6
7
  * The version of icon to render
7
8
  */
@@ -24,8 +24,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
24
24
  import React from "react";
25
25
  import icons from "./icons";
26
26
  import { classNames } from "../../functions";
27
+ import ui from "../ui";
27
28
  var Icon = React.forwardRef(function (_a, ref) {
28
29
  var icon = _a.icon, className = _a.className, _b = _a.size, size = _b === void 0 ? "s" : _b, rest = __rest(_a, ["icon", "className", "size"]);
29
- return (_jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", className: classNames("aui-icon", "aui-icon-".concat(size), className) }, rest, { ref: ref, children: _jsx("path", { d: icons[icon] }) })));
30
+ return (_jsx(ui.svg, __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", className: classNames("aui-icon", "aui-icon-".concat(size), className) }, rest, { ref: ref, children: _jsx("path", { d: icons[icon] }) })));
30
31
  });
31
32
  export default Icon;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
- import { InputProps } from "./Input";
3
- import type { CornerType, Style } from "../../utils/types";
4
- type IconInputProps = {
2
+ import { Props as InputProps } from "./Input";
3
+ import { type BoxProps } from "../Box/Box";
4
+ type IconInputProps = Omit<BoxProps, "children"> & {
5
5
  /**
6
6
  * [Optional] Icon to display at the start of the input
7
7
  */
@@ -10,22 +10,10 @@ type IconInputProps = {
10
10
  * [Optional] Icon to display at the end of the input
11
11
  */
12
12
  endIcon?: React.ReactNode;
13
- /**
14
- * [Optional] Class name to add to the container
15
- */
16
- className?: string;
17
- /**
18
- * [Optional] Inline styles to add to the container
19
- */
20
- style?: Style;
21
- /**
22
- * [Optional] Corner style for the input
23
- */
24
- corners?: CornerType;
25
13
  /**
26
14
  * [Optional] Props to pass directly to the input element
27
15
  */
28
- inputProps?: Omit<InputProps, "corners">;
16
+ inputProps?: InputProps;
29
17
  };
30
- declare const IconInput: React.ForwardRefExoticComponent<IconInputProps & React.RefAttributes<HTMLDivElement>>;
18
+ declare const IconInput: React.ForwardRefExoticComponent<Omit<IconInputProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
31
19
  export default IconInput;
@@ -9,12 +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, jsxs as _jsxs } from "react/jsx-runtime";
13
24
  import { forwardRef } from "react";
14
25
  import classNames from "../../functions/classNames";
15
- import Box from "../Box";
26
+ import Box from "../Box/Box";
27
+ import ui from "../ui";
16
28
  var IconInput = forwardRef(function (_a, ref) {
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;
18
- return (_jsxs(Box, { layout: { axis: "x", align: "center" }, className: classNames("aui-input 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] }));
29
+ var startIcon = _a.startIcon, endIcon = _a.endIcon, className = _a.className, vfx = _a.vfx, inputProps = _a.inputProps, rest = __rest(_a, ["startIcon", "endIcon", "className", "vfx", "inputProps"]);
30
+ var _b = inputProps || {}, inputClassName = _b.className, inputVfx = _b.vfx, restInputProps = __rest(_b, ["className", "vfx"]);
31
+ return (_jsxs(Box, __assign({ vfx: __assign({ axis: "x", align: "center", radius: "rounded", overflow: "scroll" }, vfx), className: classNames("aui-input", className) }, rest, { ref: ref, children: [startIcon, _jsx(ui.input, __assign({}, restInputProps, { vfx: __assign({ radius: "rounded", backgroundColor: "transparent", width: "full" }, inputVfx), className: classNames("aui-input-base", inputClassName) })), endIcon] })));
19
32
  });
20
33
  export default IconInput;
@@ -1,12 +1,7 @@
1
1
  import React from "react";
2
- import type { CornerType } from "../../utils/types";
3
- type Props = React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> & {
4
- /**
5
- * Type of corners on the input
6
- * @default "rounded"
7
- */
8
- corners?: CornerType;
9
- };
10
- declare const Input: React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<HTMLInputElement>>;
11
- export type InputProps = React.ComponentProps<typeof Input>;
2
+ import ui from "../ui";
3
+ export type Props = React.ComponentProps<typeof ui.input>;
4
+ declare const Input: React.ForwardRefExoticComponent<Omit<Omit<React.ClassAttributes<HTMLInputElement> & React.InputHTMLAttributes<HTMLInputElement> & {
5
+ vfx?: import("../../utils/types").Vfx;
6
+ }, "ref"> & React.RefAttributes<HTMLInputElement>, "ref"> & React.RefAttributes<HTMLInputElement>>;
12
7
  export default Input;
@@ -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 { forwardRef } from "react";
25
25
  import classNames from "../../functions/classNames";
26
+ import ui from "../ui";
26
27
  var Input = forwardRef(function (_a, ref) {
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("aui-input-base aui-input aui-corners--".concat(corners), className) })));
28
+ var className = _a.className, vfx = _a.vfx, props = __rest(_a, ["className", "vfx"]);
29
+ return (_jsx(ui.input, __assign({}, props, { ref: ref, vfx: __assign({ radius: "rounded" }, vfx), className: classNames("aui-input-base aui-input", className) })));
29
30
  });
30
31
  export default Input;
@@ -1,11 +1,5 @@
1
1
  import React from "react";
2
- import type { CornerType } from "../../utils/types";
3
- type TextAreaProps = React.DetailedHTMLProps<React.TextareaHTMLAttributes<HTMLTextAreaElement>, HTMLTextAreaElement> & {
4
- /**
5
- * Type of corners on the text area
6
- * @default "rounded"
7
- */
8
- corners?: CornerType;
9
- };
10
- declare const TextArea: React.ForwardRefExoticComponent<Omit<TextAreaProps, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
2
+ declare const TextArea: React.ForwardRefExoticComponent<Omit<Omit<React.ClassAttributes<HTMLTextAreaElement> & React.TextareaHTMLAttributes<HTMLTextAreaElement> & {
3
+ vfx?: import("../../utils/types").Vfx;
4
+ }, "ref"> & React.RefAttributes<HTMLTextAreaElement>, "ref"> & React.RefAttributes<HTMLTextAreaElement>>;
11
5
  export default TextArea;
@@ -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 { forwardRef } from "react";
25
25
  import classNames from "../../functions/classNames";
26
+ import ui from "../ui";
26
27
  var TextArea = forwardRef(function (_a, ref) {
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("aui-input-base aui-input aui-corners--".concat(corners), className), rows: rows })));
28
+ var className = _a.className, _b = _a.rows, rows = _b === void 0 ? 3 : _b, vfx = _a.vfx, props = __rest(_a, ["className", "rows", "vfx"]);
29
+ return (_jsx(ui.textarea, __assign({}, props, { ref: ref, className: classNames("aui-input-base aui-input", className), vfx: __assign({ radius: "rounded" }, vfx), rows: rows })));
29
30
  });
30
31
  export default TextArea;
@@ -27,7 +27,7 @@ import classNames from "../../functions/classNames";
27
27
  import Box from "../Box/Box";
28
28
  import useMergeRefs from "../../hooks/useMergeRefs";
29
29
  var Layer = React.forwardRef(function (_a, ref) {
30
- var returnFocusOnEscape = _a.returnFocusOnEscape, disableScrollLock = _a.disableScrollLock, onClose = _a.onClose, children = _a.children, className = _a.className, onMouseDown = _a.onMouseDown, layout = _a.layout, rest = __rest(_a, ["returnFocusOnEscape", "disableScrollLock", "onClose", "children", "className", "onMouseDown", "layout"]);
30
+ var returnFocusOnEscape = _a.returnFocusOnEscape, disableScrollLock = _a.disableScrollLock, onClose = _a.onClose, children = _a.children, className = _a.className, onMouseDown = _a.onMouseDown, vfx = _a.vfx, rest = __rest(_a, ["returnFocusOnEscape", "disableScrollLock", "onClose", "children", "className", "onMouseDown", "vfx"]);
31
31
  var focusRef = useFocusTrap(true);
32
32
  // Lock and unlock on mount and unmount
33
33
  useScrollLock(!disableScrollLock);
@@ -48,7 +48,7 @@ var Layer = React.forwardRef(function (_a, ref) {
48
48
  };
49
49
  }, [onClose, returnFocusOnEscape]);
50
50
  var mergedRef = useMergeRefs(focusRef, children.props.ref);
51
- return (_jsx(Box, __assign({ layout: __assign({ axis: "y", align: "center", justify: "center" }, layout) }, rest, { className: classNames("aui-layer-backdrop", className), onMouseDown: function (e) {
51
+ return (_jsx(Box, __assign({ vfx: __assign({ pos: "fixed", axis: "y", align: "center", justify: "center", z: "max" }, vfx) }, rest, { className: classNames("aui-layer-backdrop", className), onMouseDown: function (e) {
52
52
  onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(e);
53
53
  onClose === null || onClose === void 0 ? void 0 : onClose();
54
54
  }, ref: ref, children: React.cloneElement(children, {
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { type VisualButtonProps } from "../Button/Button";
3
- import { Layout } from "../../utils/types";
3
+ import { Vfx } from "../../utils/types";
4
4
  export type BaseLinkProps = Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "href"> & {
5
5
  /**
6
6
  * URL to navigate to
@@ -20,9 +20,10 @@ type LinkProps = BaseLinkProps & {
20
20
  */
21
21
  LinkElement?: CustomLinkElement;
22
22
  /**
23
- * Additional styles to apply to the layout that are transformed to classNames to be easier to override if needed
23
+ * The VFX or other organizational css to apply to this element.
24
+ * Properties are translated to class names before being applied.
24
25
  */
25
- layout?: Layout;
26
+ vfx?: Vfx;
26
27
  };
27
28
  export declare const UnstyledLink: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
28
29
  export declare const ButtonLink: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "href"> & {
@@ -42,9 +43,10 @@ export declare const ButtonLink: React.ForwardRefExoticComponent<Omit<Omit<React
42
43
  */
43
44
  LinkElement?: CustomLinkElement;
44
45
  /**
45
- * Additional styles to apply to the layout that are transformed to classNames to be easier to override if needed
46
+ * The VFX or other organizational css to apply to this element.
47
+ * Properties are translated to class names before being applied.
46
48
  */
47
- layout?: Layout;
49
+ vfx?: Vfx;
48
50
  } & VisualButtonProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
49
51
  declare const Link: React.ForwardRefExoticComponent<Omit<LinkProps, "ref"> & React.RefAttributes<HTMLAnchorElement>>;
50
52
  export default Link;