@adamjanicki/ui 1.2.3 → 1.2.4

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
  });
@@ -22,6 +22,16 @@ type Props = {
22
22
  * @default false
23
23
  */
24
24
  disableEscape?: boolean;
25
+ /**
26
+ * [Optional] Config for visibility
27
+ */
28
+ visibility?: {
29
+ visible: boolean;
30
+ invisibleStyle?: React.CSSProperties;
31
+ visibleStyle?: React.CSSProperties;
32
+ invisibleClassName?: string;
33
+ visibleClassName?: string;
34
+ };
25
35
  };
26
- declare const Layer: ({ onClose, children, style, className, disableEscape, }: Props) => JSX.Element | null;
36
+ declare const Layer: ({ onClose, children, style, className, disableEscape, visibility, }: Props) => JSX.Element | null;
27
37
  export default Layer;
@@ -1,10 +1,27 @@
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
+ };
1
12
  import { jsx as _jsx } from "react/jsx-runtime";
2
13
  import React, { useEffect } from "react";
3
14
  import { useFocusTrap, useScrollLock } from "../../hooks";
4
15
  import { classNames } from "../../utils/util";
5
16
  var Layer = function (_a) {
6
- var onClose = _a.onClose, children = _a.children, style = _a.style, className = _a.className, _b = _a.disableEscape, disableEscape = _b === void 0 ? false : _b;
7
- var _c = useScrollLock(), lock = _c.lock, unlock = _c.unlock;
17
+ var onClose = _a.onClose, children = _a.children, _b = _a.style, style = _b === void 0 ? {} : _b, className = _a.className, _c = _a.disableEscape, disableEscape = _c === void 0 ? false : _c, _d = _a.visibility, visibility = _d === void 0 ? { visible: true } : _d;
18
+ var visible = visibility.visible, _e = visibility.invisibleStyle, invisibleStyle = _e === void 0 ? {
19
+ zIndex: -1,
20
+ opacity: 0,
21
+ pointerEvents: "none",
22
+ userSelect: "none",
23
+ } : _e, _f = visibility.visibleStyle, visibleStyle = _f === void 0 ? { opacity: 1 } : _f, invisibleClassName = visibility.invisibleClassName, visibleClassName = visibility.visibleClassName;
24
+ var _g = useScrollLock(), lock = _g.lock, unlock = _g.unlock;
8
25
  var focusRef = useFocusTrap(true);
9
26
  useEffect(function () {
10
27
  var handleEscape = function (event) {
@@ -23,7 +40,7 @@ var Layer = function (_a) {
23
40
  lock();
24
41
  return unlock;
25
42
  }, [lock, unlock]);
26
- return (_jsx("div", { className: classNames("ajui-layer-backdrop", className), style: style, onClick: onClose, children: React.cloneElement(children, {
43
+ return (_jsx("div", { className: classNames("ajui-layer-backdrop", className, visible ? visibleClassName : invisibleClassName), style: __assign(__assign({}, style), (visible ? visibleStyle : invisibleStyle)), onClick: onClose, children: React.cloneElement(children, {
27
44
  ref: focusRef,
28
45
  onClick: function (e) {
29
46
  var _a, _b;
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adamjanicki/ui",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
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
  }