@particle-academy/fancy-flow 0.33.0 → 0.33.2

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.cjs CHANGED
@@ -12757,9 +12757,11 @@ function ConfigFieldRenderer({
12757
12757
  field,
12758
12758
  value,
12759
12759
  onChange,
12760
+ id: id2,
12760
12761
  renderCredentialField,
12761
12762
  renderDocumentField
12762
12763
  }) {
12764
+ const handle = { id: id2, "data-ff-field": field.key };
12763
12765
  switch (field.type) {
12764
12766
  case "text": {
12765
12767
  if (field.choices?.length) {
@@ -12768,6 +12770,7 @@ function ConfigFieldRenderer({
12768
12770
  return /* @__PURE__ */ jsxRuntime.jsx(
12769
12771
  "input",
12770
12772
  {
12773
+ ...handle,
12771
12774
  className: "ff-panel__input",
12772
12775
  type: "text",
12773
12776
  value: value ?? "",
@@ -12780,6 +12783,7 @@ function ConfigFieldRenderer({
12780
12783
  return /* @__PURE__ */ jsxRuntime.jsx(
12781
12784
  "textarea",
12782
12785
  {
12786
+ ...handle,
12783
12787
  className: "ff-panel__input ff-panel__input--textarea",
12784
12788
  rows: field.rows ?? 4,
12785
12789
  value: value ?? "",
@@ -12791,6 +12795,7 @@ function ConfigFieldRenderer({
12791
12795
  return /* @__PURE__ */ jsxRuntime.jsx(
12792
12796
  "input",
12793
12797
  {
12798
+ ...handle,
12794
12799
  className: "ff-panel__input",
12795
12800
  type: "number",
12796
12801
  value: value ?? "",
@@ -12805,6 +12810,7 @@ function ConfigFieldRenderer({
12805
12810
  /* @__PURE__ */ jsxRuntime.jsx(
12806
12811
  "input",
12807
12812
  {
12813
+ ...handle,
12808
12814
  type: "checkbox",
12809
12815
  checked: !!value,
12810
12816
  onChange: (e) => onChange(e.target.checked)
@@ -12816,6 +12822,7 @@ function ConfigFieldRenderer({
12816
12822
  return /* @__PURE__ */ jsxRuntime.jsxs(
12817
12823
  "select",
12818
12824
  {
12825
+ ...handle,
12819
12826
  className: "ff-panel__input",
12820
12827
  value: value ?? "",
12821
12828
  onChange: (e) => onChange(e.target.value),
@@ -12831,6 +12838,7 @@ function ConfigFieldRenderer({
12831
12838
  return /* @__PURE__ */ jsxRuntime.jsx(
12832
12839
  "textarea",
12833
12840
  {
12841
+ ...handle,
12834
12842
  className: "ff-panel__input ff-panel__input--expression",
12835
12843
  rows: 2,
12836
12844
  value: value ?? "",
@@ -13131,15 +13139,20 @@ function NodeConfigPanel({
13131
13139
  className,
13132
13140
  style: style2
13133
13141
  }) {
13142
+ const uid = ReactExports.useId();
13143
+ const kindName = node ? node.data.kind ?? node.type : null;
13144
+ const kind = ReactExports.useMemo(() => kindName ? getNodeKind(kindName) : void 0, [kindName]);
13145
+ const config = ReactExports.useMemo(
13146
+ () => node?.data?.config ?? {},
13147
+ [node?.data]
13148
+ );
13149
+ const fieldId = (key) => `${uid}-${key}`;
13134
13150
  if (!node) {
13135
13151
  return /* @__PURE__ */ jsxRuntime.jsxs("aside", { className: ["ff-panel", "ff-panel--empty", className ?? ""].filter(Boolean).join(" "), style: style2, children: [
13136
13152
  header,
13137
13153
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ff-panel__empty", children: "Select a node to configure it." })
13138
13154
  ] });
13139
13155
  }
13140
- const kindName = node.data.kind ?? node.type;
13141
- const kind = ReactExports.useMemo(() => getNodeKind(kindName), [kindName]);
13142
- const config = ReactExports.useMemo(() => node.data.config ?? {}, [node.data]);
13143
13156
  if (!kind) {
13144
13157
  return /* @__PURE__ */ jsxRuntime.jsxs("aside", { className: ["ff-panel", className ?? ""].filter(Boolean).join(" "), style: style2, children: [
13145
13158
  header,
@@ -13180,10 +13193,12 @@ function NodeConfigPanel({
13180
13193
  ] }),
13181
13194
  kind.description && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "ff-panel__kind-desc", children: kind.description }),
13182
13195
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-panel__field", children: [
13183
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "ff-panel__label", children: "Label" }),
13196
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "ff-panel__label", htmlFor: fieldId("label"), children: "Label" }),
13184
13197
  /* @__PURE__ */ jsxRuntime.jsx(
13185
13198
  "input",
13186
13199
  {
13200
+ id: fieldId("label"),
13201
+ "data-ff-field": "label",
13187
13202
  className: "ff-panel__input",
13188
13203
  value: node.data.label ?? "",
13189
13204
  onChange: (e) => setLabel(e.target.value),
@@ -13192,10 +13207,12 @@ function NodeConfigPanel({
13192
13207
  )
13193
13208
  ] }),
13194
13209
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-panel__field", children: [
13195
- /* @__PURE__ */ jsxRuntime.jsx("label", { className: "ff-panel__label", children: "Description" }),
13210
+ /* @__PURE__ */ jsxRuntime.jsx("label", { className: "ff-panel__label", htmlFor: fieldId("description"), children: "Description" }),
13196
13211
  /* @__PURE__ */ jsxRuntime.jsx(
13197
13212
  "textarea",
13198
13213
  {
13214
+ id: fieldId("description"),
13215
+ "data-ff-field": "description",
13199
13216
  className: "ff-panel__input ff-panel__input--textarea",
13200
13217
  rows: 2,
13201
13218
  value: node.data.description ?? "",
@@ -13210,7 +13227,7 @@ function NodeConfigPanel({
13210
13227
  }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
13211
13228
  (kind.configSchema ?? []).length > 0 && /* @__PURE__ */ jsxRuntime.jsx("hr", { className: "ff-panel__divider" }),
13212
13229
  (kind.configSchema ?? []).map((field) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "ff-panel__field", children: [
13213
- /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "ff-panel__label", children: [
13230
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "ff-panel__label", htmlFor: fieldId(field.key), children: [
13214
13231
  field.label,
13215
13232
  field.required && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ff-panel__required", "aria-hidden": true, children: " *" })
13216
13233
  ] }),
@@ -13218,6 +13235,7 @@ function NodeConfigPanel({
13218
13235
  /* @__PURE__ */ jsxRuntime.jsx(
13219
13236
  ConfigFieldRenderer,
13220
13237
  {
13238
+ id: fieldId(field.key),
13221
13239
  field,
13222
13240
  value: config[field.key],
13223
13241
  onChange: (v2) => setConfigValue(field.key, v2),