@parallelworks/ui 0.22.0 → 0.24.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 (41) hide show
  1. package/dist/ai/adapter/mock/mockAdapter.js +2 -1
  2. package/dist/ai/adapter/openai/openaiAdapter.js +6 -3
  3. package/dist/ai/adapter/openai/wire.d.ts +2 -1
  4. package/dist/ai/adapter/types.d.ts +2 -1
  5. package/dist/ai/components/ChatEmptyState.js +2 -0
  6. package/dist/ai/components/ChatInput.d.ts +4 -2
  7. package/dist/ai/components/ChatInput.js +36 -10
  8. package/dist/ai/components/ChatMessage.js +9 -2
  9. package/dist/ai/components/ChatMessageList.d.ts +3 -1
  10. package/dist/ai/components/ChatMessageList.js +2 -2
  11. package/dist/ai/components/ChatThread.js +2 -0
  12. package/dist/ai/components/ModelSelector.js +94 -62
  13. package/dist/ai/components/PastedText.d.ts +15 -0
  14. package/dist/ai/components/PastedText.js +59 -0
  15. package/dist/ai/components/ProviderIssueBanner.d.ts +1 -0
  16. package/dist/ai/components/ProviderIssueBanner.js +30 -0
  17. package/dist/ai/components/usePasteCards.d.ts +30 -0
  18. package/dist/ai/components/usePasteCards.js +129 -0
  19. package/dist/ai/core/ChatProvider.d.ts +2 -1
  20. package/dist/ai/core/ChatProvider.js +7 -3
  21. package/dist/ai/core/chatReducer.d.ts +3 -1
  22. package/dist/ai/core/chatReducer.js +2 -0
  23. package/dist/ai/core/pastes.d.ts +14 -0
  24. package/dist/ai/core/pastes.js +43 -0
  25. package/dist/ai/core/providerIssues.d.ts +2 -0
  26. package/dist/ai/core/providerIssues.js +7 -0
  27. package/dist/ai/index.d.ts +4 -0
  28. package/dist/ai/index.js +4 -1
  29. package/dist/ai/strings.d.ts +14 -0
  30. package/dist/ai/strings.js +14 -0
  31. package/dist/ai/types.d.ts +18 -0
  32. package/dist/file-explorer/FileExplorer.d.ts +7 -1
  33. package/dist/file-explorer/FileExplorer.js +3 -1
  34. package/dist/list/ListPage.js +19 -6
  35. package/dist/list/ListTable.d.ts +4 -1
  36. package/dist/list/ListTable.js +7 -4
  37. package/dist/list/UserHoverCard.js +28 -9
  38. package/dist/list/listView.d.ts +10 -0
  39. package/dist/list/listView.js +8 -1
  40. package/dist/styles.css +1 -1
  41. package/package.json +1 -1
@@ -1,4 +1,6 @@
1
- import { useLink, useStrings } from "../components/Provider.js";
1
+ import { useLink, useNotify, useStrings } from "../components/Provider.js";
2
+ import { FiCopy } from "../icons/fi/FiCopy.js";
3
+ import "../components/Tooltip.js";
2
4
  import { Avatar } from "../components/Avatar.js";
3
5
  import { HoverCardSurface, useHoverCard } from "./HoverCard.js";
4
6
  import cx from "classnames";
@@ -25,6 +27,7 @@ function HoverCardTrigger({ className, children, card }) {
25
27
  }
26
28
  function UserHoverCard({ x, y, onKeepOpen, onLeave, username, name, avatarSrc, badge, href, linkComponent, loading = false, relayoutKey, children }) {
27
29
  const strings = useStrings();
30
+ const notify = useNotify();
28
31
  const SlotLink = useLink();
29
32
  const Link = linkComponent ?? SlotLink;
30
33
  const displayName = name || username;
@@ -34,7 +37,7 @@ function UserHoverCard({ x, y, onKeepOpen, onLeave, username, name, avatarSrc, b
34
37
  size: "lg",
35
38
  className: "shrink-0"
36
39
  }), /* @__PURE__ */ jsxs("div", {
37
- className: "min-w-0 flex-1",
40
+ className: "flex min-h-10 min-w-0 flex-1 flex-col justify-between",
38
41
  children: [/* @__PURE__ */ jsxs("div", {
39
42
  className: "flex flex-wrap items-center gap-x-1.5 gap-y-0.5",
40
43
  children: [/* @__PURE__ */ jsx("span", {
@@ -45,10 +48,14 @@ function UserHoverCard({ x, y, onKeepOpen, onLeave, username, name, avatarSrc, b
45
48
  children: badge
46
49
  })]
47
50
  }), /* @__PURE__ */ jsx("div", {
51
+ "data-copy-value": true,
48
52
  className: "truncate text-xs text-(--theme-muted-text-color)",
49
53
  children: username
50
54
  })]
51
55
  })] });
56
+ const t = strings.list;
57
+ const copyLabel = EMAIL.test(username) ? t.labelEmail : t.labelUsername;
58
+ const onCopy = () => navigator.clipboard?.writeText(username).then(() => notify.success(t.copied(copyLabel)), () => notify.error(t.couldntCopy(copyLabel)));
52
59
  return /* @__PURE__ */ jsxs(HoverCardSurface, {
53
60
  x,
54
61
  y,
@@ -56,13 +63,24 @@ function UserHoverCard({ x, y, onKeepOpen, onLeave, username, name, avatarSrc, b
56
63
  relayoutKey,
57
64
  onKeepOpen,
58
65
  onLeave,
59
- children: [href ? /* @__PURE__ */ jsx(Link, {
60
- to: href,
61
- className: "flex items-start gap-3 transition-opacity hover:opacity-80",
62
- children: header
63
- }) : /* @__PURE__ */ jsx("div", {
64
- className: "flex items-start gap-3",
65
- children: header
66
+ children: [/* @__PURE__ */ jsxs("div", {
67
+ className: "group/copy flex items-end gap-1",
68
+ children: [href ? /* @__PURE__ */ jsx(Link, {
69
+ to: href,
70
+ className: "flex min-w-0 flex-1 items-start gap-3 transition-opacity hover:opacity-80",
71
+ children: header
72
+ }) : /* @__PURE__ */ jsx("div", {
73
+ className: "flex min-w-0 flex-1 items-start gap-3",
74
+ children: header
75
+ }), username && /* @__PURE__ */ jsx("button", {
76
+ type: "button",
77
+ "aria-label": t.copy(copyLabel),
78
+ "data-tooltip-id": "global-tooltip",
79
+ "data-tooltip-content": t.copy(copyLabel),
80
+ onClick: onCopy,
81
+ className: cx("shrink-0 cursor-pointer rounded p-0.5 text-(--theme-muted-text-color) opacity-0 transition hover:bg-(--theme-muted-panel-bg) hover:text-(--theme-app) [&>svg]:h-3.5 [&>svg]:w-3.5", "hover:opacity-100 group-has-[[data-copy-value]:hover]/copy:opacity-100 focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--theme-link) pointer-coarse:opacity-100"),
82
+ children: /* @__PURE__ */ jsx(FiCopy, { "aria-hidden": "true" })
83
+ })]
66
84
  }), loading ? /* @__PURE__ */ jsxs("div", {
67
85
  role: "status",
68
86
  "aria-label": strings.loading,
@@ -87,6 +105,7 @@ function UserHoverCard({ x, y, onKeepOpen, onLeave, username, name, avatarSrc, b
87
105
  }) : null]
88
106
  });
89
107
  }
108
+ var EMAIL = /^[^\s@]+@[^\s@]+$/;
90
109
  var rowClasses = "flex gap-2 text-(--theme-muted-text-color)";
91
110
  /** One detail line of a hover card: a leading icon and its content. With
92
111
  * `onClick` the line is a button. */
@@ -11,7 +11,14 @@ export interface ColumnDef {
11
11
  defaultHidden?: boolean;
12
12
  /** NOT a table column (no header) — appears in picker and isVisible, but excluded from visibleColumns. */
13
13
  inline?: boolean;
14
+ /** Drops below a container width instead of stacking (see `stack`). */
14
15
  priority?: ColumnPriority;
16
+ /** Below the `medium` width, a column without a `priority` gives up its cell
17
+ * and its content shows under the first column's instead, so a phone gets a
18
+ * row it can read rather than one running off the side. `false` keeps it a
19
+ * column there: for something short that compares best lined up, like a
20
+ * total. The first column never stacks; it is what the others stack under. */
21
+ stack?: boolean;
15
22
  }
16
23
  /** Column responsive importance; `low` drops before `medium`. See {@link ColumnDef.priority}. */
17
24
  type ColumnPriority = 'low' | 'medium';
@@ -79,6 +86,9 @@ export interface ListViewChrome {
79
86
  /** Responsive show/hide class per visible column (aligned to
80
87
  * {@link visibleColumns}); `ListColumns` and `ListRow` apply entry `i`. */
81
88
  columnClasses: string[];
89
+ /** Per visible column, whether it stacks under the first on a narrow
90
+ * container ({@link ColumnDef.stack}); `ListRow` reads entry `i`. */
91
+ columnStacks: boolean[];
82
92
  }
83
93
  export interface ListView<T> extends ListViewChrome {
84
94
  columns: ColumnDef[];
@@ -6,7 +6,12 @@ var PRIORITY_SHOW_CLASS = {
6
6
  low: "hidden @[52rem]:table-cell",
7
7
  medium: "hidden @[36rem]:table-cell"
8
8
  };
9
- function columnResponsiveClass(col) {
9
+ /** Whether the column at index `i` of the visible ones stacks on a narrow container. */
10
+ function stacks(col, i) {
11
+ return i > 0 && !col.priority && col.stack !== false;
12
+ }
13
+ function columnResponsiveClass(col, i) {
14
+ if (stacks(col, i)) return PRIORITY_SHOW_CLASS.medium;
10
15
  return col.priority ? PRIORITY_SHOW_CLASS[col.priority] : "";
11
16
  }
12
17
  var DEFAULT_ORDER = "__default";
@@ -80,6 +85,7 @@ function useListView({ storageKey, sharedFiltersKey, columns, groupBys = [], def
80
85
  }, [columns, hiddenKeys]);
81
86
  const visibleColumns = useMemo(() => columns.filter((c) => !c.inline && (c.alwaysVisible || !hiddenKeys.includes(c.key))), [columns, hiddenKeys]);
82
87
  const columnClasses = useMemo(() => visibleColumns.map(columnResponsiveClass), [visibleColumns]);
88
+ const columnStacks = useMemo(() => visibleColumns.map(stacks), [visibleColumns]);
83
89
  const toggleColumn = useCallback((key) => setHiddenKeys((prev) => prev.includes(key) ? prev.filter((k) => k !== key) : [...prev, key]), [setHiddenKeys]);
84
90
  const setFacetValues = useCallback((key, values) => {
85
91
  const update = (prev) => {
@@ -171,6 +177,7 @@ function useListView({ storageKey, sharedFiltersKey, columns, groupBys = [], def
171
177
  columns,
172
178
  visibleColumns,
173
179
  columnClasses,
180
+ columnStacks,
174
181
  isVisible,
175
182
  pinnedCount,
176
183
  actionsWidth,