@octaviaflow/core 3.1.0-beta.112 → 3.1.0-beta.113

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.
@@ -20,10 +20,17 @@ export interface CommandPaletteItem {
20
20
  onSelect?: () => void;
21
21
  }
22
22
  export interface CommandPaletteGroup {
23
- /** Group heading (rendered as a sticky section label). */
23
+ /** Group heading (rendered as a section label above its rows). */
24
24
  heading: ReactNode;
25
25
  /** Commands in this group. */
26
26
  items: CommandPaletteItem[];
27
+ /**
28
+ * Run the palette's filter over this group's items. Default: the
29
+ * palette-level `shouldFilter` (itself `true` by default). Set `false`
30
+ * for groups whose items were already matched elsewhere — typically
31
+ * server search results — so they render exactly as supplied.
32
+ */
33
+ shouldFilter?: boolean;
27
34
  }
28
35
  export interface CommandPaletteProps extends Omit<ComponentPropsWithoutRef<"div">, "onSelect" | "children" | "onDrag" | "onDragStart" | "onDragEnd" | "onAnimationStart"> {
29
36
  /** Whether the palette is open. Required (always controlled). */
@@ -32,7 +39,7 @@ export interface CommandPaletteProps extends Omit<ComponentPropsWithoutRef<"div"
32
39
  onClose: () => void;
33
40
  /** Command groups. */
34
41
  groups: CommandPaletteGroup[];
35
- /** Input placeholder. Default `"Search for actions, pages, datasets…"`. */
42
+ /** Input placeholder. Default `"Search…"`. */
36
43
  placeholder?: string;
37
44
  /** Fires once per selection — useful for analytics or modal-managed flows. */
38
45
  onSelect?: (item: CommandPaletteItem) => void;
@@ -54,6 +61,31 @@ export interface CommandPaletteProps extends Omit<ComponentPropsWithoutRef<"div"
54
61
  container?: Element | null;
55
62
  /** Disable the open animation (for testing / SSR snapshots). */
56
63
  disableAnimation?: boolean;
64
+ /**
65
+ * Controlled search query. When provided, the palette renders this
66
+ * value and reports edits through `onQueryChange` instead of owning the
67
+ * query itself; it also no longer clears the query when it opens — the
68
+ * consumer decides. Omit it for the default uncontrolled behaviour.
69
+ */
70
+ query?: string;
71
+ /**
72
+ * Fires on every edit of the search input, controlled or not. Use it to
73
+ * drive async lookups (debounce on the consumer side).
74
+ */
75
+ onQueryChange?: (query: string) => void;
76
+ /**
77
+ * Default for every group's `shouldFilter`. Default `true`. Set `false`
78
+ * when the consumer filters every group itself.
79
+ */
80
+ shouldFilter?: boolean;
81
+ /**
82
+ * Results are being fetched. Renders a status row ("Searching…") below
83
+ * the current results, marks the list `aria-busy`, and suppresses the
84
+ * empty state while nothing has matched yet.
85
+ */
86
+ loading?: boolean;
87
+ /** Text of the loading row. Default `"Searching…"`. */
88
+ loadingLabel?: ReactNode;
57
89
  }
58
90
  export declare const CommandPalette: import("react").ForwardRefExoticComponent<CommandPaletteProps & import("react").RefAttributes<HTMLDivElement>>;
59
91
  export declare function useCommandPaletteShortcut(toggle: () => void, options?: {
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPalette.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,wBAAwB,EAG7B,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAwBf,MAAM,WAAW,kBAAkB;IACjC,gEAAgE;IAChE,EAAE,EAAE,MAAM,CAAC;IACX,qBAAqB;IACrB,KAAK,EAAE,SAAS,CAAC;IACjB,6BAA6B;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,uDAAuD;IACvD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,4BAA4B;IAC5B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,OAAO,EAAE,SAAS,CAAC;IACnB,8BAA8B;IAC9B,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,mBACf,SAAQ,IAAI,CACV,wBAAwB,CAAC,KAAK,CAAC,EAC7B,UAAU,GACV,UAAU,GACV,QAAQ,GACR,aAAa,GACb,WAAW,GACX,kBAAkB,CACrB;IACD,iEAAiE;IACjE,IAAI,EAAE,OAAO,CAAC;IACd,2EAA2E;IAC3E,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,sBAAsB;IACtB,MAAM,EAAE,mBAAmB,EAAE,CAAC;IAC9B,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAC9C,+CAA+C;IAC/C,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,wCAAwC;IACxC,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,KAAK,OAAO,CAAC;IACvF;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AA4BD,eAAO,MAAM,cAAc,gHAgT1B,CAAC;AAeF,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,IAAI,EAClB,OAAO,GAAE;IACP;mDAC+C;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;CACjB,GACL,IAAI,CAmBN"}
1
+ {"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPalette.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,wBAAwB,EAG7B,KAAK,SAAS,EAOf,MAAM,OAAO,CAAC;AAyBf,MAAM,WAAW,kBAAkB;IACjC,gEA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AAkB,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,KAAK,OAAO,CAAC;IACvF;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,gEAAgE;IAChE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,uDAAuD;IACvD,YAAY,CAAC,EAAE,SAAS,CAAC;CAC1B;AA4BD,eAAO,MAAM,cAAc,gHAuU1B,CAAC;AAeF,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,MAAM,IAAI,EAClB,OAAO,GAAE;IACP;mDAC+C;IAC/C,UAAU,CAAC,EAAE,OAAO,CAAC;CACjB,GACL,IAAI,CAmBN"}
package/dist/index.cjs CHANGED
@@ -10236,13 +10236,18 @@ var CommandPalette = (0, import_react63.forwardRef)(
10236
10236
  open,
10237
10237
  onClose,
10238
10238
  groups,
10239
- placeholder = "Search for actions, pages, datasets\u2026",
10239
+ placeholder = "Search\u2026",
10240
10240
  onSelect,
10241
10241
  emptyState,
10242
10242
  footer,
10243
10243
  filter = defaultFilter2,
10244
10244
  container,
10245
10245
  disableAnimation = false,
10246
+ query: controlledQuery,
10247
+ onQueryChange,
10248
+ shouldFilter = true,
10249
+ loading = false,
10250
+ loadingLabel = "Searching\u2026",
10246
10251
  id: providedId,
10247
10252
  className,
10248
10253
  ...rest
@@ -10252,14 +10257,16 @@ var CommandPalette = (0, import_react63.forwardRef)(
10252
10257
  const reducedMotion = (0, import_framer_motion13.useReducedMotion)();
10253
10258
  const inputRef = (0, import_react63.useRef)(null);
10254
10259
  const listRef = (0, import_react63.useRef)(null);
10255
- const [query, setQuery] = (0, import_react63.useState)("");
10260
+ const isQueryControlled = controlledQuery !== void 0;
10261
+ const [internalQuery, setInternalQuery] = (0, import_react63.useState)("");
10262
+ const query = isQueryControlled ? controlledQuery : internalQuery;
10256
10263
  const [activeIndex, setActiveIndex] = (0, import_react63.useState)(0);
10257
10264
  const filteredGroups = (0, import_react63.useMemo)(() => {
10258
10265
  return groups.map((g) => ({
10259
10266
  ...g,
10260
- items: g.items.filter((it) => filter(it, query, g.heading))
10267
+ items: g.shouldFilter ?? shouldFilter ? g.items.filter((it) => filter(it, query, g.heading)) : g.items
10261
10268
  })).filter((g) => g.items.length > 0);
10262
- }, [groups, query, filter]);
10269
+ }, [groups, query, filter, shouldFilter]);
10263
10270
  const flatItems = (0, import_react63.useMemo)(
10264
10271
  () => filteredGroups.flatMap((g) => g.items),
10265
10272
  [filteredGroups]
@@ -10271,7 +10278,7 @@ var CommandPalette = (0, import_react63.forwardRef)(
10271
10278
  }, [flatItems.length, activeIndex]);
10272
10279
  (0, import_react63.useEffect)(() => {
10273
10280
  if (open) {
10274
- setQuery("");
10281
+ if (!isQueryControlled) setInternalQuery("");
10275
10282
  setActiveIndex(0);
10276
10283
  requestAnimationFrame(() => inputRef.current?.focus());
10277
10284
  }
@@ -10350,76 +10357,85 @@ var CommandPalette = (0, import_react63.forwardRef)(
10350
10357
  placeholder,
10351
10358
  value: query,
10352
10359
  onChange: (e) => {
10353
- setQuery(e.target.value);
10360
+ const next = e.target.value;
10361
+ if (!isQueryControlled) setInternalQuery(next);
10362
+ onQueryChange?.(next);
10354
10363
  setActiveIndex(0);
10355
10364
  }
10356
10365
  }
10357
10366
  ),
10358
10367
  /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("kbd", { className: "ods-cmdk__esc-hint", "aria-hidden": "true", children: "Esc" })
10359
10368
  ] }),
10360
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
10369
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
10361
10370
  "div",
10362
10371
  {
10363
10372
  ref: listRef,
10364
10373
  id: `${baseId}-list`,
10365
10374
  role: "listbox",
10366
10375
  className: "ods-cmdk__list",
10367
- children: filteredGroups.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "ods-cmdk__empty", children: emptyState ?? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
10368
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "ods-cmdk__empty-title", children: "No results" }),
10369
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "ods-cmdk__empty-hint", children: "Try a different keyword." })
10370
- ] }) }) : (() => {
10371
- let flatIdx = -1;
10372
- return filteredGroups.map((g, gi) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
10373
- "div",
10374
- {
10375
- className: "ods-cmdk__group",
10376
- role: "group",
10377
- "aria-label": typeof g.heading === "string" ? g.heading : void 0,
10378
- children: [
10379
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "ods-cmdk__group-heading", children: g.heading }),
10380
- g.items.map((item) => {
10381
- flatIdx += 1;
10382
- const idx = flatIdx;
10383
- const isActive2 = idx === activeIndex;
10384
- return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
10385
- "div",
10386
- {
10387
- id: `${baseId}-opt-${idx}`,
10388
- role: "option",
10389
- "aria-selected": isActive2,
10390
- "aria-disabled": item.disabled || void 0,
10391
- className: cn(
10392
- "ods-cmdk__option",
10393
- isActive2 && "ods-cmdk__option--active",
10394
- item.danger && "ods-cmdk__option--danger",
10395
- item.disabled && "ods-cmdk__option--disabled"
10396
- ),
10397
- onMouseEnter: () => setActiveIndex(idx),
10398
- onClick: () => handleItemClick(item),
10399
- children: [
10400
- item.icon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
10401
- "span",
10402
- {
10403
- className: "ods-cmdk__option-icon",
10404
- "aria-hidden": "true",
10405
- children: item.icon
10406
- }
10376
+ "aria-busy": loading || void 0,
10377
+ children: [
10378
+ filteredGroups.length === 0 ? loading ? null : /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "ods-cmdk__empty", children: emptyState ?? /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [
10379
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "ods-cmdk__empty-title", children: "No results" }),
10380
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "ods-cmdk__empty-hint", children: "Try a different keyword." })
10381
+ ] }) }) : (() => {
10382
+ let flatIdx = -1;
10383
+ return filteredGroups.map((g, gi) => /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
10384
+ "div",
10385
+ {
10386
+ className: "ods-cmdk__group",
10387
+ role: "group",
10388
+ "aria-label": typeof g.heading === "string" ? g.heading : void 0,
10389
+ children: [
10390
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "ods-cmdk__group-heading", children: g.heading }),
10391
+ g.items.map((item) => {
10392
+ flatIdx += 1;
10393
+ const idx = flatIdx;
10394
+ const isActive2 = idx === activeIndex;
10395
+ return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(
10396
+ "div",
10397
+ {
10398
+ id: `${baseId}-opt-${idx}`,
10399
+ role: "option",
10400
+ "aria-selected": isActive2,
10401
+ "aria-disabled": item.disabled || void 0,
10402
+ className: cn(
10403
+ "ods-cmdk__option",
10404
+ isActive2 && "ods-cmdk__option--active",
10405
+ item.danger && "ods-cmdk__option--danger",
10406
+ item.disabled && "ods-cmdk__option--disabled"
10407
10407
  ),
10408
- /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "ods-cmdk__option-body", children: [
10409
- /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ods-cmdk__option-label", children: item.label }),
10410
- item.description && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ods-cmdk__option-desc", children: item.description })
10411
- ] }),
10412
- item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("kbd", { className: "ods-cmdk__option-shortcut", children: item.shortcut })
10413
- ]
10414
- },
10415
- item.id
10416
- );
10417
- })
10418
- ]
10419
- },
10420
- gi
10421
- ));
10422
- })()
10408
+ onMouseEnter: () => setActiveIndex(idx),
10409
+ onClick: () => handleItemClick(item),
10410
+ children: [
10411
+ item.icon && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(
10412
+ "span",
10413
+ {
10414
+ className: "ods-cmdk__option-icon",
10415
+ "aria-hidden": "true",
10416
+ children: item.icon
10417
+ }
10418
+ ),
10419
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("span", { className: "ods-cmdk__option-body", children: [
10420
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ods-cmdk__option-label", children: item.label }),
10421
+ item.description && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { className: "ods-cmdk__option-desc", children: item.description })
10422
+ ] }),
10423
+ item.shortcut && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("kbd", { className: "ods-cmdk__option-shortcut", children: item.shortcut })
10424
+ ]
10425
+ },
10426
+ item.id
10427
+ );
10428
+ })
10429
+ ]
10430
+ },
10431
+ gi
10432
+ ));
10433
+ })(),
10434
+ loading && /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("div", { className: "ods-cmdk__loading", role: "status", "aria-live": "polite", children: [
10435
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(Spinner, { size: "sm", tone: "muted", "aria-hidden": "true" }),
10436
+ /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("span", { children: loadingLabel })
10437
+ ] })
10438
+ ]
10423
10439
  }
10424
10440
  ),
10425
10441
  footer && /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("div", { className: "ods-cmdk__footer", children: footer })
@@ -47752,6 +47768,14 @@ var DEFAULT_NOTIFICATION_CATALOG = [
47752
47768
  subjectNoun: "app",
47753
47769
  defaultEmail: false
47754
47770
  },
47771
+ {
47772
+ key: "connector.expiring_soon",
47773
+ label: "App sign-in expires soon",
47774
+ phrase: "an app's sign-in is about to expire",
47775
+ severity: "warning",
47776
+ audience: "org",
47777
+ subjectNoun: "app"
47778
+ },
47755
47779
  {
47756
47780
  key: "connector.test_failed",
47757
47781
  label: "Connection test failed",