@adamjanicki/ui 1.2.3 → 1.2.5

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.
@@ -28,7 +28,7 @@ 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
29
  className = classNames("ajui-button-base", className);
30
30
  if (to) {
31
- return (_jsx(UnstyledLink, { to: to, className: className, style: props.style, role: "button", children: props.children, LinkElement: LinkElement, "aria-label": props["aria-label"] }));
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
33
  return _jsx("button", __assign({}, props, { className: className, ref: ref }));
34
34
  });
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- type Props = {
2
+ type LayerProps = {
3
3
  /**
4
4
  * Callback that fires when the user clicks outside the layer
5
5
  */
@@ -23,5 +23,19 @@ type Props = {
23
23
  */
24
24
  disableEscape?: boolean;
25
25
  };
26
- declare const Layer: ({ onClose, children, style, className, disableEscape, }: Props) => JSX.Element | null;
26
+ type AnimatedLayerProps = LayerProps & {
27
+ /**
28
+ * [Optional] Config for visibility, including styles and class names
29
+ * Set the `transition` property on the `style` prop to animate the layer
30
+ */
31
+ visibility: {
32
+ visible: boolean;
33
+ invisibleStyle?: React.CSSProperties;
34
+ visibleStyle?: React.CSSProperties;
35
+ invisibleClassName?: string;
36
+ visibleClassName?: string;
37
+ };
38
+ };
39
+ declare const Layer: ({ onClose, children, style, className, disableEscape, }: LayerProps) => JSX.Element;
40
+ export declare const AnimatedLayer: ({ visibility, className, style, ...props }: AnimatedLayerProps) => JSX.Element;
27
41
  export default Layer;
@@ -1,3 +1,25 @@
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
+ };
1
23
  import { jsx as _jsx } from "react/jsx-runtime";
2
24
  import React, { useEffect } from "react";
3
25
  import { useFocusTrap, useScrollLock } from "../../hooks";
@@ -32,4 +54,18 @@ var Layer = function (_a) {
32
54
  },
33
55
  }) }));
34
56
  };
57
+ var defaultInvisibleStyle = {
58
+ zIndex: -1,
59
+ opacity: 0,
60
+ pointerEvents: "none",
61
+ userSelect: "none",
62
+ };
63
+ var defaultVisibleStyle = { opacity: 1 };
64
+ export var AnimatedLayer = function (_a) {
65
+ var visibility = _a.visibility, className = _a.className, _b = _a.style, style = _b === void 0 ? {} : _b, props = __rest(_a, ["visibility", "className", "style"]);
66
+ var visible = visibility.visible, _c = visibility.invisibleStyle, invisibleStyle = _c === void 0 ? defaultInvisibleStyle : _c, _d = visibility.visibleStyle, visibleStyle = _d === void 0 ? defaultVisibleStyle : _d, invisibleClassName = visibility.invisibleClassName, visibleClassName = visibility.visibleClassName;
67
+ var mergedStyle = __assign(__assign({}, style), (visible ? visibleStyle : invisibleStyle));
68
+ var mergedClassName = classNames(className, visible ? visibleClassName : invisibleClassName);
69
+ return _jsx(Layer, __assign({}, props, { style: mergedStyle, className: mergedClassName }));
70
+ };
35
71
  export default Layer;
@@ -1,2 +1,3 @@
1
- import Layer from "./Layer";
1
+ import Layer, { AnimatedLayer } from "./Layer";
2
+ export { AnimatedLayer };
2
3
  export default Layer;
@@ -1,2 +1,3 @@
1
- import Layer from "./Layer";
1
+ import Layer, { AnimatedLayer } from "./Layer";
2
+ export { AnimatedLayer };
2
3
  export default Layer;
@@ -25,7 +25,7 @@ import { forwardRef } from "react";
25
25
  import { classNames } from "../../utils/util";
26
26
  var identity = function (x) { return x; };
27
27
  var Select = function (_a, ref) {
28
- var className = _a.className, options = _a.options, _b = _a.getOptionValue, getOptionValue = _b === void 0 ? identity : _b, _c = _a.getOptionLabel, getOptionLabel = _c === void 0 ? identity : _c, _d = _a.corners, corners = _d === void 0 ? "rounded" : _d, _e = _a.style, style = _e === void 0 ? {} : _e, innerStyle = _a.innerStyle, innerClassName = _a.innerClassName, disabled = _a.disabled, props = __rest(_a, ["className", "options", "getOptionValue", "getOptionLabel", "corners", "style", "innerStyle", "innerClassName", "disabled"]);
29
- return (_jsxs("div", { className: classNames("ajui-select-container", disabled ? "ajui-select-disabled" : undefined, className) || undefined, children: [_jsx("select", __assign({}, props, { ref: ref, className: classNames("ajui-select-base corners--".concat(corners), innerClassName), style: innerStyle, disabled: disabled, children: options.map(function (option, index) { return (_jsx("option", { value: getOptionValue(option), children: getOptionLabel(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" }) })] }));
28
+ var className = _a.className, options = _a.options, _b = _a.getOptionValue, getOptionValue = _b === void 0 ? identity : _b, _c = _a.getOptionLabel, getOptionLabel = _c === void 0 ? identity : _c, _d = _a.corners, corners = _d === void 0 ? "rounded" : _d, style = _a.style, innerStyle = _a.innerStyle, innerClassName = _a.innerClassName, disabled = _a.disabled, props = __rest(_a, ["className", "options", "getOptionValue", "getOptionLabel", "corners", "style", "innerStyle", "innerClassName", "disabled"]);
29
+ return (_jsxs("div", { className: classNames("ajui-select-container", disabled ? "ajui-select-disabled" : undefined, className) || undefined, style: style, children: [_jsx("select", __assign({}, props, { ref: ref, className: classNames("ajui-select-base corners--".concat(corners), innerClassName), style: innerStyle, disabled: disabled, children: options.map(function (option, index) { return (_jsx("option", { value: getOptionValue(option), children: getOptionLabel(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" }) })] }));
30
30
  };
31
31
  export default forwardRef(Select);
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  type Props = {
2
3
  /**
3
4
  * [Optional] Additional class names to apply to the spinner.
package/index.d.ts CHANGED
@@ -9,6 +9,7 @@ export { default as Badge } from "./components/Badge";
9
9
  export { default as Banner } from "./components/Banner";
10
10
  export { default as Select } from "./components/Select";
11
11
  export { default as ClickOutside } from "./components/ClickOutside";
12
+ export * from "./components/Layer";
12
13
  export { default as Layer } from "./components/Layer";
13
14
  export { default as Spinner } from "./components/Spinner";
14
15
  export * from "./hooks";
package/index.js CHANGED
@@ -10,6 +10,7 @@ export { default as Badge } from "./components/Badge";
10
10
  export { default as Banner } from "./components/Banner";
11
11
  export { default as Select } from "./components/Select";
12
12
  export { default as ClickOutside } from "./components/ClickOutside";
13
+ export * from "./components/Layer";
13
14
  export { default as Layer } from "./components/Layer";
14
15
  export { default as Spinner } from "./components/Spinner";
15
16
  // Hooks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamjanicki/ui",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "description": "Basic UI components and hooks for React in TypeScript",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
package/style.css CHANGED
@@ -53,7 +53,7 @@
53
53
  --ajui-static-color: var(--ajui-default-color);
54
54
  --ajui-static-border: var(--ajui-default-border);
55
55
  /* Layer */
56
- --ajui-layer-backdrop-background: rgba(200, 200, 200, 0.6);
56
+ --ajui-layer-backdrop-background: rgba(200, 200, 200, 0.7);
57
57
  /* Link */
58
58
  --ajui-link-color: #0070ff;
59
59
  }
@@ -98,7 +98,7 @@
98
98
  --ajui-static-color: var(--ajui-default-color);
99
99
  --ajui-static-border: var(--ajui-default-border);
100
100
  /* Layer */
101
- --ajui-layer-backdrop-background: rgba(40, 40, 40, 0.6);
101
+ --ajui-layer-backdrop-background: rgba(55, 55, 55, 0.7);
102
102
  /* Link */
103
103
  --ajui-link-color: #009ef3;
104
104
  }