@adamjanicki/ui 1.3.0 → 1.3.1

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.
@@ -35,7 +35,18 @@ type Props = {
35
35
  */
36
36
  style?: React.CSSProperties;
37
37
  };
38
- children: React.ReactNode;
38
+ /**
39
+ * Children to render
40
+ */
41
+ children: React.ReactNode | React.ReactNode[];
42
+ /**
43
+ * [Optional] className to apply to the component always
44
+ */
45
+ className?: string;
46
+ /**
47
+ * [Optional] Inline styles to apply to the component always
48
+ */
49
+ style?: React.CSSProperties;
39
50
  };
40
- declare const Animated: ({ visible, duration, keepMountedOnExit, enter, exit, children, }: Props) => import("react/jsx-runtime").JSX.Element;
51
+ declare const Animated: ({ visible, duration, keepMountedOnExit, enter, exit, children, className, style, }: Props) => import("react/jsx-runtime").JSX.Element;
41
52
  export default Animated;
@@ -13,7 +13,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { useState, useEffect } from "react";
14
14
  import { classNames } from "../../utils/util";
15
15
  var Animated = function (_a) {
16
- var visible = _a.visible, _b = _a.duration, duration = _b === void 0 ? 250 : _b, _c = _a.keepMountedOnExit, keepMountedOnExit = _c === void 0 ? false : _c, enter = _a.enter, exit = _a.exit, children = _a.children;
16
+ var visible = _a.visible, _b = _a.duration, duration = _b === void 0 ? 250 : _b, _c = _a.keepMountedOnExit, keepMountedOnExit = _c === void 0 ? false : _c, enter = _a.enter, exit = _a.exit, children = _a.children, className = _a.className, style = _a.style;
17
17
  var _d = useState(visible), shouldRender = _d[0], setShouldRender = _d[1];
18
18
  var _e = useState(visible ? "entering" : "exiting"), animationState = _e[0], setAnimationState = _e[1];
19
19
  useEffect(function () {
@@ -34,6 +34,6 @@ var Animated = function (_a) {
34
34
  }
35
35
  return function () { return clearTimeout(timeoutId); };
36
36
  }, [visible, shouldRender, duration, keepMountedOnExit]);
37
- return (_jsx("div", { className: classNames(animationState === "entering" ? enter === null || enter === void 0 ? void 0 : enter.className : exit === null || exit === void 0 ? void 0 : exit.className), style: __assign(__assign({}, (animationState === "entering" ? enter === null || enter === void 0 ? void 0 : enter.style : exit === null || exit === void 0 ? void 0 : exit.style)), { transition: "all ".concat(duration, "ms ease-in-out") }), children: shouldRender && children }));
37
+ return (_jsx("div", { className: classNames(className, animationState === "entering" ? enter === null || enter === void 0 ? void 0 : enter.className : exit === null || exit === void 0 ? void 0 : exit.className), style: __assign(__assign(__assign({}, style), (animationState === "entering" ? enter === null || enter === void 0 ? void 0 : enter.style : exit === null || exit === void 0 ? void 0 : exit.style)), { transition: "all ".concat(duration, "ms ease-in-out") }), children: shouldRender && children }));
38
38
  };
39
39
  export default Animated;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamjanicki/ui",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Basic UI components and hooks for React in TypeScript",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",