@parallelworks/ui 0.4.0 → 0.5.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.
- package/README.md +0 -6
- package/dist/chunks/BareModal-DBa84JZO.js +80 -0
- package/dist/chunks/{CodePreviewEditor-B3688Fx4.js → CodePreviewEditor-KwzSyk3-.js} +2 -1
- package/dist/chunks/CreateModal-CXSi9ELO.js +595 -0
- package/dist/chunks/Loader-BXoXTZGc.js +47 -0
- package/dist/chunks/{Monaco-BEj--GTx.js → Monaco-FlGHL7zR.js} +3 -2
- package/dist/chunks/{Provider-uUHgWOWc.js → Provider-wC9G01Ou.js} +22 -1
- package/dist/chunks/RowContextMenu-D3G3DPQk.js +319 -0
- package/dist/chunks/{SwitchToggle-BqD0dE-L.js → SwitchToggle-CkYT1isd.js} +1 -1
- package/dist/chunks/{Table-C5z6qWjM.js → Table-ByziK93x.js} +1 -1
- package/dist/chunks/{editor-CdQbKtYO.js → editor-DbDUZn8w.js} +5 -41
- package/dist/chunks/{list-D5f5Fq-O.js → list-CGbR-ueU.js} +4 -316
- package/dist/chunks/useCssIsDark-DHr05dG2.js +38 -0
- package/dist/components/AddMenu.d.ts +17 -0
- package/dist/components/BareModal.d.ts +17 -0
- package/dist/components/Breadcrumbs.d.ts +28 -0
- package/dist/components/ConfirmModal.d.ts +17 -0
- package/dist/components/CreateModal.d.ts +92 -0
- package/dist/components/Loader.d.ts +2 -1
- package/dist/components/PageHeader.d.ts +69 -0
- package/dist/components/Provider.d.ts +25 -12
- package/dist/components/ghostButton.d.ts +4 -0
- package/dist/editor/index.d.ts +0 -1
- package/dist/editor/index.js +2 -2
- package/dist/file-explorer/index.js +24 -25
- package/dist/form/index.js +4 -4
- package/dist/index.d.ts +8 -1
- package/dist/index.js +237 -10
- package/dist/list/index.js +2 -1
- package/dist/logviewer/index.js +1 -1
- package/dist/styles/theme.css +22 -0
- package/dist/styles.css +1 -1
- package/dist/theme/index.d.ts +1 -1
- package/dist/theme/index.js +6 -0
- package/dist/workflow/index.js +8 -8
- package/package.json +1 -1
- package/dist/chunks/Loader-DQiZ75fa.js +0 -25
- package/dist/chunks/Markdown-iFhq8Gb0.js +0 -101
- package/dist/chunks/Modal-sOUEwebV.js +0 -121
- package/dist/components/Modal.d.ts +0 -26
- /package/dist/{editor → components}/useCssIsDark.d.ts +0 -0
package/README.md
CHANGED
|
@@ -47,9 +47,3 @@ import { AddIcon, LoaderIcon, TrashIcon } from '@parallelworks/ui/icons'
|
|
|
47
47
|
|
|
48
48
|
The barrel re-exports a curated, stable set of icon names over `react-icons`
|
|
49
49
|
so applications never depend on a specific icon pack directly.
|
|
50
|
-
|
|
51
|
-
## Development
|
|
52
|
-
|
|
53
|
-
This package lives in the Parallel Works ACTIVATE monorepo and is consumed
|
|
54
|
-
in-repo directly from `src/`. The published artifact is built with Vite
|
|
55
|
-
(`pnpm build`) and validated with `pnpm lint:package` and `pnpm verify:pack`.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import cx from "classnames";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback, useEffect, useRef } from "react";
|
|
4
|
+
import { createPortal } from "react-dom";
|
|
5
|
+
//#region src/components/BareModal.tsx
|
|
6
|
+
/** Omit when the content supplies its own panel styling. */
|
|
7
|
+
var modalPanelClasses = "rounded-xl border border-(--theme-border) bg-(--theme-app-bg) text-(--theme-app) shadow-2xl";
|
|
8
|
+
var FOCUSABLE = "a[href], button:not([disabled]), textarea, input, select, [tabindex]:not([tabindex=\"-1\"])";
|
|
9
|
+
function BareModal({ open, onClose, ariaLabel, className, onPanelKeyDown, onPanelMouseDown, align = "top", preventClose = false, children }) {
|
|
10
|
+
const panelRef = useRef(null);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
if (!open || preventClose) return;
|
|
13
|
+
const onKeyDown = (e) => {
|
|
14
|
+
if (e.key === "Escape") onClose();
|
|
15
|
+
};
|
|
16
|
+
document.addEventListener("keydown", onKeyDown);
|
|
17
|
+
return () => document.removeEventListener("keydown", onKeyDown);
|
|
18
|
+
}, [
|
|
19
|
+
open,
|
|
20
|
+
onClose,
|
|
21
|
+
preventClose
|
|
22
|
+
]);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
if (!open) return;
|
|
25
|
+
const previouslyFocused = document.activeElement;
|
|
26
|
+
const previousOverflow = document.body.style.overflow;
|
|
27
|
+
document.body.style.overflow = "hidden";
|
|
28
|
+
return () => {
|
|
29
|
+
document.body.style.overflow = previousOverflow;
|
|
30
|
+
previouslyFocused?.focus?.();
|
|
31
|
+
};
|
|
32
|
+
}, [open]);
|
|
33
|
+
const trapFocus = useCallback((e) => {
|
|
34
|
+
const panel = panelRef.current;
|
|
35
|
+
if (e.key !== "Tab" || !panel || !panel.contains(document.activeElement)) {
|
|
36
|
+
onPanelKeyDown?.(e);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const focusable = panel.querySelectorAll(FOCUSABLE);
|
|
40
|
+
if (focusable.length === 0) {
|
|
41
|
+
e.preventDefault();
|
|
42
|
+
onPanelKeyDown?.(e);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const first = focusable[0];
|
|
46
|
+
const last = focusable[focusable.length - 1];
|
|
47
|
+
if (!first || !last) {
|
|
48
|
+
onPanelKeyDown?.(e);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if (e.shiftKey && document.activeElement === first) {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
last.focus();
|
|
54
|
+
} else if (!e.shiftKey && document.activeElement === last) {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
first.focus();
|
|
57
|
+
}
|
|
58
|
+
onPanelKeyDown?.(e);
|
|
59
|
+
}, [onPanelKeyDown]);
|
|
60
|
+
if (!open) return null;
|
|
61
|
+
return createPortal(/* @__PURE__ */ jsx("div", {
|
|
62
|
+
"data-testid": "modal-backdrop",
|
|
63
|
+
className: cx("fixed inset-0 z-[9990] flex justify-center px-4 pb-8", align === "center" ? "items-center" : "items-start pt-[14vh]"),
|
|
64
|
+
style: { backgroundColor: "rgba(0, 0, 0, 0.4)" },
|
|
65
|
+
onClick: preventClose ? void 0 : onClose,
|
|
66
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
67
|
+
ref: panelRef,
|
|
68
|
+
role: "dialog",
|
|
69
|
+
"aria-modal": "true",
|
|
70
|
+
"aria-label": ariaLabel,
|
|
71
|
+
className,
|
|
72
|
+
onClick: (e) => e.stopPropagation(),
|
|
73
|
+
onKeyDown: trapFocus,
|
|
74
|
+
onMouseDown: onPanelMouseDown,
|
|
75
|
+
children
|
|
76
|
+
})
|
|
77
|
+
}), document.body);
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { modalPanelClasses as n, BareModal as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as useCssIsDark } from "./useCssIsDark-DHr05dG2.js";
|
|
2
|
+
import { n as defineEditorThemes, r as getThemeName, t as setupMonacoWorkers } from "./editor-DbDUZn8w.js";
|
|
2
3
|
import { jsx } from "react/jsx-runtime";
|
|
3
4
|
import { useEffect, useRef } from "react";
|
|
4
5
|
import * as monaco from "monaco-editor";
|