@drawbridge/components 0.1.20 → 0.1.21

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.
@@ -961,7 +961,7 @@ const FormOrganizationWorkflowEdit = ({
961
961
  if (row) setValue("steps", [...getValues("steps"), row], { shouldDirty: true });
962
962
  }, [catalog, disabled, getValues, loading, setValue, values == null ? void 0 : values.step]);
963
963
  const getStepOptions = (index) => {
964
- const usedTypes = watchedSteps.map((s, i) => i !== index ? s.type : null).filter(Boolean);
964
+ const usedTypes = (watchedSteps || []).map((s, i) => i !== index ? s.type : null).filter(Boolean);
965
965
  return [
966
966
  { key: "Select a step", value: "" },
967
967
  ...((catalog == null ? void 0 : catalog.steps) || []).filter((step) => !usedTypes.includes(step.value)).filter((step) => {
@@ -1030,6 +1030,7 @@ const FormOrganizationWorkflowEdit = ({
1030
1030
  var _a2;
1031
1031
  return s.ownerOnly && s.value === ((_a2 = watchedSteps[index]) == null ? void 0 : _a2.type);
1032
1032
  });
1033
+ const canAddStep = hasStepOptions(getStepOptions((watchedSteps || []).length));
1033
1034
  const getStepValue = (field, index) => {
1034
1035
  if (!field.type) return "";
1035
1036
  const options = getStepOptions(index);
@@ -1184,6 +1185,7 @@ const FormOrganizationWorkflowEdit = ({
1184
1185
  import_input_array.InputArrayButton,
1185
1186
  {
1186
1187
  ...{
1188
+ disabled: !canAddStep,
1187
1189
  onClick: () => append(stepRow()),
1188
1190
  text: "Add step"
1189
1191
  }
@@ -909,7 +909,7 @@ const FormOrganizationWorkflowEdit = ({
909
909
  if (row) setValue("steps", [...getValues("steps"), row], { shouldDirty: true });
910
910
  }, [catalog, disabled, getValues, loading, setValue, values == null ? void 0 : values.step]);
911
911
  const getStepOptions = (index) => {
912
- const usedTypes = watchedSteps.map((s, i) => i !== index ? s.type : null).filter(Boolean);
912
+ const usedTypes = (watchedSteps || []).map((s, i) => i !== index ? s.type : null).filter(Boolean);
913
913
  return [
914
914
  { key: "Select a step", value: "" },
915
915
  ...((catalog == null ? void 0 : catalog.steps) || []).filter((step) => !usedTypes.includes(step.value)).filter((step) => {
@@ -978,6 +978,7 @@ const FormOrganizationWorkflowEdit = ({
978
978
  var _a2;
979
979
  return s.ownerOnly && s.value === ((_a2 = watchedSteps[index]) == null ? void 0 : _a2.type);
980
980
  });
981
+ const canAddStep = hasStepOptions(getStepOptions((watchedSteps || []).length));
981
982
  const getStepValue = (field, index) => {
982
983
  if (!field.type) return "";
983
984
  const options = getStepOptions(index);
@@ -1132,6 +1133,7 @@ const FormOrganizationWorkflowEdit = ({
1132
1133
  InputArrayButton,
1133
1134
  {
1134
1135
  ...{
1136
+ disabled: !canAddStep,
1135
1137
  onClick: () => append(stepRow()),
1136
1138
  text: "Add step"
1137
1139
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drawbridge/components",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "exports": {
5
5
  "./advertisement": {
6
6
  "types": "./types/advertisement.d.ts",