@parallelworks/ui 0.3.0 → 0.4.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 (43) hide show
  1. package/README.md +5 -0
  2. package/dist/chunks/{CodePreviewEditor-CSPRILMp.js → CodePreviewEditor-B3688Fx4.js} +1 -1
  3. package/dist/chunks/{Markdown-C5Re2ezs.js → Markdown-iFhq8Gb0.js} +1 -1
  4. package/dist/chunks/{Monaco-CC4ak1JG.js → Monaco-BEj--GTx.js} +10 -5
  5. package/dist/chunks/{Provider-DvVvScTQ.js → Provider-uUHgWOWc.js} +55 -2
  6. package/dist/chunks/{SwitchToggle-2uRw8ZeJ.js → SwitchToggle-BqD0dE-L.js} +36 -29
  7. package/dist/chunks/{editor-D55tumuZ.js → editor-CdQbKtYO.js} +2 -2
  8. package/dist/chunks/list-D5f5Fq-O.js +1259 -0
  9. package/dist/components/Button.d.ts +18 -0
  10. package/dist/components/Card.d.ts +19 -0
  11. package/dist/components/Filter.d.ts +15 -0
  12. package/dist/components/FilterPill.d.ts +7 -0
  13. package/dist/components/IconButton.d.ts +17 -0
  14. package/dist/components/Input.d.ts +14 -0
  15. package/dist/components/LetterBadge.d.ts +6 -0
  16. package/dist/components/Pagination.d.ts +15 -0
  17. package/dist/components/Provider.d.ts +25 -0
  18. package/dist/components/SettingModeOption.d.ts +13 -0
  19. package/dist/components/SettingRow.d.ts +18 -0
  20. package/dist/components/SettingsCard.d.ts +24 -0
  21. package/dist/components/SettingsGroup.d.ts +8 -0
  22. package/dist/components/Sort.d.ts +9 -0
  23. package/dist/components/Toggle.d.ts +6 -0
  24. package/dist/components/dropdownUtils.d.ts +10 -0
  25. package/dist/components/inputClasses.d.ts +1 -0
  26. package/dist/editor/index.js +1 -1
  27. package/dist/file-explorer/index.js +8 -7
  28. package/dist/form/index.js +2 -2
  29. package/dist/index.d.ts +15 -0
  30. package/dist/index.js +429 -5
  31. package/dist/list/HoverCard.d.ts +22 -0
  32. package/dist/list/ListPager.d.ts +7 -0
  33. package/dist/list/ListViewControls.d.ts +12 -0
  34. package/dist/list/index.d.ts +6 -0
  35. package/dist/list/index.js +2 -2
  36. package/dist/list/listSearch.d.ts +27 -0
  37. package/dist/list/listView.d.ts +129 -0
  38. package/dist/list/textEntry.d.ts +2 -0
  39. package/dist/logviewer/index.js +1 -1
  40. package/dist/styles.css +1 -1
  41. package/dist/workflow/index.js +1 -1
  42. package/package.json +4 -2
  43. package/dist/chunks/list-7PyDF1tz.js +0 -465
package/README.md CHANGED
@@ -34,6 +34,11 @@ stylesheet instead:
34
34
  import '@parallelworks/ui/styles.css'
35
35
  ```
36
36
 
37
+ The prebuilt stylesheet nests all of its rules in the `pw-ui` cascade layer,
38
+ so loading it alongside other Parallel Works package stylesheets (for example
39
+ `@parallelworks/ai-chat/styles.css`, which uses the `pw-ai-chat` layer) is
40
+ order-independent.
41
+
37
42
  ## Icons
38
43
 
39
44
  ```tsx
@@ -1,4 +1,4 @@
1
- import { i as getThemeName, n as setupMonacoWorkers, r as defineEditorThemes, t as useCssIsDark } from "./editor-D55tumuZ.js";
1
+ import { i as getThemeName, n as setupMonacoWorkers, r as defineEditorThemes, t as useCssIsDark } from "./editor-CdQbKtYO.js";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { useEffect, useRef } from "react";
4
4
  import * as monaco from "monaco-editor";
@@ -1,5 +1,5 @@
1
1
  import { AlertIcon, CheckIcon, ClipboardIcon, CopyIcon, HiddenFalseIcon, HiddenTrueIcon, InfoIcon } from "../icons.js";
2
- import { i as useNotify } from "./Provider-DvVvScTQ.js";
2
+ import { i as useNotify } from "./Provider-uUHgWOWc.js";
3
3
  import cx from "classnames";
4
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import { Suspense, lazy, useState } from "react";
@@ -1,5 +1,5 @@
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-uUHgWOWc.js";
2
+ import { i as getThemeName, n as setupMonacoWorkers, r as defineEditorThemes, t as useCssIsDark } from "./editor-CdQbKtYO.js";
3
3
  import cx from "classnames";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  import { useEffect, useRef } from "react";
@@ -39,6 +39,7 @@ var workflowCompletionProvidersRegistered = false;
39
39
  var noop = () => {};
40
40
  function MonacoEditor({ className, disabled, onChange = noop, onValidate = noop, width = "100%", height = "100%", path = "file:///default", marketplaceItems = [], workflows = [], ...options }) {
41
41
  const isDark = useCssIsDark();
42
+ const readOnly = disabled || options.readOnly;
42
43
  const resolveWorkflowJson = useWorkflowJsonResolver();
43
44
  const monacoRef = useRef(null);
44
45
  const isSyncingValueRef = useRef(false);
@@ -49,8 +50,12 @@ function MonacoEditor({ className, disabled, onChange = noop, onValidate = noop,
49
50
  if (!monacoRef.current) return;
50
51
  defineEditorThemes(monaco.editor);
51
52
  monaco.editor.setTheme(getThemeName(isDark, disabled));
52
- monacoRef.current.updateOptions({ readOnly: disabled });
53
- }, [disabled, isDark]);
53
+ monacoRef.current.updateOptions({ readOnly });
54
+ }, [
55
+ disabled,
56
+ isDark,
57
+ readOnly
58
+ ]);
54
59
  useEffect(() => {
55
60
  if (!monacoRef.current) return;
56
61
  const model = monacoRef.current.getModel();
@@ -102,7 +107,7 @@ function MonacoEditor({ className, disabled, onChange = noop, onValidate = noop,
102
107
  automaticLayout: true,
103
108
  model,
104
109
  ...options,
105
- readOnly: disabled || options.readOnly,
110
+ readOnly,
106
111
  fixedOverflowWidgets: true,
107
112
  suggest: {
108
113
  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", {
@@ -291,7 +291,60 @@ var DEFAULTS = {
291
291
  labelUid: "UID",
292
292
  labelId: "ID",
293
293
  labelUrl: "URL",
294
- couldNotLoad: (noun) => `Couldn't load ${noun}`
294
+ couldNotLoad: (noun) => `Couldn't load ${noun}`,
295
+ displayOptions: "Display options",
296
+ grouping: "Grouping",
297
+ ordering: "Ordering",
298
+ orderDefault: "Default",
299
+ orderFavorites: "Favorites",
300
+ ascending: "Ascending",
301
+ descending: "Descending",
302
+ columnHeaders: "Column headers",
303
+ showColumnHeaders: "Show column headers",
304
+ showActions: "Show actions",
305
+ showRowActions: "Show row actions",
306
+ alwaysShowActions: "Always show actions",
307
+ alwaysShowRowActions: "Always show row actions",
308
+ displayProperties: "Display properties",
309
+ pinnedActions: "Pinned actions",
310
+ 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.",
311
+ reset: "Reset",
312
+ none: "None",
313
+ filter: "Filter",
314
+ clear: "Clear",
315
+ pager: (start, end, total) => `${start}–${end} of ${total}`,
316
+ paginationPrevious: "Previous",
317
+ paginationNext: "Next",
318
+ paginationShowing: (name, start, end) => /* @__PURE__ */ jsxs(Fragment, { children: [
319
+ "Showing ",
320
+ name,
321
+ " ",
322
+ /* @__PURE__ */ jsx("span", {
323
+ className: "font-medium",
324
+ children: start
325
+ }),
326
+ " to",
327
+ " ",
328
+ /* @__PURE__ */ jsx("span", {
329
+ className: "font-medium",
330
+ children: end
331
+ })
332
+ ] }),
333
+ paginationShowingTimeRange: (name, startTime, endTime) => /* @__PURE__ */ jsxs(Fragment, { children: [
334
+ "Showing ",
335
+ name,
336
+ " from ",
337
+ /* @__PURE__ */ jsx("span", {
338
+ className: "font-medium",
339
+ children: startTime
340
+ }),
341
+ " ",
342
+ "to ",
343
+ /* @__PURE__ */ jsx("span", {
344
+ className: "font-medium",
345
+ children: endTime
346
+ })
347
+ ] })
295
348
  }
296
349
  },
297
350
  navigation: {
@@ -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-uUHgWOWc.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,5 +1,5 @@
1
1
  import { CheckIcon, CopyIcon, EyeIcon, EyeOffIcon } from "../icons.js";
2
- import { c as useStrings, i as useNotify } from "./Provider-DvVvScTQ.js";
2
+ import { c as useStrings, i as useNotify } from "./Provider-uUHgWOWc.js";
3
3
  import { t as Loader } from "./Loader-DQiZ75fa.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";
@@ -9,7 +9,7 @@ import { Suspense, lazy, useEffect, 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-BEj--GTx.js"));
13
13
  function Editor({ ...props }) {
14
14
  return /* @__PURE__ */ jsx(Suspense, {
15
15
  fallback: /* @__PURE__ */ jsx(Loader, { text: "Loading editor..." }),