@parallelworks/ui 0.3.1 → 0.5.0

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 (59) hide show
  1. package/dist/chunks/BareModal-DBa84JZO.js +80 -0
  2. package/dist/chunks/{CodePreviewEditor-CSPRILMp.js → CodePreviewEditor-CBtYRZi6.js} +2 -1
  3. package/dist/chunks/CreateModal-6zZZHxCI.js +595 -0
  4. package/dist/chunks/Loader-BXoXTZGc.js +47 -0
  5. package/dist/chunks/{Monaco-CC4ak1JG.js → Monaco-CvFXoW3r.js} +11 -5
  6. package/dist/chunks/{Provider-DvVvScTQ.js → Provider-jQCAN3NN.js} +73 -2
  7. package/dist/chunks/{SwitchToggle-2uRw8ZeJ.js → SwitchToggle-D0ud8cd5.js} +36 -29
  8. package/dist/chunks/{Table-C5z6qWjM.js → Table-ByziK93x.js} +1 -1
  9. package/dist/chunks/{editor-D55tumuZ.js → editor-CEXg6C8X.js} +5 -41
  10. package/dist/chunks/list-CvDWt0TC.js +1259 -0
  11. package/dist/chunks/useCssIsDark-DHr05dG2.js +38 -0
  12. package/dist/components/AddMenu.d.ts +17 -0
  13. package/dist/components/BareModal.d.ts +17 -0
  14. package/dist/components/Button.d.ts +18 -0
  15. package/dist/components/Card.d.ts +19 -0
  16. package/dist/components/ConfirmModal.d.ts +17 -0
  17. package/dist/components/CreateModal.d.ts +92 -0
  18. package/dist/components/Filter.d.ts +15 -0
  19. package/dist/components/FilterPill.d.ts +7 -0
  20. package/dist/components/IconButton.d.ts +17 -0
  21. package/dist/components/Input.d.ts +14 -0
  22. package/dist/components/LetterBadge.d.ts +6 -0
  23. package/dist/components/Loader.d.ts +2 -1
  24. package/dist/components/Pagination.d.ts +15 -0
  25. package/dist/components/Provider.d.ts +39 -12
  26. package/dist/components/SettingModeOption.d.ts +13 -0
  27. package/dist/components/SettingRow.d.ts +18 -0
  28. package/dist/components/SettingsCard.d.ts +24 -0
  29. package/dist/components/SettingsGroup.d.ts +8 -0
  30. package/dist/components/Sort.d.ts +9 -0
  31. package/dist/components/Toggle.d.ts +6 -0
  32. package/dist/components/dropdownUtils.d.ts +10 -0
  33. package/dist/components/ghostButton.d.ts +4 -0
  34. package/dist/components/inputClasses.d.ts +1 -0
  35. package/dist/editor/index.d.ts +0 -1
  36. package/dist/editor/index.js +2 -2
  37. package/dist/file-explorer/index.js +27 -28
  38. package/dist/form/index.js +4 -4
  39. package/dist/index.d.ts +21 -1
  40. package/dist/index.js +433 -8
  41. package/dist/list/HoverCard.d.ts +22 -0
  42. package/dist/list/ListPager.d.ts +7 -0
  43. package/dist/list/ListViewControls.d.ts +12 -0
  44. package/dist/list/index.d.ts +6 -0
  45. package/dist/list/index.js +2 -2
  46. package/dist/list/listSearch.d.ts +27 -0
  47. package/dist/list/listView.d.ts +129 -0
  48. package/dist/list/textEntry.d.ts +2 -0
  49. package/dist/logviewer/index.js +1 -1
  50. package/dist/styles/theme.css +21 -0
  51. package/dist/styles.css +1 -1
  52. package/dist/workflow/index.js +8 -8
  53. package/package.json +2 -6
  54. package/dist/chunks/Loader-DQiZ75fa.js +0 -25
  55. package/dist/chunks/Markdown-C5Re2ezs.js +0 -101
  56. package/dist/chunks/Modal-sOUEwebV.js +0 -121
  57. package/dist/chunks/list-7PyDF1tz.js +0 -465
  58. package/dist/components/Modal.d.ts +0 -26
  59. /package/dist/{editor → components}/useCssIsDark.d.ts +0 -0
@@ -0,0 +1,47 @@
1
+ import { LoaderIcon } from "../icons.js";
2
+ import cx from "classnames";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ //#region src/components/Loader.tsx
5
+ var RIPPLE_STAGGER_S = .22;
6
+ var LOGO_RINGS = [
7
+ "M24.89,55V32.14a7.25,7.25,0,1,1,7.25,7.25h-6",
8
+ "M17.27,58.12v-26A14.88,14.88,0,1,1,32.14,47H24.89",
9
+ "M9.25,52.35V32.14A22.9,22.9,0,1,1,32.14,55H24.89",
10
+ "M62.68,32.14A30.54,30.54,0,1,1,1.6,32.14,30.54,30.54,0,1,1,62.68,32.14"
11
+ ];
12
+ function Loader({ size = 48, text, textSize = 12, full = true, color = "", loaderStyle = {}, variant = "spinner" }) {
13
+ const loaderColor = color || "text-(--theme-element,#3b82f6)";
14
+ const dimension = typeof size === "number" ? `${size}px` : size;
15
+ return /* @__PURE__ */ jsxs("div", {
16
+ role: "status",
17
+ "aria-label": text || "Loading",
18
+ className: cx(full && "w-full", "flex flex-col flex-wrap justify-center items-center gap-y-1"),
19
+ children: [/* @__PURE__ */ jsx("div", {
20
+ className: cx("w-full flex justify-center items-center", loaderColor),
21
+ style: loaderStyle,
22
+ children: variant === "logo" ? /* @__PURE__ */ jsx("svg", {
23
+ viewBox: "0 0 64.29 64.29",
24
+ width: dimension,
25
+ height: dimension,
26
+ fill: "none",
27
+ stroke: "currentColor",
28
+ strokeWidth: 3.2,
29
+ "aria-hidden": "true",
30
+ children: LOGO_RINGS.map((d, i) => /* @__PURE__ */ jsx("path", {
31
+ d,
32
+ className: "logo-loader-ring",
33
+ style: { animationDelay: `${(i * RIPPLE_STAGGER_S).toFixed(2)}s` }
34
+ }, d))
35
+ }) : /* @__PURE__ */ jsx(LoaderIcon, {
36
+ className: "animate-spin",
37
+ style: { fontSize: dimension }
38
+ })
39
+ }), text && /* @__PURE__ */ jsx("div", {
40
+ className: "text-center italic",
41
+ style: { fontSize: `${textSize}px` },
42
+ children: text
43
+ })]
44
+ });
45
+ }
46
+ //#endregion
47
+ export { Loader as t };
@@ -1,5 +1,6 @@
1
- import { l as useWorkflowJsonResolver } from "./Provider-DvVvScTQ.js";
2
- import { i as getThemeName, n as setupMonacoWorkers, r as defineEditorThemes, t as useCssIsDark } from "./editor-D55tumuZ.js";
1
+ import { l as useWorkflowJsonResolver } from "./Provider-jQCAN3NN.js";
2
+ import { t as useCssIsDark } from "./useCssIsDark-DHr05dG2.js";
3
+ import { n as defineEditorThemes, r as getThemeName, t as setupMonacoWorkers } from "./editor-CEXg6C8X.js";
3
4
  import cx from "classnames";
4
5
  import { jsx } from "react/jsx-runtime";
5
6
  import { useEffect, useRef } from "react";
@@ -39,6 +40,7 @@ var workflowCompletionProvidersRegistered = false;
39
40
  var noop = () => {};
40
41
  function MonacoEditor({ className, disabled, onChange = noop, onValidate = noop, width = "100%", height = "100%", path = "file:///default", marketplaceItems = [], workflows = [], ...options }) {
41
42
  const isDark = useCssIsDark();
43
+ const readOnly = disabled || options.readOnly;
42
44
  const resolveWorkflowJson = useWorkflowJsonResolver();
43
45
  const monacoRef = useRef(null);
44
46
  const isSyncingValueRef = useRef(false);
@@ -49,8 +51,12 @@ function MonacoEditor({ className, disabled, onChange = noop, onValidate = noop,
49
51
  if (!monacoRef.current) return;
50
52
  defineEditorThemes(monaco.editor);
51
53
  monaco.editor.setTheme(getThemeName(isDark, disabled));
52
- monacoRef.current.updateOptions({ readOnly: disabled });
53
- }, [disabled, isDark]);
54
+ monacoRef.current.updateOptions({ readOnly });
55
+ }, [
56
+ disabled,
57
+ isDark,
58
+ readOnly
59
+ ]);
54
60
  useEffect(() => {
55
61
  if (!monacoRef.current) return;
56
62
  const model = monacoRef.current.getModel();
@@ -102,7 +108,7 @@ function MonacoEditor({ className, disabled, onChange = noop, onValidate = noop,
102
108
  automaticLayout: true,
103
109
  model,
104
110
  ...options,
105
- readOnly: disabled || options.readOnly,
111
+ readOnly,
106
112
  fixedOverflowWidgets: true,
107
113
  suggest: {
108
114
  preview: true,
@@ -1,4 +1,4 @@
1
- import { jsx } from "react/jsx-runtime";
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { createContext, useContext, useMemo } from "react";
3
3
  //#region src/components/Provider.tsx
4
4
  var DefaultLink = ({ to, onClick, className, children }) => /* @__PURE__ */ jsx("a", {
@@ -28,6 +28,20 @@ var DEFAULTS = {
28
28
  },
29
29
  strings: {
30
30
  loading: "Loading…",
31
+ modal: {
32
+ cancel: "Cancel",
33
+ close: "Close",
34
+ create: "Create",
35
+ creating: "Creating…",
36
+ addDescription: "Add description…",
37
+ advanced: "Advanced",
38
+ favorite: "Favorite",
39
+ favorited: "Favorited",
40
+ favoriteHintOn: "Your item will be favorited when it's created",
41
+ favoriteHintOff: "Favorite your item when it's created",
42
+ filter: "Filter",
43
+ noOptions: "No options available"
44
+ },
31
45
  common: {
32
46
  copy: "Copy",
33
47
  copied: "Copied!",
@@ -291,7 +305,60 @@ var DEFAULTS = {
291
305
  labelUid: "UID",
292
306
  labelId: "ID",
293
307
  labelUrl: "URL",
294
- couldNotLoad: (noun) => `Couldn't load ${noun}`
308
+ couldNotLoad: (noun) => `Couldn't load ${noun}`,
309
+ displayOptions: "Display options",
310
+ grouping: "Grouping",
311
+ ordering: "Ordering",
312
+ orderDefault: "Default",
313
+ orderFavorites: "Favorites",
314
+ ascending: "Ascending",
315
+ descending: "Descending",
316
+ columnHeaders: "Column headers",
317
+ showColumnHeaders: "Show column headers",
318
+ showActions: "Show actions",
319
+ showRowActions: "Show row actions",
320
+ alwaysShowActions: "Always show actions",
321
+ alwaysShowRowActions: "Always show row actions",
322
+ displayProperties: "Display properties",
323
+ pinnedActions: "Pinned actions",
324
+ pinnedActionsHelp: "Pinned actions show as quick buttons on the right of each row (on hover), alongside the ⋯ menu. Each only appears on rows where that action is available, so a row's buttons vary by its type and status.",
325
+ reset: "Reset",
326
+ none: "None",
327
+ filter: "Filter",
328
+ clear: "Clear",
329
+ pager: (start, end, total) => `${start}–${end} of ${total}`,
330
+ paginationPrevious: "Previous",
331
+ paginationNext: "Next",
332
+ paginationShowing: (name, start, end) => /* @__PURE__ */ jsxs(Fragment, { children: [
333
+ "Showing ",
334
+ name,
335
+ " ",
336
+ /* @__PURE__ */ jsx("span", {
337
+ className: "font-medium",
338
+ children: start
339
+ }),
340
+ " to",
341
+ " ",
342
+ /* @__PURE__ */ jsx("span", {
343
+ className: "font-medium",
344
+ children: end
345
+ })
346
+ ] }),
347
+ paginationShowingTimeRange: (name, startTime, endTime) => /* @__PURE__ */ jsxs(Fragment, { children: [
348
+ "Showing ",
349
+ name,
350
+ " from ",
351
+ /* @__PURE__ */ jsx("span", {
352
+ className: "font-medium",
353
+ children: startTime
354
+ }),
355
+ " ",
356
+ "to ",
357
+ /* @__PURE__ */ jsx("span", {
358
+ className: "font-medium",
359
+ children: endTime
360
+ })
361
+ ] })
295
362
  }
296
363
  },
297
364
  navigation: {
@@ -333,6 +400,10 @@ function UIProvider({ notify, strings, navigation, data, slots, children }) {
333
400
  },
334
401
  strings: {
335
402
  loading: strings?.loading ?? DEFAULTS.strings.loading,
403
+ modal: {
404
+ ...DEFAULTS.strings.modal,
405
+ ...strings?.modal
406
+ },
336
407
  common: {
337
408
  ...DEFAULTS.strings.common,
338
409
  ...strings?.common
@@ -1,5 +1,5 @@
1
1
  import { AngleDownIcon, AngleRightIcon, CaretDownIcon } from "../icons.js";
2
- import { c as useStrings } from "./Provider-DvVvScTQ.js";
2
+ import { c as useStrings } from "./Provider-jQCAN3NN.js";
3
3
  import { n as TOOLTIP_ID } from "./Tooltip-WgbiC_nd.js";
4
4
  import cx from "classnames";
5
5
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
@@ -46,6 +46,34 @@ function filterOption(option, query) {
46
46
  const secondary = option.secondaryValue !== void 0 ? String(option.secondaryValue).toLowerCase().replace(/(-)/gm, "") : "";
47
47
  return label.includes(q) || secondary.includes(q);
48
48
  }
49
+ function flattenFilteredOptions({ options, query, selectedValue, allowCustomValue, customValueLabel }) {
50
+ const flatOptions = options.flatMap((option) => {
51
+ if (isCategory(option)) {
52
+ const filteredOptions = option.options.filter((opt) => filterOption(opt, query));
53
+ if (filteredOptions.length === 0) return [];
54
+ return [{
55
+ label: option.category || "",
56
+ value: option.category || "",
57
+ disabled: true,
58
+ category: true
59
+ }, ...filteredOptions];
60
+ }
61
+ if (filterOption(option, query)) return option;
62
+ return [];
63
+ });
64
+ if (allowCustomValue) {
65
+ const customValue = query || selectedValue || "";
66
+ flatOptions.unshift({
67
+ label: `${customValueLabel} "${customValue}"`,
68
+ value: customValue
69
+ });
70
+ } else if (flatOptions.length === 0) return [{
71
+ label: "No options found",
72
+ value: "",
73
+ disabled: true
74
+ }];
75
+ return flatOptions;
76
+ }
49
77
  function DropdownCaret() {
50
78
  return /* @__PURE__ */ jsx(CaretDownIcon, { className: "text-neutral-400 absolute top-1/2 -translate-y-1/2 right-0 mr-3 inset-y-0 flex items-center rounded-r-md focus:outline-hidden" });
51
79
  }
@@ -213,34 +241,13 @@ function DropdownHelper({ wrapperClassName = "w-full", className, textBoxClassNa
213
241
  }
214
242
  onChange(val);
215
243
  };
216
- const flattenedOptions = useMemo(() => {
217
- const flatOptions = options.flatMap((option) => {
218
- if (isCategory(option)) {
219
- const filteredOptions = option.options.filter((opt) => filterOption(opt, query));
220
- if (filteredOptions.length === 0) return [];
221
- return [{
222
- label: option.category || "",
223
- value: option.category || "",
224
- disabled: true,
225
- category: true
226
- }, ...filteredOptions];
227
- }
228
- if (filterOption(option, query)) return option;
229
- return [];
230
- });
231
- if (allowCustomValue) {
232
- const customValue = query || value?.value || "";
233
- flatOptions.unshift({
234
- label: `${customValueLabel} "${customValue}"`,
235
- value: customValue
236
- });
237
- } else if (flatOptions.length === 0) return [{
238
- label: "No options found",
239
- value: "",
240
- disabled: true
241
- }];
242
- return flatOptions;
243
- }, [
244
+ const flattenedOptions = useMemo(() => flattenFilteredOptions({
245
+ options,
246
+ query,
247
+ selectedValue: value?.value,
248
+ allowCustomValue,
249
+ customValueLabel
250
+ }), [
244
251
  options,
245
252
  query,
246
253
  value,
@@ -1,4 +1,4 @@
1
- import { t as Loader } from "./Loader-DQiZ75fa.js";
1
+ import { t as Loader } from "./Loader-BXoXTZGc.js";
2
2
  import cx from "classnames";
3
3
  import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import React from "react";
@@ -1,15 +1,15 @@
1
1
  import { CheckIcon, CopyIcon, EyeIcon, EyeOffIcon } from "../icons.js";
2
- import { c as useStrings, i as useNotify } from "./Provider-DvVvScTQ.js";
3
- import { t as Loader } from "./Loader-DQiZ75fa.js";
2
+ import { c as useStrings, i as useNotify } from "./Provider-jQCAN3NN.js";
3
+ import { t as Loader } from "./Loader-BXoXTZGc.js";
4
4
  import { t as SwitchToggleSmall } from "./SwitchToggleSmall-FcsaYSTs.js";
5
5
  import { c as FieldWrapper, n as flattenGroups, r as impureSetValueFromPath } from "./lib-DTgL8klR.js";
6
6
  import cx from "classnames";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
- import { Suspense, lazy, useEffect, useMemo, useRef, useState } from "react";
8
+ import { Suspense, lazy, useMemo, useRef, useState } from "react";
9
9
  import { convertToDynamicForm, parseStringsOfObj, parseStringsOfObjReady } from "@parallelworks/workflow-parser";
10
10
  import { useField, useFormikContext } from "formik";
11
11
  //#region src/editor/Editor.tsx
12
- var MonacoEditor = lazy(() => import("./Monaco-CC4ak1JG.js"));
12
+ var MonacoEditor = lazy(() => import("./Monaco-CvFXoW3r.js"));
13
13
  function Editor({ ...props }) {
14
14
  return /* @__PURE__ */ jsx(Suspense, {
15
15
  fallback: /* @__PURE__ */ jsx(Loader, { text: "Loading editor..." }),
@@ -333,40 +333,4 @@ function setupMonacoWorkers() {
333
333
  window.MonacoEnvironment = monacoEnvironment;
334
334
  }
335
335
  //#endregion
336
- //#region src/editor/useCssIsDark.ts
337
- function readIsDark() {
338
- const scheme = getComputedStyle(document.documentElement).colorScheme;
339
- const dark = scheme.includes("dark");
340
- if (dark !== scheme.includes("light")) return dark;
341
- if (typeof window.matchMedia !== "function") return false;
342
- return window.matchMedia("(prefers-color-scheme: dark)").matches;
343
- }
344
- /**
345
- * Follows the host's CSS color-scheme, the same signal the log viewer's
346
- * light-dark() palette uses — no provider API involved. For the rare concrete
347
- * pick (editor themes, image variants) the tokens cannot express.
348
- */
349
- function useCssIsDark() {
350
- const [isDark, setIsDark] = useState(readIsDark);
351
- useEffect(() => {
352
- const update = () => setIsDark(readIsDark());
353
- const media = typeof window.matchMedia === "function" ? window.matchMedia("(prefers-color-scheme: dark)") : void 0;
354
- media?.addEventListener("change", update);
355
- const observer = new MutationObserver(update);
356
- observer.observe(document.documentElement, {
357
- attributes: true,
358
- attributeFilter: [
359
- "style",
360
- "class",
361
- "data-theme"
362
- ]
363
- });
364
- return () => {
365
- media?.removeEventListener("change", update);
366
- observer.disconnect();
367
- };
368
- }, []);
369
- return isDark;
370
- }
371
- //#endregion
372
- export { FormCodePanel as a, getThemeName as i, setupMonacoWorkers as n, EditorField as o, defineEditorThemes as r, Editor as s, useCssIsDark as t };
336
+ export { EditorField as a, FormCodePanel as i, defineEditorThemes as n, Editor as o, getThemeName as r, setupMonacoWorkers as t };