@octaviaflow/core 3.1.0-beta.106 → 3.1.0-beta.108

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/dist/index.js CHANGED
@@ -2420,14 +2420,32 @@ import { useBreadcrumbItem, useBreadcrumbs } from "react-aria";
2420
2420
  import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
2421
2421
  function BreadcrumbItem({ item, isCurrent }) {
2422
2422
  const ref = useRef3(null);
2423
+ const interactive = !isCurrent && (!!item.href || !!item.onClick);
2423
2424
  const { itemProps } = useBreadcrumbItem(
2424
- { children: item.label, isCurrent, elementType: item.href ? "a" : "span" },
2425
+ {
2426
+ children: item.label,
2427
+ isCurrent,
2428
+ elementType: item.href ? "a" : item.onClick && !isCurrent ? "button" : "span"
2429
+ },
2425
2430
  ref
2426
2431
  );
2427
2432
  const content = /* @__PURE__ */ jsxs8(Fragment5, { children: [
2428
2433
  item.icon && /* @__PURE__ */ jsx8("span", { className: "ods-breadcrumb__icon", children: item.icon }),
2429
2434
  /* @__PURE__ */ jsx8("span", { children: item.label })
2430
2435
  ] });
2436
+ if (item.onClick && !item.href && interactive) {
2437
+ return /* @__PURE__ */ jsx8(
2438
+ "button",
2439
+ {
2440
+ ...itemProps,
2441
+ ref,
2442
+ type: "button",
2443
+ onClick: item.onClick,
2444
+ className: cn("ods-breadcrumb__link", "ods-breadcrumb__link--button"),
2445
+ children: content
2446
+ }
2447
+ );
2448
+ }
2431
2449
  if (item.href && !isCurrent) {
2432
2450
  return /* @__PURE__ */ jsx8(
2433
2451
  "a",
@@ -34428,6 +34446,7 @@ import {
34428
34446
  useRef as useRef50,
34429
34447
  useState as useState71
34430
34448
  } from "react";
34449
+ import { AddIcon as AddIcon6, CloseIcon as CloseIcon20 } from "@octaviaflow/icons";
34431
34450
 
34432
34451
  // src/components/ExpressionField/parseExpression.ts
34433
34452
  var CALL_NAME_SOURCE = "(?:[A-Z_][A-Z0-9_]*|user\\.[A-Za-z_][A-Za-z0-9_]*)";
@@ -34996,6 +35015,7 @@ function ExpressionField({
34996
35015
  CallEditor,
34997
35016
  {
34998
35017
  raw: editing.raw,
35018
+ anchor: editing.el,
34999
35019
  rect: editing.rect,
35000
35020
  nameOf: callLabel,
35001
35021
  labelFor,
@@ -35010,6 +35030,7 @@ function ExpressionField({
35010
35030
  }
35011
35031
  function CallEditor({
35012
35032
  raw,
35033
+ anchor,
35013
35034
  rect,
35014
35035
  nameOf,
35015
35036
  labelFor,
@@ -35021,13 +35042,27 @@ function CallEditor({
35021
35042
  const [path, setPath] = useState71([]);
35022
35043
  const [rawMode, setRawMode] = useState71(false);
35023
35044
  const panelRef = useRef50(null);
35045
+ const onApplyRef = useRef50(onApply);
35046
+ onApplyRef.current = onApply;
35047
+ const draftRef = useRef50(draft);
35048
+ draftRef.current = draft;
35024
35049
  useEffect56(() => {
35025
35050
  const onKey = (e) => {
35026
35051
  if (e.key === "Escape") onCancel();
35027
35052
  };
35053
+ const onPointerDown = (e) => {
35054
+ const target = e.target;
35055
+ if (panelRef.current?.contains(target)) return;
35056
+ if (anchor.contains(target)) return;
35057
+ onApplyRef.current(draftRef.current);
35058
+ };
35028
35059
  document.addEventListener("keydown", onKey);
35029
- return () => document.removeEventListener("keydown", onKey);
35030
- }, [onCancel]);
35060
+ document.addEventListener("mousedown", onPointerDown, true);
35061
+ return () => {
35062
+ document.removeEventListener("keydown", onKey);
35063
+ document.removeEventListener("mousedown", onPointerDown, true);
35064
+ };
35065
+ }, [anchor, onCancel]);
35031
35066
  const current = callAt(draft, path);
35032
35067
  const signature = current ? resolveCall?.(current.name) : void 0;
35033
35068
  const names = signature?.args ?? [];
@@ -35065,27 +35100,17 @@ function CallEditor({
35065
35100
  "aria-label": `Edit ${crumbs[0]?.label ?? "function"}`,
35066
35101
  children: [
35067
35102
  /* @__PURE__ */ jsxs141("div", { className: "ods-expression-field__editor-head", children: [
35068
- /* @__PURE__ */ jsx147("nav", { className: "ods-expression-field__editor-crumbs", "aria-label": "Nested functions", children: crumbs.map((crumb, i) => /* @__PURE__ */ jsxs141("span", { children: [
35069
- i > 0 && /* @__PURE__ */ jsx147("span", { "aria-hidden": "true", children: " \u203A " }),
35070
- /* @__PURE__ */ jsx147(
35071
- "button",
35072
- {
35073
- type: "button",
35074
- disabled: i === crumbs.length - 1,
35075
- onClick: () => setPath(crumb.path),
35076
- children: crumb.label
35077
- }
35078
- )
35079
- ] }, crumb.path.join(".") || "root")) }),
35080
35103
  /* @__PURE__ */ jsx147(
35081
- "button",
35104
+ Breadcrumb,
35082
35105
  {
35083
- type: "button",
35084
- className: "ods-expression-field__editor-link",
35085
- onClick: () => setRawMode((r) => !r),
35086
- children: rawMode ? "Back to fields" : "Edit as text"
35106
+ className: "ods-expression-field__editor-crumbs",
35107
+ items: crumbs.map((crumb) => ({
35108
+ label: crumb.label,
35109
+ onClick: () => setPath(crumb.path)
35110
+ }))
35087
35111
  }
35088
- )
35112
+ ),
35113
+ /* @__PURE__ */ jsx147(Button, { variant: "ghost", size: "sm", onClick: () => setRawMode((r) => !r), children: rawMode ? "Back to fields" : "Edit as text" })
35089
35114
  ] }),
35090
35115
  rawMode ? /* @__PURE__ */ jsx147(
35091
35116
  "textarea",
@@ -35105,16 +35130,16 @@ function CallEditor({
35105
35130
  // eslint-disable-next-line react/no-array-index-key
35106
35131
  /* @__PURE__ */ jsxs141("div", { className: "ods-expression-field__editor-row", children: [
35107
35132
  /* @__PURE__ */ jsxs141("span", { className: "ods-expression-field__editor-row-head", children: [
35108
- /* @__PURE__ */ jsx147("span", { id: `arg-${index}-label`, children: rowLabel }),
35133
+ /* @__PURE__ */ jsx147("span", { className: "ods-expression-field__editor-row-name", id: `arg-${index}-label`, children: rowLabel }),
35109
35134
  /* @__PURE__ */ jsx147(
35110
- "button",
35135
+ Button,
35111
35136
  {
35112
- type: "button",
35113
- className: "ods-expression-field__editor-remove",
35137
+ variant: "icon",
35138
+ size: "sm",
35114
35139
  "aria-label": `Remove ${rowLabel}`,
35115
35140
  title: "Remove this argument",
35116
35141
  onClick: () => removeArg(index),
35117
- children: "\u2715"
35142
+ children: /* @__PURE__ */ jsx147(CloseIcon20, { size: "sm" })
35118
35143
  }
35119
35144
  )
35120
35145
  ] }),
@@ -35129,8 +35154,17 @@ function CallEditor({
35129
35154
  children: [
35130
35155
  /* @__PURE__ */ jsx147("code", { children: argSummary(arg, nameOf) }),
35131
35156
  /* @__PURE__ */ jsxs141("span", { children: [
35132
- /* @__PURE__ */ jsx147("button", { type: "button", onClick: () => setPath([...path, index]), children: "Open" }),
35133
- /* @__PURE__ */ jsx147("button", { type: "button", onClick: () => setArg(index, ""), "aria-label": `Clear ${rowLabel}`, children: "Clear" })
35157
+ /* @__PURE__ */ jsx147(Button, { variant: "secondary", size: "sm", onClick: () => setPath([...path, index]), children: "Open" }),
35158
+ /* @__PURE__ */ jsx147(
35159
+ Button,
35160
+ {
35161
+ variant: "ghost",
35162
+ size: "sm",
35163
+ "aria-label": `Clear ${rowLabel}`,
35164
+ onClick: () => setArg(index, ""),
35165
+ children: "Clear"
35166
+ }
35167
+ )
35134
35168
  ] })
35135
35169
  ]
35136
35170
  }
@@ -35155,7 +35189,16 @@ function CallEditor({
35155
35189
  children: labelFor(arg.startsWith("ods://") ? `{{${arg}}}` : arg)
35156
35190
  }
35157
35191
  ),
35158
- /* @__PURE__ */ jsx147("button", { type: "button", onClick: () => setArg(index, ""), "aria-label": `Clear ${rowLabel}`, children: "Clear" })
35192
+ /* @__PURE__ */ jsx147(
35193
+ Button,
35194
+ {
35195
+ variant: "ghost",
35196
+ size: "sm",
35197
+ "aria-label": `Clear ${rowLabel}`,
35198
+ onClick: () => setArg(index, ""),
35199
+ children: "Clear"
35200
+ }
35201
+ )
35159
35202
  ]
35160
35203
  }
35161
35204
  )
@@ -35177,31 +35220,25 @@ function CallEditor({
35177
35220
  );
35178
35221
  }),
35179
35222
  /* @__PURE__ */ jsx147(
35180
- "button",
35223
+ Button,
35181
35224
  {
35182
- type: "button",
35183
- className: "ods-expression-field__editor-add",
35225
+ variant: "ghost",
35226
+ size: "sm",
35227
+ fullWidth: true,
35228
+ leftIcon: /* @__PURE__ */ jsx147(AddIcon6, { size: "sm" }),
35184
35229
  onClick: () => setDraft((d) => {
35185
35230
  const at = callAt(d, path);
35186
35231
  if (!at) return d;
35187
35232
  const next = [...at.args, '""'];
35188
35233
  return path.length === 0 ? formatCall(at.name, next) : replaceArgument(d, path, `${at.name}(${next.join(", ")})`);
35189
35234
  }),
35190
- children: "+ Add argument"
35235
+ children: "Add argument"
35191
35236
  }
35192
35237
  )
35193
35238
  ] }),
35194
35239
  /* @__PURE__ */ jsxs141("div", { className: "ods-expression-field__editor-foot", children: [
35195
- /* @__PURE__ */ jsx147("button", { type: "button", onClick: onCancel, children: "Cancel" }),
35196
- /* @__PURE__ */ jsx147(
35197
- "button",
35198
- {
35199
- type: "button",
35200
- className: "ods-expression-field__editor-primary",
35201
- onClick: () => onApply(draft),
35202
- children: "Apply"
35203
- }
35204
- )
35240
+ /* @__PURE__ */ jsx147(Button, { variant: "secondary", size: "sm", onClick: onCancel, children: "Cancel" }),
35241
+ /* @__PURE__ */ jsx147(Button, { variant: "primary", size: "sm", onClick: () => onApply(draft), children: "Apply" })
35205
35242
  ] })
35206
35243
  ]
35207
35244
  }
@@ -39597,7 +39634,7 @@ function draftFromChannel(channel, fallbackType = "slack") {
39597
39634
  }
39598
39635
 
39599
39636
  // src/notifications/components/NotificationChannelForm/NotificationChannelForm.tsx
39600
- import { AddIcon as AddIcon6, CheckmarkFilledIcon as CheckmarkFilledIcon3, LaunchIcon as LaunchIcon2 } from "@octaviaflow/icons";
39637
+ import { AddIcon as AddIcon7, CheckmarkFilledIcon as CheckmarkFilledIcon3, LaunchIcon as LaunchIcon2 } from "@octaviaflow/icons";
39601
39638
  import { useId as useId68, useState as useState83 } from "react";
39602
39639
  import { jsx as jsx164, jsxs as jsxs156 } from "react/jsx-runtime";
39603
39640
  var DEFAULT_TYPES = [
@@ -39763,7 +39800,7 @@ function NotificationChannelForm({
39763
39800
  {
39764
39801
  size,
39765
39802
  variant: "ghost",
39766
- leftIcon: /* @__PURE__ */ jsx164(AddIcon6, { size: "sm", "aria-hidden": "true" }),
39803
+ leftIcon: /* @__PURE__ */ jsx164(AddIcon7, { size: "sm", "aria-hidden": "true" }),
39767
39804
  onClick: () => onConnectNew(value.type),
39768
39805
  className: "ods-notif-channel-form__connect",
39769
39806
  children: "Connect new"
@@ -40053,7 +40090,7 @@ function NotificationChannelDialog({
40053
40090
  NotificationChannelDialog.displayName = "NotificationChannelDialog";
40054
40091
 
40055
40092
  // src/notifications/components/NotificationChannelList/NotificationChannelList.tsx
40056
- import { AddIcon as AddIcon7, ConnectIcon } from "@octaviaflow/icons";
40093
+ import { AddIcon as AddIcon8, ConnectIcon } from "@octaviaflow/icons";
40057
40094
  import { jsx as jsx166, jsxs as jsxs158 } from "react/jsx-runtime";
40058
40095
  function NotificationChannelList({
40059
40096
  channels,
@@ -40082,7 +40119,7 @@ function NotificationChannelList({
40082
40119
  {
40083
40120
  size: "sm",
40084
40121
  variant: "secondary",
40085
- leftIcon: /* @__PURE__ */ jsx166(AddIcon7, { size: "sm", "aria-hidden": "true" }),
40122
+ leftIcon: /* @__PURE__ */ jsx166(AddIcon8, { size: "sm", "aria-hidden": "true" }),
40086
40123
  onClick: onAdd,
40087
40124
  children: "Add channel"
40088
40125
  }
@@ -40098,7 +40135,7 @@ function NotificationChannelList({
40098
40135
  Button,
40099
40136
  {
40100
40137
  variant: "primary",
40101
- leftIcon: /* @__PURE__ */ jsx166(AddIcon7, { size: "sm", "aria-hidden": "true" }),
40138
+ leftIcon: /* @__PURE__ */ jsx166(AddIcon8, { size: "sm", "aria-hidden": "true" }),
40102
40139
  onClick: onAdd,
40103
40140
  children: "Add channel"
40104
40141
  }
@@ -40122,7 +40159,7 @@ function NotificationChannelList({
40122
40159
  channel.id
40123
40160
  )),
40124
40161
  canAdd && /* @__PURE__ */ jsxs158("button", { type: "button", className: "ods-notif-channels__add", onClick: onAdd, children: [
40125
- /* @__PURE__ */ jsx166("span", { className: "ods-notif-channels__add-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx166(AddIcon7, { size: "sm" }) }),
40162
+ /* @__PURE__ */ jsx166("span", { className: "ods-notif-channels__add-icon", "aria-hidden": "true", children: /* @__PURE__ */ jsx166(AddIcon8, { size: "sm" }) }),
40126
40163
  "Add channel"
40127
40164
  ] })
40128
40165
  ] })
@@ -40404,7 +40441,7 @@ function NotificationPreferenceMatrix({
40404
40441
  NotificationPreferenceMatrix.displayName = "NotificationPreferenceMatrix";
40405
40442
 
40406
40443
  // src/notifications/components/NotificationRuleEditor/NotificationRuleEditor.tsx
40407
- import { AddIcon as AddIcon8, RuleIcon } from "@octaviaflow/icons";
40444
+ import { AddIcon as AddIcon9, RuleIcon } from "@octaviaflow/icons";
40408
40445
  import { useId as useId70, useMemo as useMemo45 } from "react";
40409
40446
  import { Fragment as Fragment68, jsx as jsx168, jsxs as jsxs160 } from "react/jsx-runtime";
40410
40447
  var COOLDOWN_OPTIONS = [
@@ -40555,7 +40592,7 @@ function NotificationRuleEditor({
40555
40592
  {
40556
40593
  size: "sm",
40557
40594
  variant: "ghost",
40558
- leftIcon: /* @__PURE__ */ jsx168(AddIcon8, { size: "sm", "aria-hidden": "true" }),
40595
+ leftIcon: /* @__PURE__ */ jsx168(AddIcon9, { size: "sm", "aria-hidden": "true" }),
40559
40596
  onClick: onAddChannel,
40560
40597
  children: "Add channel"
40561
40598
  }
@@ -40749,7 +40786,7 @@ function NotificationRuleEditor({
40749
40786
  NotificationRuleEditor.displayName = "NotificationRuleEditor";
40750
40787
 
40751
40788
  // src/notifications/components/NotificationRuleList/NotificationRuleList.tsx
40752
- import { AddIcon as AddIcon9, CopyIcon as CopyIcon6, EditIcon as EditIcon2, RuleIcon as RuleIcon2, TrashCanIcon as TrashCanIcon4 } from "@octaviaflow/icons";
40789
+ import { AddIcon as AddIcon10, CopyIcon as CopyIcon6, EditIcon as EditIcon2, RuleIcon as RuleIcon2, TrashCanIcon as TrashCanIcon4 } from "@octaviaflow/icons";
40753
40790
  import { Fragment as Fragment69, jsx as jsx169, jsxs as jsxs161 } from "react/jsx-runtime";
40754
40791
  function NotificationRuleList({
40755
40792
  rules,
@@ -40779,7 +40816,7 @@ function NotificationRuleList({
40779
40816
  {
40780
40817
  size: "sm",
40781
40818
  variant: "secondary",
40782
- leftIcon: /* @__PURE__ */ jsx169(AddIcon9, { size: "sm", "aria-hidden": "true" }),
40819
+ leftIcon: /* @__PURE__ */ jsx169(AddIcon10, { size: "sm", "aria-hidden": "true" }),
40783
40820
  onClick: onCreate,
40784
40821
  children: "New rule"
40785
40822
  }
@@ -40796,7 +40833,7 @@ function NotificationRuleList({
40796
40833
  Button,
40797
40834
  {
40798
40835
  variant: "primary",
40799
- leftIcon: /* @__PURE__ */ jsx169(AddIcon9, { size: "sm", "aria-hidden": "true" }),
40836
+ leftIcon: /* @__PURE__ */ jsx169(AddIcon10, { size: "sm", "aria-hidden": "true" }),
40800
40837
  onClick: onCreate,
40801
40838
  children: "New rule"
40802
40839
  }