@sanity/workflow-studio-plugin 0.24.0 → 0.26.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.
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
 
3
3
  import { TimelineIcon } from "@sanity/icons/Timeline";
4
4
 
5
- import { Tooltip, Box, Stack, Text, useClickOutsideEvent, Popover, Flex, TextInput, Button, Select, Checkbox, Autocomplete, Card, TextArea, useToast, Dialog, Switch, TextSkeleton, Code, Spinner, useTheme_v2, Badge, MenuButton, Menu, MenuItem, useElementSize, TabList, Tab, TabPanel } from "@sanity/ui";
5
+ import { Popover, Tooltip, Box, Stack, Text, useClickOutsideEvent, Flex, TextInput, Button, Select, Checkbox, Autocomplete, Card, TextArea, useToast, Dialog, Switch, TextSkeleton, Code, useTheme_v2, Spinner, Badge, MenuButton, Menu, MenuItem, useElementSize, TabList, Tab, TabPanel } from "@sanity/ui";
6
6
 
7
7
  import { editFieldTarget, useWorkflowTelemetry, useRefcountedIds } from "@sanity/workflow-react";
8
8
 
@@ -367,8 +367,8 @@ function workflowsToolAvailable(tools) {
367
367
 
368
368
  const WORKFLOW_INTENT = "workflow";
369
369
 
370
- function pathSegmentTab(args) {
371
- return args.segment === void 0 ? args.fallback : args.tabs.find(tab => tab === args.segment);
370
+ function pathSegmentName(args) {
371
+ return args.names.find(name => name === args.segment);
372
372
  }
373
373
 
374
374
  function handlesWorkflowIntent(intent, params) {
@@ -382,12 +382,16 @@ function workflowIntentState(intent, params) {
382
382
  } : null;
383
383
  }
384
384
 
385
- const pad2 = n => String(n).padStart(2, "0"), DATE_FIELD_KINDS = [ "date", "dueDate", "datetime", "dueDatetime" ], DATE_FIELD_KIND_SET = new Set(DATE_FIELD_KINDS);
385
+ const pad2 = n => String(n).padStart(2, "0"), DUE_DATE_FIELD_KINDS = [ "dueDate", "dueDatetime" ], DATE_FIELD_KINDS = [ "date", "datetime", ...DUE_DATE_FIELD_KINDS ], DATE_FIELD_KIND_SET = new Set(DATE_FIELD_KINDS), DUE_DATE_FIELD_KIND_SET = new Set(DUE_DATE_FIELD_KINDS);
386
386
 
387
387
  function isDateFieldKind(kind) {
388
388
  return DATE_FIELD_KIND_SET.has(kind);
389
389
  }
390
390
 
391
+ function isDueDateFieldKind(kind) {
392
+ return DUE_DATE_FIELD_KIND_SET.has(kind);
393
+ }
394
+
391
395
  function hasTimeOfDay(kind) {
392
396
  return kind === "datetime" || kind === "dueDatetime";
393
397
  }
@@ -1054,11 +1058,23 @@ function rowAssignControlState(args) {
1054
1058
 
1055
1059
  function rowDateControlState(args) {
1056
1060
  return rowControlState({
1057
- kinds: DATE_FIELD_KINDS,
1061
+ kinds: DUE_DATE_FIELD_KINDS,
1058
1062
  ...args
1059
1063
  });
1060
1064
  }
1061
1065
 
1066
+ function dateValuesOf(state, matches) {
1067
+ return state.filter(entry => matches(entry._type)).map(entry => entry.value).filter(value => typeof value == "string" && value !== "");
1068
+ }
1069
+
1070
+ function datesOf(state) {
1071
+ return dateValuesOf(state, isDateFieldKind);
1072
+ }
1073
+
1074
+ function dueDatesOf(state) {
1075
+ return dateValuesOf(state, isDueDateFieldKind);
1076
+ }
1077
+
1062
1078
  function committedRowFace(row) {
1063
1079
  return {
1064
1080
  activityName: row.activityName,
@@ -1070,7 +1086,11 @@ function committedRowFace(row) {
1070
1086
  }
1071
1087
 
1072
1088
  function activityRowProps(args) {
1073
- const {activityEval: activityEval, activityState: activityState, editableFields: editableFields} = args, state = activityState.get(activityEval.activity.name) ?? [];
1089
+ const {activityEval: activityEval, activityState: activityState, editableFields: editableFields} = args, state = activityState.get(activityEval.activity.name) ?? [], controlArgs = {
1090
+ activity: activityEval.activity,
1091
+ status: activityEval.status,
1092
+ editableFields: editableFields
1093
+ };
1074
1094
  return {
1075
1095
  face: {
1076
1096
  activityName: activityEval.activity.name,
@@ -1079,12 +1099,10 @@ function activityRowProps(args) {
1079
1099
  automated: showsAutomatedPill(activityEval),
1080
1100
  blocked: showsBlockedTag(activityEval)
1081
1101
  },
1082
- assignState: rowAssignControlState({
1083
- activity: activityEval.activity,
1084
- status: activityEval.status,
1085
- editableFields: editableFields
1086
- }),
1102
+ assignState: rowAssignControlState(controlArgs),
1087
1103
  assigneeIds: assigneeUserIdsOf(state),
1104
+ dateState: rowDateControlState(controlArgs),
1105
+ dueDates: dueDatesOf(state),
1088
1106
  terminalActions: rowTerminalActions({
1089
1107
  activityEval: activityEval,
1090
1108
  state: state,
@@ -1094,12 +1112,12 @@ function activityRowProps(args) {
1094
1112
  }
1095
1113
 
1096
1114
  function dateControlKind(state) {
1097
- if (state.kind === "editable" && isDateFieldKind(state.field.type)) return state.field.type;
1115
+ if (state.kind === "editable" && isDueDateFieldKind(state.field.type)) return state.field.type;
1098
1116
  }
1099
1117
 
1100
1118
  function dateControlValue(args) {
1101
- const {state: state, dates: dates} = args;
1102
- return state.kind === "editable" ? typeof state.field.value == "string" && state.field.value !== "" ? state.field.value : void 0 : dates.find(value => parseStoredDateValue(value) !== void 0);
1119
+ const {state: state, dueDates: dueDates} = args;
1120
+ return state.kind === "editable" ? typeof state.field.value == "string" && state.field.value !== "" ? state.field.value : void 0 : dueDates.find(value => parseStoredDateValue(value) !== void 0);
1103
1121
  }
1104
1122
 
1105
1123
  function activityStateOf(instance, activityName) {
@@ -1166,7 +1184,7 @@ function useWorkflowInstanceEntry(instanceId, options = {}) {
1166
1184
 
1167
1185
  const WorkflowToolOpened = defineEvent({
1168
1186
  name: "Editorial Workflows Studio Plugin Tool Opened",
1169
- version: 1,
1187
+ version: 2,
1170
1188
  description: "The Workflows tool was opened or its tab was switched"
1171
1189
  }), WorkflowDocumentViewOpened = defineEvent({
1172
1190
  name: "Editorial Workflows Studio Plugin Document View Opened",
@@ -1188,14 +1206,14 @@ function definitionFingerprint(definition) {
1188
1206
  const WorkflowDefinitionDetailViewed = defineEvent({
1189
1207
  name: "Editorial Workflows Studio Plugin Definition Detail Viewed",
1190
1208
  version: 1,
1191
- description: "The Workflows tool's per-definition detail view was opened"
1209
+ description: "A workflow's definition page was opened in the Workflows tool"
1192
1210
  }), WorkflowFormStripClicked = defineEvent({
1193
1211
  name: "Editorial Workflows Studio Plugin Form Strip Clicked",
1194
1212
  version: 1,
1195
1213
  description: "The form strip's instance line was clicked, opening the document view"
1196
1214
  }), WorkflowDocumentLinkClicked = defineEvent({
1197
1215
  name: "Editorial Workflows Studio Plugin Document Link Clicked",
1198
- version: 1,
1216
+ version: 2,
1199
1217
  description: "A document link was clicked, opening the referenced document's editor"
1200
1218
  }), WorkflowStartDialogOpened = defineEvent({
1201
1219
  name: "Editorial Workflows Studio Plugin Start Dialog Opened",
@@ -1227,12 +1245,8 @@ const WorkflowDefinitionDetailViewed = defineEvent({
1227
1245
  description: "The tool's task-filter menu closed with a changed selection"
1228
1246
  }), WorkflowBoardWorkflowSelected = defineEvent({
1229
1247
  name: "Editorial Workflows Studio Plugin Board Workflow Selected",
1230
- version: 1,
1231
- description: "The Documents board settled on a workflow to show"
1232
- }), WorkflowBoardLayoutChanged = defineEvent({
1233
- name: "Editorial Workflows Studio Plugin Board Layout Changed",
1234
- version: 1,
1235
- description: "The Documents board's layout was switched"
1248
+ version: 2,
1249
+ description: "The workflow documents page settled on the workflow it's showing"
1236
1250
  }), WorkflowTitleSeedDrifted = defineEvent({
1237
1251
  name: "Editorial Workflows Studio Plugin Title Seed Drifted",
1238
1252
  version: 1,
@@ -1245,6 +1259,14 @@ const WorkflowDefinitionDetailViewed = defineEvent({
1245
1259
  name: "Editorial Workflows Studio Plugin Todo Edited",
1246
1260
  version: 1,
1247
1261
  description: "A non-toggle todo-list write, attributed to its UI surface and gesture"
1262
+ }), WorkflowAbortDialogOpened = defineEvent({
1263
+ name: "Editorial Workflows Studio Plugin Abort Dialog Opened",
1264
+ version: 1,
1265
+ description: "The abort-workflow confirm was opened"
1266
+ }), WorkflowAbortDialogSubmitted = defineEvent({
1267
+ name: "Editorial Workflows Studio Plugin Abort Dialog Submitted",
1268
+ version: 1,
1269
+ description: "The abort-workflow confirm was submitted, carrying the attempt's outcome"
1248
1270
  });
1249
1271
 
1250
1272
  function useLogEventOnMount(event, data) {
@@ -1479,9 +1501,50 @@ function buildParams(decls, values) {
1479
1501
  };
1480
1502
  }
1481
1503
 
1482
- const NEVER_MS = 2 ** 31 - 1;
1504
+ function useDelayedFlag(active, delayMs) {
1505
+ const [held, setHeld] = useState(!1);
1506
+ return useEffect(() => {
1507
+ if (!active) {
1508
+ setHeld(!1);
1509
+ return;
1510
+ }
1511
+ const timer = setTimeout(() => setHeld(!0), delayMs);
1512
+ return () => clearTimeout(timer);
1513
+ }, [ active, delayMs ]), held && active;
1514
+ }
1515
+
1516
+ const NEVER_MS = 2 ** 31 - 1, OPEN_DELAY_MS = 300;
1483
1517
 
1484
1518
  function HoverHint(props) {
1519
+ return props.anchor !== void 0 ? /* @__PURE__ */ jsx(AnchoredHint, {
1520
+ ...props
1521
+ }) : /* @__PURE__ */ jsx(WrappingHint, {
1522
+ ...props
1523
+ });
1524
+ }
1525
+
1526
+ function AnchoredHint(props) {
1527
+ const {disabled: disabled = !1} = props, open = useDelayedFlag(props.open === !0 && !disabled, OPEN_DELAY_MS);
1528
+ /* @__PURE__ */
1529
+ return jsx(Popover, {
1530
+ animate: !0,
1531
+ content: /* @__PURE__ */ jsx(HintBody, {
1532
+ ...props
1533
+ }),
1534
+ open: open,
1535
+ padding: hintPadding(props),
1536
+ placement: props.placement ?? "top",
1537
+ portal: !0,
1538
+ radius: 3,
1539
+ referenceElement: props.anchor
1540
+ });
1541
+ }
1542
+
1543
+ function hintPadding(props) {
1544
+ return props.content !== void 0 && props.flush ? 0 : 2;
1545
+ }
1546
+
1547
+ function WrappingHint(props) {
1485
1548
  const {children: children, disabled: disabled = !1} = props;
1486
1549
  /* @__PURE__ */
1487
1550
  return jsx(Tooltip, {
@@ -1491,10 +1554,10 @@ function HoverHint(props) {
1491
1554
  }),
1492
1555
  delay: {
1493
1556
  close: 0,
1494
- open: disabled ? NEVER_MS : 300
1557
+ open: disabled ? NEVER_MS : OPEN_DELAY_MS
1495
1558
  },
1496
- padding: props.content !== void 0 && props.flush ? 0 : 2,
1497
- placement: "top",
1559
+ padding: hintPadding(props),
1560
+ placement: props.placement ?? "top",
1498
1561
  portal: !0,
1499
1562
  radius: 3,
1500
1563
  children: /* @__PURE__ */ jsx(Box, {
@@ -2612,18 +2675,6 @@ function FieldInput$1({kind: kind, value: value, onChange: onChange, onEnter: on
2612
2675
  }
2613
2676
  }
2614
2677
 
2615
- function useDelayedFlag(active, delayMs) {
2616
- const [held, setHeld] = useState(!1);
2617
- return useEffect(() => {
2618
- if (!active) {
2619
- setHeld(!1);
2620
- return;
2621
- }
2622
- const timer = setTimeout(() => setHeld(!0), delayMs);
2623
- return () => clearTimeout(timer);
2624
- }, [ active, delayMs ]), held && active;
2625
- }
2626
-
2627
2678
  function isCompact(layout) {
2628
2679
  return layout === "inline" || layout === "row";
2629
2680
  }
@@ -4001,39 +4052,12 @@ function ActivityStatusIcon({status: status}) {
4001
4052
  });
4002
4053
  }
4003
4054
 
4004
- function LoadingRow({label: label, padding: padding}) {
4005
- /* @__PURE__ */
4006
- return jsxs(Flex, {
4007
- align: "center",
4008
- gap: 2,
4009
- ...padding === void 0 ? {} : {
4010
- padding: padding
4011
- },
4012
- children: [
4013
- /* @__PURE__ */ jsx(Spinner, {
4014
- muted: !0,
4015
- size: 1
4016
- }),
4017
- /* @__PURE__ */ jsx(Text, {
4018
- muted: !0,
4019
- size: 1,
4020
- children: label
4021
- }) ]
4022
- });
4023
- }
4024
-
4025
4055
  function useSpaceToken(index) {
4026
4056
  const value = useTheme_v2().space[index];
4027
4057
  if (value === void 0) throw new Error(`theme is missing space token ${index}`);
4028
4058
  return value;
4029
4059
  }
4030
4060
 
4031
- function useRadiusToken(index) {
4032
- const value = useTheme_v2().radius[index];
4033
- if (value === void 0) throw new Error(`theme is missing radius token ${index}`);
4034
- return value;
4035
- }
4036
-
4037
4061
  function useContainerToken(index) {
4038
4062
  const value = useTheme_v2().container[index];
4039
4063
  if (value === void 0) throw new Error(`theme is missing container token ${index}`);
@@ -4074,6 +4098,46 @@ function useBadgeCapTrim() {
4074
4098
  };
4075
4099
  }
4076
4100
 
4101
+ function SpinnerSlot({busy: busy}) {
4102
+ const size = useTextIconSize(), trim = useCapTrimFor(size);
4103
+ /* @__PURE__ */
4104
+ return jsx(Flex, {
4105
+ align: "center",
4106
+ flex: "none",
4107
+ justify: "center",
4108
+ style: {
4109
+ height: size,
4110
+ marginBottom: trim,
4111
+ marginTop: trim,
4112
+ width: size
4113
+ },
4114
+ children: busy ? /* @__PURE__ */ jsx(Spinner, {
4115
+ muted: !0,
4116
+ size: 1
4117
+ }) : null
4118
+ });
4119
+ }
4120
+
4121
+ function LoadingRow({label: label, padding: padding}) {
4122
+ /* @__PURE__ */
4123
+ return jsxs(Flex, {
4124
+ align: "center",
4125
+ gap: 2,
4126
+ ...padding === void 0 ? {} : {
4127
+ padding: padding
4128
+ },
4129
+ children: [
4130
+ /* @__PURE__ */ jsx(SpinnerSlot, {
4131
+ busy: !0
4132
+ }),
4133
+ /* @__PURE__ */ jsx(Text, {
4134
+ muted: !0,
4135
+ size: 1,
4136
+ children: label
4137
+ }) ]
4138
+ });
4139
+ }
4140
+
4077
4141
  function AvatarDisplay({avatar: avatar, "aria-label": ariaLabel}) {
4078
4142
  const trim = useAvatarCapTrim();
4079
4143
  /* @__PURE__ */
@@ -5342,26 +5406,6 @@ function CountedLabel({count: count, label: label}) {
5342
5406
  });
5343
5407
  }
5344
5408
 
5345
- function SpinnerSlot({busy: busy}) {
5346
- const size = useTextIconSize(), trim = useCapTrimFor(size);
5347
- /* @__PURE__ */
5348
- return jsx(Flex, {
5349
- align: "center",
5350
- flex: "none",
5351
- justify: "center",
5352
- style: {
5353
- height: size,
5354
- marginBottom: trim,
5355
- marginTop: trim,
5356
- width: size
5357
- },
5358
- children: busy ? /* @__PURE__ */ jsx(Spinner, {
5359
- muted: !0,
5360
- size: 1
5361
- }) : null
5362
- });
5363
- }
5364
-
5365
5409
  function GroupHeading({busy: busy, count: count, title: title, end: end}) {
5366
5410
  /* @__PURE__ */
5367
5411
  return jsxs(Flex, {
@@ -5388,6 +5432,92 @@ function GroupHeading({busy: busy, count: count, title: title, end: end}) {
5388
5432
  });
5389
5433
  }
5390
5434
 
5435
+ function ActivityDateControl({instanceId: instanceId, state: state, surface: surface, dueDates: dueDates}) {
5436
+ const editField = useEditField(surface), {save: save} = useSaveField({
5437
+ instanceId: instanceId
5438
+ }), [open, setOpen] = useState(!1), raw = dateControlValue({
5439
+ state: state,
5440
+ dueDates: dueDates
5441
+ }), display = raw === void 0 ? null : /* @__PURE__ */ jsx(Text, {
5442
+ muted: !0,
5443
+ size: 1,
5444
+ children: formatDate(raw)
5445
+ });
5446
+ if (state.kind === "none") return display;
5447
+ if (state.kind === "closed") return display === null ? null : /* @__PURE__ */ jsx(HoverHint, {
5448
+ text: state.reason,
5449
+ children: /* @__PURE__ */ jsx(Button, {
5450
+ "aria-label": "Date",
5451
+ as: "span",
5452
+ fontSize: 1,
5453
+ mode: "bleed",
5454
+ onClick: stopRowClick,
5455
+ onMouseDown: stopRowMouseDown,
5456
+ padding: 2,
5457
+ children: display
5458
+ })
5459
+ });
5460
+ const kind = dateControlKind(state), commit = (mode, value) => {
5461
+ state.kind === "editable" && save(() => editField({
5462
+ instanceId: instanceId,
5463
+ field: state.field,
5464
+ ...mode === "set" ? {
5465
+ mode: mode,
5466
+ value: value
5467
+ } : {
5468
+ mode: mode
5469
+ }
5470
+ }));
5471
+ }, handleClick = e => {
5472
+ e.stopPropagation(), setOpen(v => !v);
5473
+ };
5474
+ /* @__PURE__ */
5475
+ return jsx(DismissablePopover, {
5476
+ content: /* @__PURE__ */ jsx(Box, {
5477
+ onClick: stopRowClick,
5478
+ children: state.kind === "loading" || kind === void 0 ? /* @__PURE__ */ jsx(LoadingRow, {
5479
+ label: "Loading…",
5480
+ padding: 3
5481
+ }) : /* @__PURE__ */ jsx(ClearableDatePicker, {
5482
+ clearLabel: "Clear date",
5483
+ onClear: () => {
5484
+ setOpen(!1), commit("unset");
5485
+ },
5486
+ onPick: next => {
5487
+ hasTimeOfDay(kind) || setOpen(!1), commit("set", serializeDateFieldValue(next, kind));
5488
+ },
5489
+ selectTime: hasTimeOfDay(kind),
5490
+ value: parseDateFieldValue(state.field.value, kind)
5491
+ })
5492
+ }),
5493
+ onDismiss: () => setOpen(!1),
5494
+ open: open,
5495
+ children: display ? /* @__PURE__ */ jsx(Button, {
5496
+ "aria-label": "Change date",
5497
+ as: "span",
5498
+ fontSize: 1,
5499
+ mode: "bleed",
5500
+ onClick: handleClick,
5501
+ onMouseDown: stopRowMouseDown,
5502
+ padding: 2,
5503
+ children: display
5504
+ }) : /* @__PURE__ */ jsx(HoverHint, {
5505
+ disabled: open,
5506
+ text: "Set date",
5507
+ children: /* @__PURE__ */ jsx(Button, {
5508
+ "aria-label": "Set date",
5509
+ as: "span",
5510
+ fontSize: 1,
5511
+ icon: CalendarIcon,
5512
+ mode: "bleed",
5513
+ onClick: handleClick,
5514
+ onMouseDown: stopRowMouseDown,
5515
+ padding: 2
5516
+ })
5517
+ })
5518
+ });
5519
+ }
5520
+
5391
5521
  function settledDim(settled) {
5392
5522
  return settled ? {
5393
5523
  opacity: .66
@@ -5460,7 +5590,7 @@ function TitleTag({hint: hint, tone: tone, children: children}) {
5460
5590
  });
5461
5591
  }
5462
5592
 
5463
- function ActivityRow({face: face, breadcrumb: breadcrumb, assigneeIds: assigneeIds, assignState: assignState, dateControl: dateControl, instanceId: instanceId, onOpen: onOpen, surface: surface, terminalActions: terminalActions = []}) {
5593
+ function ActivityRow({face: face, breadcrumb: breadcrumb, assigneeIds: assigneeIds, assignState: assignState, dateState: dateState, dueDates: dueDates, instanceId: instanceId, onOpen: onOpen, surface: surface, terminalActions: terminalActions = []}) {
5464
5594
  const settled = isTerminalActivityStatus(face.status), dimmed = settledDim(settled);
5465
5595
  /* @__PURE__ */
5466
5596
  return jsxs(WorkRow, {
@@ -5470,7 +5600,13 @@ function ActivityRow({face: face, breadcrumb: breadcrumb, assigneeIds: assigneeI
5470
5600
  activity: face.activityName,
5471
5601
  instanceId: instanceId,
5472
5602
  surface: surface
5473
- }), dateControl,
5603
+ }),
5604
+ /* @__PURE__ */ jsx(ActivityDateControl, {
5605
+ dueDates: dueDates,
5606
+ instanceId: instanceId,
5607
+ state: dateState,
5608
+ surface: surface
5609
+ }),
5474
5610
  /* @__PURE__ */ jsx(AssignActivityControl, {
5475
5611
  assigneeIds: assigneeIds,
5476
5612
  instanceId: instanceId,
@@ -7164,18 +7300,16 @@ function coveredFieldNames(ctx) {
7164
7300
  return release && names.add(release.name), names;
7165
7301
  }
7166
7302
 
7167
- const OPTIONAL_INIT_KINDS = /* @__PURE__ */ new Set([ "array", "assignees", "doc.refs" ]);
7168
-
7169
7303
  function inputInitFields(args) {
7170
7304
  return (args.definition?.fields ?? []).filter(entry => entry.initialValue?.type === "input" && !args.covered.has(entry.name));
7171
7305
  }
7172
7306
 
7173
- function gatesStart(entry) {
7174
- return !OPTIONAL_INIT_KINDS.has(entry.type);
7307
+ function isRequiredEntry(entry) {
7308
+ return entry.required === !0;
7175
7309
  }
7176
7310
 
7177
7311
  function missingInitFields(initFields, values) {
7178
- return initFields.filter(entry => gatesStart(entry) && !isFieldFilled(entry, values[entry.name] ?? null));
7312
+ return initFields.filter(entry => isRequiredEntry(entry) && !isFieldFilled(entry, values[entry.name] ?? null));
7179
7313
  }
7180
7314
 
7181
7315
  function numericFilled(value) {
@@ -8052,7 +8186,7 @@ function WorkflowsPanel({entries: entries, documentId: documentId, docTypeMappin
8052
8186
  children: /* @__PURE__ */ jsx(Flex, {
8053
8187
  direction: "column",
8054
8188
  flex: 1,
8055
- children: view === "overview" ? /* @__PURE__ */ jsx(OverviewTab, {
8189
+ children: view === "overview" ? /* @__PURE__ */ jsx(OverviewSections, {
8056
8190
  active: active,
8057
8191
  empty: /* @__PURE__ */ jsx(OverviewEmptyState, {
8058
8192
  docId: documentId,
@@ -8076,7 +8210,7 @@ function WorkflowsPanel({entries: entries, documentId: documentId, docTypeMappin
8076
8210
  });
8077
8211
  }
8078
8212
 
8079
- function OverviewTab({active: active, empty: empty, finished: finished, sectionFor: sectionFor}) {
8213
+ function OverviewSections({active: active, empty: empty, finished: finished, sectionFor: sectionFor}) {
8080
8214
  /* @__PURE__ */
8081
8215
  return jsxs(Stack, {
8082
8216
  gap: 5,
@@ -9296,7 +9430,7 @@ function InitFieldRow({entry: entry, docType: docType, releaseId: releaseId, val
9296
9430
  /* @__PURE__ */ jsx(Text, {
9297
9431
  size: 1,
9298
9432
  weight: "medium",
9299
- children: gatesStart(entry) ? `${label} (Required)` : label
9433
+ children: isRequiredEntry(entry) ? `${label} (Required)` : label
9300
9434
  }), entry.description ? /* @__PURE__ */ jsx(Text, {
9301
9435
  muted: !0,
9302
9436
  size: 1,
@@ -10158,6 +10292,103 @@ function StartWorkflowDialogHost() {
10158
10292
  }, `${startRequest2.definition}:${startRequest2.subjectDocId ?? ""}`) : null;
10159
10293
  }
10160
10294
 
10295
+ const TOOL_TAB_LABELS = {
10296
+ overview: "Workflows",
10297
+ "all-documents": "All documents",
10298
+ "for-me": "For me"
10299
+ }, TOOL_TAB_VALUES = Object.keys(TOOL_TAB_LABELS), TOOL_TABS = TOOL_TAB_VALUES.map(value => ({
10300
+ value: value,
10301
+ label: TOOL_TAB_LABELS[value]
10302
+ })), LANDING_TAB = "overview", TASKS_TAB = "all-documents", WORKFLOW_PAGE_LABELS = {
10303
+ workflow: "Documents",
10304
+ definition: "Definition"
10305
+ }, WORKFLOW_PAGE_VALUES = Object.keys(WORKFLOW_PAGE_LABELS), DEFAULT_WORKFLOW_PAGE = "workflow", WORKFLOW_PAGES = WORKFLOW_PAGE_VALUES.filter(page => page !== DEFAULT_WORKFLOW_PAGE), WORKFLOW_PAGE_TABS = WORKFLOW_PAGE_VALUES.map(value => ({
10306
+ value: value,
10307
+ label: WORKFLOW_PAGE_LABELS[value]
10308
+ })), toolRouter = route.create("/", [ route.create("/instance/:instanceId"), route.create(`/${LANDING_TAB}/:workflowName`, [ route.create("/:workflowPage") ]), route.create("/:workflowsTab") ]);
10309
+
10310
+ function toolTabState(tab) {
10311
+ return {
10312
+ workflowsTab: tab
10313
+ };
10314
+ }
10315
+
10316
+ function landingState() {
10317
+ return toolTabState(LANDING_TAB);
10318
+ }
10319
+
10320
+ function workflowState(workflowName) {
10321
+ return {
10322
+ workflowName: workflowName
10323
+ };
10324
+ }
10325
+
10326
+ function instanceState(instanceId) {
10327
+ return {
10328
+ instanceId: instanceId
10329
+ };
10330
+ }
10331
+
10332
+ function tabSelectionNavigates(current, tab) {
10333
+ return !(current.kind === "home" && tab === current.tab);
10334
+ }
10335
+
10336
+ function toolTabLabel(tab) {
10337
+ return TOOL_TAB_LABELS[tab];
10338
+ }
10339
+
10340
+ function backToTabLabel(tab) {
10341
+ return `Back to ${toolTabLabel(tab)}`;
10342
+ }
10343
+
10344
+ function workflowPageState(page, workflowName) {
10345
+ return page === DEFAULT_WORKFLOW_PAGE ? workflowState(workflowName) : {
10346
+ ...workflowState(workflowName),
10347
+ workflowPage: page
10348
+ };
10349
+ }
10350
+
10351
+ function toolRoute(state) {
10352
+ const {instanceId: instanceId, workflowName: workflowName} = state;
10353
+ if (typeof instanceId == "string") return {
10354
+ kind: "instance",
10355
+ instanceId: instanceId,
10356
+ tab: TASKS_TAB
10357
+ };
10358
+ if (typeof workflowName == "string") return workflowRoute(workflowName, state.workflowPage);
10359
+ const tab = pathSegmentName({
10360
+ segment: state.workflowsTab,
10361
+ names: TOOL_TAB_VALUES
10362
+ });
10363
+ return tab === void 0 ? {
10364
+ kind: "unnamed",
10365
+ tab: LANDING_TAB
10366
+ } : {
10367
+ kind: "home",
10368
+ tab: tab
10369
+ };
10370
+ }
10371
+
10372
+ function workflowRoute(workflowName, pageSegment) {
10373
+ if (pageSegment === void 0) return {
10374
+ kind: "workflow",
10375
+ workflowName: workflowName,
10376
+ tab: LANDING_TAB
10377
+ };
10378
+ const page = pathSegmentName({
10379
+ segment: pageSegment,
10380
+ names: WORKFLOW_PAGES
10381
+ });
10382
+ return page === void 0 ? {
10383
+ kind: "unnamed",
10384
+ tab: LANDING_TAB
10385
+ } : {
10386
+ kind: page,
10387
+ workflowName: workflowName,
10388
+ tab: LANDING_TAB
10389
+ };
10390
+ }
10391
+
10161
10392
  const WorkflowsToolRoot = lazy(() => import("./workflows-tool-root.js"));
10162
10393
 
10163
10394
  function LazyWorkflowsTool() {
@@ -10173,7 +10404,7 @@ const workflowsTool = {
10173
10404
  title: "Workflows",
10174
10405
  icon: TransferIcon,
10175
10406
  component: LazyWorkflowsTool,
10176
- router: route.create("/", [ route.create("/instance/:instanceId"), route.create("/definition/:definitionName"), route.create("/documents/:boardDefinition"), route.create("/:workflowsTab") ]),
10407
+ router: toolRouter,
10177
10408
  canHandleIntent: (intent, params) => handlesWorkflowIntent(intent, params),
10178
10409
  getIntentState: (intent, params) => workflowIntentState(intent, params)
10179
10410
  }, LOCKABLE_ACTIONS = /* @__PURE__ */ new Map([ [ "delete", "delete" ], [ "publish", "publish" ], [ "unpublish", "unpublish" ] ]);
@@ -10267,4 +10498,4 @@ function WorkflowRootInput(props) {
10267
10498
  });
10268
10499
  }
10269
10500
 
10270
- export { ActivityDetailDialog, ActivityRow, BreadcrumbTail, CautionNote, CollapsibleBand, CountedLabel, DismissablePopover, DocPreviewLink, DocRefFace, EmptyState, ForMeEmptyState, HintedMenuButton, HoverHint, InstanceSnapshotBody, InvalidDocNotice, LinkChip, LoadingRow, LogEventOnMount, MetaRow, NOTICE_PADDING, SpinnerSlot, StageFace, StaleLock, TOAST_ID, TabSwitch, TrailingHairline, UnreadableDocsNote, UserAvatar, WORKFLOW_API_VERSION, WorkflowBoardLayoutChanged, WorkflowBoardWorkflowSelected, WorkflowDefinitionDetailViewed, WorkflowInstanceDetailViewed, WorkflowTaskFiltersApplied, WorkflowTitleSeedDrifted, WorkflowToolOpened, activityRowProps, assigneeUserIdsOf, chipPadding, committedRowFace, createSubscribers, dateControlKind, dateControlValue, definitionFingerprint, definitionSnapshotOf, describeError, findActivity, findActivityNode, formatDate, formatDateTime, formatShortAgo, formatShortDateTime, formatTimeAgo, gdrLocality, hasTimeOfDay, instanceBreadcrumb, instanceTitle, isActivityAssignedTo, isDateFieldKind, isEvaluationStale, isLiveEntry, isOpenActivityStatus, mappingIssueDetail, namesNoDeployedDefinition, openActivityGone, openableSchemaType, parseDateFieldValue, parseStoredDateValue, pathSegmentTab, readDeployedDefinitions, rowAssignControlState, rowDateControlState, serializeDateFieldValue, stageTitle, stateByActivity, stopRowClick, stopRowMouseDown, useAssignmentIdentity, useAvatarSize, useBadgeCapTrim, useContainerToken, useDefinition, useDelayedFlag, useEditField, useLogEventOnMount, useProjectMembers, useRadiusToken, useSaveField, useSpaceToken, useUserDisplay, useUserDisplays, useWorkflowContext, useWorkflowInstanceEntry, useWorkflowToast, workflowDefaultDocumentNode, workflowStudioPlugin, workflowsView };
10501
+ export { ActivityDetailDialog, ActivityRow, BreadcrumbTail, CautionNote, CollapsibleBand, CountedLabel, DismissablePopover, DocPreviewLink, DocRefFace, EmptyState, ForMeEmptyState, Hairline, HintedMenuButton, HoverHint, InstanceSnapshotBody, InvalidDocNotice, LinkChip, LoadingRow, LogEventOnMount, MetaRow, SpinnerSlot, StageFace, StaleLock, TOAST_ID, TOOL_TABS, TabSwitch, TrailingHairline, UnreadableDocsNote, UserAvatar, WORKFLOW_API_VERSION, WORKFLOW_PAGE_TABS, WorkflowAbortDialogOpened, WorkflowAbortDialogSubmitted, WorkflowBoardWorkflowSelected, WorkflowDefinitionDetailViewed, WorkflowInstanceDetailViewed, WorkflowTaskFiltersApplied, WorkflowTitleSeedDrifted, WorkflowToolOpened, activityRowProps, assigneeUserIdsOf, backToTabLabel, committedRowFace, createSubscribers, datesOf, definitionFingerprint, definitionSnapshotOf, describeError, dueDatesOf, findActivity, findActivityNode, formatDate, formatDateTime, formatShortAgo, formatShortDateTime, formatTimeAgo, gdrLocality, instanceBreadcrumb, instanceState, instanceTitle, isActivityAssignedTo, isEvaluationStale, isLiveEntry, isOpenActivityStatus, landingState, mappingIssueDetail, namesNoDeployedDefinition, openActivityGone, openableSchemaType, parseStoredDateValue, readDeployedDefinitions, rowAssignControlState, rowDateControlState, stageTitle, stateByActivity, tabSelectionNavigates, toolRoute, toolTabState, useAssignmentIdentity, useAvatarSize, useBadgeCapTrim, useContainerToken, useDefinition, useDelayedFlag, useLogEventOnMount, useProjectMembers, useSpaceToken, useUserDisplay, useUserDisplays, useWorkflowContext, useWorkflowInstanceEntry, useWorkflowToast, workflowDefaultDocumentNode, workflowPageState, workflowState, workflowStudioPlugin, workflowsView };