@adamjanicki/ui 1.5.6 → 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.
Files changed (41) hide show
  1. package/components/Alert/Alert.d.ts +3 -2
  2. package/components/Alert/Alert.js +3 -2
  3. package/components/Animated/Animated.d.ts +3 -2
  4. package/components/Animated/Animated.js +3 -2
  5. package/components/Badge/Badge.d.ts +3 -2
  6. package/components/Badge/Badge.js +2 -1
  7. package/components/Banner/Banner.d.ts +3 -2
  8. package/components/Banner/Banner.js +2 -1
  9. package/components/Box/Box.d.ts +11 -0
  10. package/components/Box/Box.js +66 -0
  11. package/components/Box/index.d.ts +2 -0
  12. package/components/Box/index.js +2 -0
  13. package/components/Button/Button.d.ts +1 -1
  14. package/components/Button/Button.js +4 -4
  15. package/components/Carousel/Carousel.d.ts +3 -2
  16. package/components/Carousel/Carousel.js +8 -7
  17. package/components/Hamburger/Hamburger.d.ts +1 -1
  18. package/components/Input/IconInput.d.ts +1 -1
  19. package/components/Input/IconInput.js +2 -1
  20. package/components/Input/Input.d.ts +1 -1
  21. package/components/Input/Input.js +1 -1
  22. package/components/Input/TextArea.d.ts +1 -1
  23. package/components/Input/TextArea.js +1 -1
  24. package/components/Layer/Layer.d.ts +2 -2
  25. package/components/Layer/Layer.js +2 -1
  26. package/components/Link/Link.js +2 -2
  27. package/components/Select/Select.d.ts +1 -1
  28. package/components/Select/Select.js +2 -1
  29. package/components/Spinner/Spinner.d.ts +1 -1
  30. package/components/Spinner/Spinner.js +1 -1
  31. package/index.d.ts +1 -2
  32. package/index.js +1 -3
  33. package/package.json +3 -2
  34. package/style.css +323 -204
  35. package/utils/types.d.ts +58 -0
  36. package/components/InlineCode/InlineCode.d.ts +0 -13
  37. package/components/InlineCode/InlineCode.js +0 -50
  38. package/components/InlineCode/index.d.ts +0 -2
  39. package/components/InlineCode/index.js +0 -2
  40. package/types/index.d.ts +0 -17
  41. /package/{types/index.js → utils/types.js} +0 -0
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
- import type { ContentType, CornerType, DivProps } from "../../types";
3
- type Props = DivProps & {
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
  */
@@ -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, className = _a.className, _b = _a.corners, corners = _b === void 0 ? "rounded" : _b, rest = __rest(_a, ["type", "className", "corners"]);
28
- return (_jsx("div", __assign({}, rest, { className: classNames("ajui-alert ajui-content--".concat(type, " ajui-corners--").concat(corners), className), ref: 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 })));
29
30
  });
30
31
  export default Alert;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
- import type { DivProps, Style } from "../../types";
3
- type Props = DivProps & {
2
+ import type { Style } from "../../utils/types";
3
+ import { type BoxProps } from "../Box/Box";
4
+ type Props = BoxProps & {
4
5
  /**
5
6
  * Whether to begin the animation.
6
7
  * Set to true to start animation, false to start the exit animation.
@@ -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, { useState, useEffect, useRef } from "react";
25
25
  import classNames from "../../functions/classNames";
26
+ import Box from "../Box/Box";
26
27
  var Animated = React.forwardRef(function (props, ref) {
27
- 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, children = props.children, className = props.className, style = props.style, rest = __rest(props, ["animated", "duration", "keepMounted", "animateTo", "animateFrom", "children", "className", "style"]);
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"]);
28
29
  var _c = useState(animated || keepMounted), shouldRender = _c[0], setShouldRender = _c[1];
29
30
  var _d = useState(false), isAnimatingForward = _d[0], setIsAnimatingForward = _d[1];
30
31
  var timeoutRef = useRef(null);
@@ -69,6 +70,6 @@ var Animated = React.forwardRef(function (props, ref) {
69
70
  if (!shouldRender)
70
71
  return null;
71
72
  var currentAnimation = isAnimatingForward ? animateTo : animateFrom;
72
- return (_jsx("div", __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, children: children })));
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 })));
73
74
  });
74
75
  export default Animated;
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
- import type { ContentType, CornerType, DivProps } from "../../types";
3
- type Props = DivProps & {
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
  */
@@ -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("div", __assign({}, rest, { className: classNames("ajui-badge ajui-content--".concat(type, " ajui-corners--").concat(corners), className), ref: ref })));
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,6 +1,7 @@
1
1
  import React from "react";
2
- import type { ContentType, DivProps } from "../../types";
3
- type Props = DivProps & {
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
  */
@@ -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("div", __assign({}, rest, { className: classNames("ajui-content--".concat(type, " ajui-banner"), className), ref: ref })));
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;
@@ -0,0 +1,2 @@
1
+ import Box from "./Box";
2
+ export default Box;
@@ -0,0 +1,2 @@
1
+ import Box from "./Box";
2
+ export default Box;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { type CustomLinkElement } from "../Link/Link";
3
- import type { CornerType } from "../../types";
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,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("ajui-button-base", className);
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: classNames("ajui-action", 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("ajui-icon-button", className), ref: ref, children: icon })));
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("ajui-button--".concat(variant, " ajui-button-size--").concat(size, " ajui-corners--").concat(corners), className), ref: ref })));
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,5 +1,6 @@
1
1
  import React from "react";
2
- import type { DivProps, Style } from "../../types";
2
+ import type { Style } from "../../utils/types";
3
+ import { type BoxProps } from "../Box/Box";
3
4
  type ButtonProps = {
4
5
  /**
5
6
  * Children to render inside the button
@@ -14,7 +15,7 @@ type ButtonProps = {
14
15
  */
15
16
  style?: Style;
16
17
  };
17
- type Props = DivProps & {
18
+ type Props = BoxProps & {
18
19
  /**
19
20
  * The child elements/slides of the carousel
20
21
  */
@@ -24,14 +24,15 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
24
24
  import React, { useState, useEffect, useRef, useCallback } from "react";
25
25
  import { classNames } from "../../functions";
26
26
  import Button from "../Button";
27
+ import Box from "../Box/Box";
27
28
  var DEFAULT_DURATION_S = 1;
28
- var Carousel = React.forwardRef(function (props, ref) {
29
- var _a, _b, _c;
30
- var children = props.children, className = props.className, hideArrows = props.hideArrows, hideDots = props.hideDots, dotProps = props.dotProps, leftArrowProps = props.leftArrowProps, rightArrowProps = props.rightArrowProps, rest = __rest(props, ["children", "className", "hideArrows", "hideDots", "dotProps", "leftArrowProps", "rightArrowProps"]);
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"]);
31
32
  // min duration
32
- var duration = Math.max((_a = props.duration) !== null && _a !== void 0 ? _a : DEFAULT_DURATION_S, 0.1);
33
- var autoplayInterval = props.autoplayInterval
34
- ? Math.max(duration, props.autoplayInterval)
33
+ duration = Math.max(duration !== null && duration !== void 0 ? duration : DEFAULT_DURATION_S, 0.1);
34
+ autoplayInterval = autoplayInterval
35
+ ? Math.max(duration, autoplayInterval)
35
36
  : undefined;
36
37
  var length = children.length;
37
38
  var _d = useState({
@@ -79,7 +80,7 @@ var Carousel = React.forwardRef(function (props, ref) {
79
80
  transition: "transform ".concat(duration, "s ease-in-out"),
80
81
  }
81
82
  : undefined;
82
- return (_jsxs("div", __assign({}, rest, { className: classNames("ajui-carousel", className), ref: ref, children: [_jsxs("div", { className: "ajui-carousel-slider", style: __assign(__assign({}, animatingStyles), { flexDirection: delta >= 0 ? "row" : "row-reverse" }), onTransitionEnd: onTransitionEnd, children: [_jsx("div", { className: "ajui-carousel-item", children: children[cur] }), _jsx("div", { className: "ajui-carousel-item", "aria-hidden": true, children: children[next] })] }), length > 1 && (_jsxs(_Fragment, { children: [!hideArrows && (_jsxs(_Fragment, { children: [_jsx(Button, { className: classNames("ajui-carousel-arrow-prev", leftArrowProps === null || leftArrowProps === void 0 ? void 0 : leftArrowProps.className), style: 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("ajui-carousel-arrow-next", rightArrowProps === null || rightArrowProps === void 0 ? void 0 : rightArrowProps.className), style: 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("div", { className: "ajui-carousel-dots", children: children.map(function (_, i) { return (_jsx(Button, { className: classNames("ajui-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)); }) }))] }))] })));
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)); }) }))] }))] })));
83
84
  });
84
85
  function safeMod(n, m) {
85
86
  return ((n % m) + m) % m;
@@ -1,4 +1,4 @@
1
- import type { Style } from "../../types";
1
+ import type { Style } from "../../utils/types";
2
2
  export type Props = {
3
3
  /**
4
4
  * Size of the button in pixels
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { InputProps } from "./Input";
3
- import type { CornerType, Style } 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
@@ -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("div", { className: classNames("ajui-input-default ajui-icon-input ajui-corners--".concat(corners), className), style: style, ref: ref, children: [startIcon || null, _jsx("input", __assign({}, inputProps, { className: classNames("ajui-input-base ajui-corners--".concat(corners), inputProps === null || inputProps === void 0 ? void 0 : inputProps.className) })), endIcon || null] }));
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 type { 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("ajui-input-base ajui-input-default ajui-corners--".concat(corners), className) })));
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 type { 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("ajui-input-base ajui-input-default ajui-corners--".concat(corners), className), rows: rows })));
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,6 +1,6 @@
1
1
  import React from "react";
2
- import type { DivProps } from "../../types";
3
- type Props<T extends React.ElementType> = Omit<DivProps, "children"> & {
2
+ import { type BoxProps } from "../Box/Box";
3
+ type Props<T extends React.ElementType> = Omit<BoxProps, "children"> & {
4
4
  /**
5
5
  * Callback that fires when the user clicks outside the layer
6
6
  */
@@ -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("div", { className: classNames("ajui-layer-backdrop", className), style: style, onMouseDown: onClose, children: React.cloneElement(children, {
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;
@@ -29,10 +29,10 @@ var DefaultLinkElement = forwardRef(function (_a, ref) {
29
29
  });
30
30
  export var UnstyledLink = forwardRef(function (_a, ref) {
31
31
  var _b = _a.LinkElement, LinkElement = _b === void 0 ? DefaultLinkElement : _b, className = _a.className, props = __rest(_a, ["LinkElement", "className"]);
32
- return (_jsx(LinkElement, __assign({}, props, { className: classNames("ajui-action", className), ref: ref })));
32
+ return (_jsx(LinkElement, __assign({}, props, { className: classNames("aui-action", className), ref: ref })));
33
33
  });
34
34
  var Link = forwardRef(function (_a, ref) {
35
35
  var className = _a.className, props = __rest(_a, ["className"]);
36
- return (_jsx(UnstyledLink, __assign({}, props, { className: classNames("ajui-link-default", className), ref: ref })));
36
+ return (_jsx(UnstyledLink, __assign({}, props, { className: classNames("aui-link-default", className), ref: ref })));
37
37
  });
38
38
  export default Link;
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import type { CornerType } from "../../types";
2
+ import type { CornerType } from "../../utils/types";
3
3
  type Props = React.DetailedHTMLProps<React.SelectHTMLAttributes<HTMLSelectElement>, HTMLSelectElement> & {
4
4
  /**
5
5
  * Array of options to display in the select
@@ -23,8 +23,9 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
24
24
  import { forwardRef } from "react";
25
25
  import classNames from "../../functions/classNames";
26
+ import Box from "../Box";
26
27
  var Select = function (_a, ref) {
27
28
  var className = _a.className, options = _a.options, getOptionLabel = _a.getOptionLabel, _b = _a.corners, corners = _b === void 0 ? "rounded" : _b, style = _a.style, disabled = _a.disabled, props = __rest(_a, ["className", "options", "getOptionLabel", "corners", "style", "disabled"]);
28
- return (_jsxs("div", { className: classNames("ajui-select-container", "ajui-corners--".concat(corners), disabled ? "ajui-select-disabled" : undefined, className), style: style, children: [_jsx("select", __assign({}, props, { ref: ref, className: "ajui-select-base ajui-corners--".concat(corners), disabled: disabled, children: options.map(function (option, index) { return (_jsx("option", { value: option, children: (getOptionLabel === null || getOptionLabel === void 0 ? void 0 : getOptionLabel(option)) || option }, index)); }) })), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64", className: "ajui-select-triangle", "aria-hidden": "true", children: _jsx("path", { fill: "currentColor", d: "M 29.175781 50.824219 C 30.738281 52.386719 33.273438 52.386719 34.835938 50.824219 L 58.835938 26.824219 C 60.398438 25.261719 60.398438 22.726562 58.835938 21.164062 C 57.273438 19.601562 54.738281 19.601562 53.175781 21.164062 L 32 42.335938 L 10.824219 21.175781 C 9.261719 19.613281 6.726562 19.613281 5.164062 21.175781 C 3.601562 22.738281 3.601562 25.273438 5.164062 26.835938 L 29.164062 50.835938 Z M 29.175781 50.824219" }) })] }));
29
+ return (_jsxs(Box, { className: classNames("aui-select-container", "aui-corners--".concat(corners), disabled ? "aui-select-disabled" : undefined, className), style: style, children: [_jsx("select", __assign({}, props, { ref: ref, className: "aui-select-base aui-corners--".concat(corners), disabled: disabled, children: options.map(function (option, index) { return (_jsx("option", { value: option, children: (getOptionLabel === null || getOptionLabel === void 0 ? void 0 : getOptionLabel(option)) || option }, index)); }) })), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 64 64", className: "aui-select-triangle", "aria-hidden": "true", children: _jsx("path", { fill: "currentColor", d: "M 29.175781 50.824219 C 30.738281 52.386719 33.273438 52.386719 34.835938 50.824219 L 58.835938 26.824219 C 60.398438 25.261719 60.398438 22.726562 58.835938 21.164062 C 57.273438 19.601562 54.738281 19.601562 53.175781 21.164062 L 32 42.335938 L 10.824219 21.175781 C 9.261719 19.613281 6.726562 19.613281 5.164062 21.175781 C 3.601562 22.738281 3.601562 25.273438 5.164062 26.835938 L 29.164062 50.835938 Z M 29.175781 50.824219" }) })] }));
29
30
  };
30
31
  export default forwardRef(Select);
@@ -1,4 +1,4 @@
1
- import type { Style } from "../../types";
1
+ import type { Style } from "../../utils/types";
2
2
  type Props = {
3
3
  /**
4
4
  * [Optional] Additional class names to apply to the spinner.
@@ -26,6 +26,6 @@ var Spinner = function (_a) {
26
26
  var className = _a.className, props = __rest(_a, ["className"]);
27
27
  return (
28
28
  // Designed on 2023-08-18
29
- _jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", className: classNames("ajui-spinner", className) }, props, { 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" }) })));
29
+ _jsx("svg", __assign({ xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", className: classNames("aui-spinner", className) }, props, { 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
30
  };
31
31
  export default Spinner;
package/index.d.ts CHANGED
@@ -2,13 +2,13 @@ export { default as Alert } from "./components/Alert";
2
2
  export { default as Animated } from "./components/Animated";
3
3
  export { default as Badge } from "./components/Badge";
4
4
  export { default as Banner } from "./components/Banner";
5
+ export { default as Box } from "./components/Box";
5
6
  export { default as Button } from "./components/Button";
6
7
  export * from "./components/Button";
7
8
  export { default as Carousel } from "./components/Carousel";
8
9
  export { default as ClickOutside } from "./components/ClickOutside";
9
10
  export { default as Hamburger } from "./components/Hamburger";
10
11
  export * from "./components/Hamburger";
11
- export { default as InlineCode } from "./components/InlineCode";
12
12
  export { default as Input } from "./components/Input";
13
13
  export * from "./components/Input";
14
14
  export { default as Layer } from "./components/Layer";
@@ -18,4 +18,3 @@ export { default as Select } from "./components/Select";
18
18
  export { default as Spinner } from "./components/Spinner";
19
19
  export * from "./hooks";
20
20
  export * from "./functions";
21
- export * from "./types";
package/index.js CHANGED
@@ -3,13 +3,13 @@ export { default as Alert } from "./components/Alert";
3
3
  export { default as Animated } from "./components/Animated";
4
4
  export { default as Badge } from "./components/Badge";
5
5
  export { default as Banner } from "./components/Banner";
6
+ export { default as Box } from "./components/Box";
6
7
  export { default as Button } from "./components/Button";
7
8
  export * from "./components/Button";
8
9
  export { default as Carousel } from "./components/Carousel";
9
10
  export { default as ClickOutside } from "./components/ClickOutside";
10
11
  export { default as Hamburger } from "./components/Hamburger";
11
12
  export * from "./components/Hamburger";
12
- export { default as InlineCode } from "./components/InlineCode";
13
13
  export { default as Input } from "./components/Input";
14
14
  export * from "./components/Input";
15
15
  export { default as Layer } from "./components/Layer";
@@ -21,5 +21,3 @@ export { default as Spinner } from "./components/Spinner";
21
21
  export * from "./hooks";
22
22
  // Functions
23
23
  export * from "./functions";
24
- // Types
25
- export * from "./types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamjanicki/ui",
3
- "version": "1.5.6",
3
+ "version": "1.5.7",
4
4
  "description": "Basic UI components and hooks for React in TypeScript",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -15,7 +15,8 @@
15
15
  "clean": "./clean.sh",
16
16
  "lint": "eslint src --max-warnings=0",
17
17
  "build": "npm run clean && npm run lint && tsc; cp src/style.css ./style.css",
18
- "prepare": "npm run build"
18
+ "prepare": "npm run build",
19
+ "dryrun": "npm publish --dry-run"
19
20
  },
20
21
  "peerDependencies": {
21
22
  "react": ">=18",