@expcat/tigercat-react 2.2.0 → 2.3.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.
@@ -0,0 +1,138 @@
1
+ import {
2
+ Timeline
3
+ } from "./chunk-4DFN6RZ4.mjs";
4
+ import {
5
+ Tag
6
+ } from "./chunk-FVA5VKN2.mjs";
7
+ import {
8
+ Button
9
+ } from "./chunk-WFLXJOFU.mjs";
10
+
11
+ // src/components/WorkflowTimeline.tsx
12
+ import { useMemo } from "react";
13
+ import {
14
+ classNames,
15
+ resolveWorkflowActionButtonProps,
16
+ shouldShowWorkflowActions,
17
+ timelineDescriptionClasses,
18
+ timelineLabelClasses,
19
+ workflowStepsToTimelineItems,
20
+ workflowStepStatusLabel,
21
+ workflowStepStatusTagVariant
22
+ } from "@expcat/tigercat-core";
23
+ import { jsx, jsxs } from "react/jsx-runtime";
24
+ var workflowTimelineRootClasses = "flex flex-col gap-4";
25
+ var workflowActionBarClasses = "flex flex-wrap items-center gap-2";
26
+ var workflowStepHeaderClasses = "flex flex-wrap items-center gap-2";
27
+ var workflowStepActorClasses = "text-sm text-[var(--tiger-text-muted,#6b7280)]";
28
+ var workflowStepCommentClasses = "text-sm text-[var(--tiger-text-secondary,#4b5563)] mt-1";
29
+ function isWorkflowTimelineItem(item) {
30
+ return typeof item === "object" && item != null && "step" in item && "status" in item && typeof item.status === "string";
31
+ }
32
+ function renderStepContent(item) {
33
+ const step = item.step;
34
+ const title = step.title ?? step.label;
35
+ const statusLabel = workflowStepStatusLabel(item.status);
36
+ return /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
37
+ step.time ? /* @__PURE__ */ jsx("div", { className: timelineLabelClasses, children: step.time }) : null,
38
+ /* @__PURE__ */ jsxs("div", { className: workflowStepHeaderClasses, children: [
39
+ title ? /* @__PURE__ */ jsx("div", { className: timelineDescriptionClasses, children: title }) : null,
40
+ /* @__PURE__ */ jsx(Tag, { variant: workflowStepStatusTagVariant(item.status), size: "sm", pill: true, children: statusLabel })
41
+ ] }),
42
+ step.actor?.name ? /* @__PURE__ */ jsx("div", { className: workflowStepActorClasses, children: step.actor.name }) : null,
43
+ step.comment ? /* @__PURE__ */ jsx("div", { className: workflowStepCommentClasses, children: step.comment }) : null
44
+ ] });
45
+ }
46
+ var WorkflowActionBar = ({
47
+ items,
48
+ disabled,
49
+ ariaLabel,
50
+ className,
51
+ style,
52
+ onAction,
53
+ "aria-label": ariaLabelAttr,
54
+ ...rest
55
+ }) => {
56
+ const toolbarClasses = useMemo(() => classNames(workflowActionBarClasses, className), [className]);
57
+ return /* @__PURE__ */ jsx(
58
+ "div",
59
+ {
60
+ ...rest,
61
+ className: toolbarClasses,
62
+ style,
63
+ role: "toolbar",
64
+ "aria-label": ariaLabel ?? ariaLabelAttr ?? "Workflow actions",
65
+ children: (items ?? []).map((item) => {
66
+ const buttonProps = resolveWorkflowActionButtonProps(item);
67
+ const isDisabled = Boolean(disabled || item.disabled);
68
+ return /* @__PURE__ */ jsx(
69
+ Button,
70
+ {
71
+ size: "sm",
72
+ variant: buttonProps.variant,
73
+ danger: buttonProps.danger,
74
+ disabled: isDisabled,
75
+ onClick: () => {
76
+ if (isDisabled) return;
77
+ onAction?.(item);
78
+ },
79
+ children: item.label
80
+ },
81
+ item.key
82
+ );
83
+ })
84
+ }
85
+ );
86
+ };
87
+ var WorkflowTimeline = ({
88
+ steps,
89
+ actions,
90
+ showActions,
91
+ mode = "left",
92
+ pending = false,
93
+ pendingDot,
94
+ pendingContent,
95
+ reverse = false,
96
+ className,
97
+ style,
98
+ onAction,
99
+ renderItem,
100
+ renderDot,
101
+ renderActions,
102
+ "aria-label": ariaLabel,
103
+ ...rest
104
+ }) => {
105
+ const timelineItems = useMemo(() => workflowStepsToTimelineItems(steps), [steps]);
106
+ const showActionBar = shouldShowWorkflowActions(steps, actions, showActions);
107
+ const rootClasses = useMemo(() => classNames(workflowTimelineRootClasses, className), [className]);
108
+ const handleRenderItem = (item, index) => {
109
+ if (renderItem) return renderItem(item, index);
110
+ if (isWorkflowTimelineItem(item)) return renderStepContent(item);
111
+ return null;
112
+ };
113
+ const actionBar = showActionBar && actions ? renderActions ? renderActions(actions) : /* @__PURE__ */ jsx(WorkflowActionBar, { items: actions, onAction }) : null;
114
+ return /* @__PURE__ */ jsxs("div", { ...rest, className: rootClasses, style, children: [
115
+ /* @__PURE__ */ jsx(
116
+ Timeline,
117
+ {
118
+ items: timelineItems,
119
+ mode,
120
+ pending,
121
+ pendingDot,
122
+ pendingContent,
123
+ reverse,
124
+ renderItem: handleRenderItem,
125
+ renderDot,
126
+ "aria-label": ariaLabel ?? "Workflow timeline"
127
+ }
128
+ ),
129
+ actionBar
130
+ ] });
131
+ };
132
+ var WorkflowTimeline_default = WorkflowTimeline;
133
+
134
+ export {
135
+ WorkflowActionBar,
136
+ WorkflowTimeline,
137
+ WorkflowTimeline_default
138
+ };
@@ -4,7 +4,7 @@ import { BadgeProps as BadgeProps$1 } from '@expcat/tigercat-core';
4
4
  type BadgeProps = BadgeProps$1 & Omit<React__default.HTMLAttributes<HTMLSpanElement>, 'children' | 'content'> & {
5
5
  children?: React__default.ReactNode;
6
6
  };
7
- declare const Badge: React__default.ForwardRefExoticComponent<BadgeProps$1 & Omit<React__default.HTMLAttributes<HTMLSpanElement>, "children" | "content"> & {
7
+ declare const Badge: React__default.ForwardRefExoticComponent<BadgeProps$1 & Omit<React__default.HTMLAttributes<HTMLSpanElement>, "content" | "children"> & {
8
8
  children?: React__default.ReactNode;
9
9
  } & React__default.RefAttributes<HTMLSpanElement>>;
10
10
 
@@ -16,7 +16,7 @@ type PopconfirmProps = Omit<PopconfirmProps$1, 'style' | 'placement' | 'onConfir
16
16
  className?: string;
17
17
  style?: React__default.CSSProperties;
18
18
  };
19
- declare const Popconfirm: React__default.ForwardRefExoticComponent<Omit<PopconfirmProps$1, "style" | "placement" | "onCancel" | "onConfirm"> & Omit<React__default.HTMLAttributes<HTMLDivElement>, "children" | "className" | "style" | "title"> & {
19
+ declare const Popconfirm: React__default.ForwardRefExoticComponent<Omit<PopconfirmProps$1, "style" | "placement" | "onCancel" | "onConfirm"> & Omit<React__default.HTMLAttributes<HTMLDivElement>, "className" | "style" | "title" | "children"> & {
20
20
  children?: React__default.ReactNode | ((state: {
21
21
  open: boolean;
22
22
  }) => React__default.ReactNode);
@@ -14,7 +14,7 @@ type PopoverProps = Omit<PopoverProps$1, 'style' | 'placement'> & Omit<React__de
14
14
  asChild?: boolean;
15
15
  onOpenChange?: (open: boolean) => void;
16
16
  };
17
- declare const Popover: React__default.ForwardRefExoticComponent<Omit<PopoverProps$1, "style" | "placement"> & Omit<React__default.HTMLAttributes<HTMLDivElement>, "children" | "className" | "style" | "title"> & {
17
+ declare const Popover: React__default.ForwardRefExoticComponent<Omit<PopoverProps$1, "style" | "placement"> & Omit<React__default.HTMLAttributes<HTMLDivElement>, "className" | "style" | "title" | "children"> & {
18
18
  children?: React__default.ReactNode | ((state: {
19
19
  open: boolean;
20
20
  }) => React__default.ReactNode);
@@ -6,6 +6,6 @@ interface SegmentedProps extends SegmentedProps$1 {
6
6
  defaultValue?: string | number;
7
7
  onChange?: (value: string | number) => void;
8
8
  }
9
- declare const Segmented: React__default.ForwardRefExoticComponent<SegmentedProps & Omit<React__default.HTMLAttributes<HTMLDivElement>, "defaultValue" | "onChange"> & React__default.RefAttributes<HTMLDivElement>>;
9
+ declare const Segmented: React__default.ForwardRefExoticComponent<SegmentedProps & Omit<React__default.HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue"> & React__default.RefAttributes<HTMLDivElement>>;
10
10
 
11
11
  export { Segmented, type SegmentedProps };
@@ -6,7 +6,7 @@ type SpaceProps = SpaceProps$1 & Omit<React__default.HTMLAttributes<HTMLDivEleme
6
6
  className?: string;
7
7
  style?: React__default.CSSProperties;
8
8
  };
9
- declare const Space: React__default.ForwardRefExoticComponent<SpaceProps$1 & Omit<React__default.HTMLAttributes<HTMLDivElement>, "children" | "className" | "style"> & {
9
+ declare const Space: React__default.ForwardRefExoticComponent<SpaceProps$1 & Omit<React__default.HTMLAttributes<HTMLDivElement>, "className" | "style" | "children"> & {
10
10
  children?: React__default.ReactNode;
11
11
  className?: string;
12
12
  style?: React__default.CSSProperties;
@@ -6,7 +6,7 @@ type TextProps = TextProps$1 & Omit<React__default.HTMLAttributes<HTMLElement>,
6
6
  locale?: Partial<TigerLocale>;
7
7
  onCopy?: (text: string) => void;
8
8
  };
9
- declare const Text: React__default.ForwardRefExoticComponent<TextProps$1 & Omit<React__default.HTMLAttributes<HTMLElement>, "children" | "color"> & Pick<React__default.LabelHTMLAttributes<HTMLLabelElement>, "htmlFor"> & {
9
+ declare const Text: React__default.ForwardRefExoticComponent<TextProps$1 & Omit<React__default.HTMLAttributes<HTMLElement>, "color" | "children"> & Pick<React__default.LabelHTMLAttributes<HTMLLabelElement>, "htmlFor"> & {
10
10
  children?: React__default.ReactNode;
11
11
  locale?: Partial<TigerLocale>;
12
12
  onCopy?: (text: string) => void;
@@ -11,7 +11,7 @@ type TooltipProps = Omit<TooltipProps$1, 'content' | 'placement'> & Omit<React__
11
11
  asChild?: boolean;
12
12
  onOpenChange?: (open: boolean) => void;
13
13
  };
14
- declare const Tooltip: React__default.ForwardRefExoticComponent<Omit<TooltipProps$1, "content" | "placement"> & Omit<React__default.HTMLAttributes<HTMLDivElement>, "children" | "className" | "style" | "title" | "content"> & {
14
+ declare const Tooltip: React__default.ForwardRefExoticComponent<Omit<TooltipProps$1, "content" | "placement"> & Omit<React__default.HTMLAttributes<HTMLDivElement>, "className" | "style" | "title" | "content" | "children"> & {
15
15
  children?: React__default.ReactNode;
16
16
  content?: React__default.ReactNode;
17
17
  className?: string;
@@ -0,0 +1,20 @@
1
+ import React__default from 'react';
2
+ import { WorkflowActionBarProps as WorkflowActionBarProps$1, WorkflowActionBarItem, WorkflowTimelineProps as WorkflowTimelineProps$1, TimelineItem } from '@expcat/tigercat-core';
3
+
4
+ interface WorkflowActionBarProps extends WorkflowActionBarProps$1, Omit<React__default.HTMLAttributes<HTMLDivElement>, 'children'> {
5
+ onAction?: (item: WorkflowActionBarItem) => void;
6
+ }
7
+ interface WorkflowTimelineProps extends Omit<WorkflowTimelineProps$1, 'pendingDot'>, Omit<React__default.HTMLAttributes<HTMLDivElement>, 'children'> {
8
+ pendingDot?: React__default.ReactNode;
9
+ pendingContent?: React__default.ReactNode;
10
+ onAction?: (item: WorkflowActionBarItem) => void;
11
+ renderItem?: (item: TimelineItem, index: number) => React__default.ReactNode;
12
+ renderDot?: (item: TimelineItem, options: {
13
+ pending: boolean;
14
+ }) => React__default.ReactNode;
15
+ renderActions?: (actions: WorkflowActionBarItem[]) => React__default.ReactNode;
16
+ }
17
+ declare const WorkflowActionBar: React__default.FC<WorkflowActionBarProps>;
18
+ declare const WorkflowTimeline: React__default.FC<WorkflowTimelineProps>;
19
+
20
+ export { WorkflowActionBar, type WorkflowActionBarProps, WorkflowTimeline, type WorkflowTimelineProps, WorkflowTimeline as default };
@@ -0,0 +1,15 @@
1
+ import {
2
+ WorkflowActionBar,
3
+ WorkflowTimeline,
4
+ WorkflowTimeline_default
5
+ } from "../chunk-NCVZCG4W.mjs";
6
+ import "../chunk-4DFN6RZ4.mjs";
7
+ import "../chunk-FVA5VKN2.mjs";
8
+ import "../chunk-WFLXJOFU.mjs";
9
+ import "../chunk-G5NPND2T.mjs";
10
+ import "../chunk-RUIFGSVN.mjs";
11
+ export {
12
+ WorkflowActionBar,
13
+ WorkflowTimeline,
14
+ WorkflowTimeline_default as default
15
+ };
package/dist/index.d.mts CHANGED
@@ -63,6 +63,7 @@ export { ImageAnnotation, ImageAnnotationProps } from './components/ImageAnnotat
63
63
  export { List, ListProps } from './components/List.mjs';
64
64
  export { Descriptions, DescriptionsProps } from './components/Descriptions.mjs';
65
65
  export { Timeline, TimelineProps } from './components/Timeline.mjs';
66
+ export { WorkflowActionBar, WorkflowActionBarProps, WorkflowTimeline, WorkflowTimelineProps } from './components/WorkflowTimeline.mjs';
66
67
  export { Countdown, CountdownProps } from './components/Countdown.mjs';
67
68
  export { Tree, TreeProps } from './components/Tree.mjs';
68
69
  export { Skeleton, SkeletonProps } from './components/Skeleton.mjs';
@@ -172,6 +173,6 @@ import 'react';
172
173
  * React components for Tigercat UI library
173
174
  */
174
175
 
175
- declare const version = "2.2.0";
176
+ declare const version = "2.3.0";
176
177
 
177
178
  export { version };
package/dist/index.mjs CHANGED
@@ -136,6 +136,8 @@ export {
136
136
  EMPTY_TREE_KEYS,
137
137
  EMPTY_VIRTUAL_TABLE_COLUMNS,
138
138
  EMPTY_VIRTUAL_TABLE_ROWS,
139
+ EMPTY_WORKFLOW_ACTION_BAR_ITEMS,
140
+ EMPTY_WORKFLOW_TIMELINE_STEPS,
139
141
  EN_US_DATEPICKER_LOCALE,
140
142
  FORM_VALIDATION_PRESETS,
141
143
  FormValidationCancelledError,
@@ -265,6 +267,11 @@ export {
265
267
  VIEW_TRANSITION_CSS,
266
268
  VIRTUAL_TABLE_HEADER_ROW_HEIGHT,
267
269
  WATERMARK_DEFAULT_INK,
270
+ WORKFLOW_STEP_STATUSES,
271
+ WORKFLOW_STEP_STATUS_COLORS,
272
+ WORKFLOW_STEP_STATUS_LABELS,
273
+ WORKFLOW_STEP_STATUS_TAG_VARIANTS,
274
+ WORKFLOW_TERMINAL_STEP_STATUSES,
268
275
  activateScrollSpyClick,
269
276
  activeOpacityClasses,
270
277
  activePressClasses,
@@ -743,6 +750,7 @@ export {
743
750
  countDecimalPlaces,
744
751
  countLines,
745
752
  countMaskTokens,
753
+ countWorkflowStepsByStatus,
746
754
  countdownBaseClasses,
747
755
  countdownPrefixClasses,
748
756
  countdownSuffixClasses,
@@ -1001,6 +1009,7 @@ export {
1001
1009
  filterHiddenColumns,
1002
1010
  filterHiddenFiles,
1003
1011
  filterMentionOptions,
1012
+ filterMenuByPermission,
1004
1013
  filterMenuItems,
1005
1014
  filterOptions,
1006
1015
  filterTableData,
@@ -1343,6 +1352,7 @@ export {
1343
1352
  getCropperHandleStyle,
1344
1353
  getCurrentActiveTourStep,
1345
1354
  getCurrentTime,
1355
+ getCurrentWorkflowStep,
1346
1356
  getCyclicIndex,
1347
1357
  getDataExportCellValue,
1348
1358
  getDataExportFormatLabel,
@@ -2314,6 +2324,11 @@ export {
2314
2324
  isValidUrl,
2315
2325
  isVirtualTableCellControlTarget,
2316
2326
  isWipExceeded,
2327
+ isWorkflowStepActive,
2328
+ isWorkflowStepPending,
2329
+ isWorkflowStepTerminal,
2330
+ isWorkflowTimelineStepStatus,
2331
+ isWorkflowTimelineTerminal,
2317
2332
  kanbanAddColumnClasses,
2318
2333
  kanbanCardCountClasses,
2319
2334
  kanbanFilterHighlightClasses,
@@ -2457,6 +2472,7 @@ export {
2457
2472
  menuKeyId,
2458
2473
  menuLightThemeClasses,
2459
2474
  menuModeClasses,
2475
+ menuSchemaToMenuItems,
2460
2476
  menuSearchEmptyClasses,
2461
2477
  menuSearchFieldClasses,
2462
2478
  menuSearchInputClasses,
@@ -2564,6 +2580,7 @@ export {
2564
2580
  normalizeSvgAttrs,
2565
2581
  normalizeTabKey,
2566
2582
  normalizeTreeSelectValue,
2583
+ normalizeWorkflowTimelineSteps,
2567
2584
  notificationActionButtonClasses,
2568
2585
  notificationActionButtonTypeClasses,
2569
2586
  notificationActionsClasses,
@@ -3034,6 +3051,8 @@ export {
3034
3051
  resolveVirtualTableWidth,
3035
3052
  resolveVisibleResizeHandles,
3036
3053
  resolveWatermarkFont,
3054
+ resolveWorkflowActionButtonProps,
3055
+ resolveWorkflowStepStatus,
3037
3056
  restoreFocus,
3038
3057
  resultBaseClasses,
3039
3058
  resultExtraClasses,
@@ -3169,6 +3188,7 @@ export {
3169
3188
  shouldShowMenuSearch,
3170
3189
  shouldShowSelectClear,
3171
3190
  shouldShowTreeSelectClear,
3191
+ shouldShowWorkflowActions,
3172
3192
  shouldSkipNavigationMenuOpenDelay,
3173
3193
  shouldSkipTableLocalProcessing,
3174
3194
  shouldTrackChartPointer,
@@ -3223,6 +3243,7 @@ export {
3223
3243
  sortDescendingIcon,
3224
3244
  sortFileItems,
3225
3245
  sortNotificationGroups,
3246
+ sortWorkflowTimelineSteps,
3226
3247
  sparklesIcon,
3227
3248
  splitButtonDropdownClasses,
3228
3249
  splitButtonPrimaryBlockClasses,
@@ -3565,6 +3586,11 @@ export {
3565
3586
  watermarkWrapperClasses,
3566
3587
  wifiIcon,
3567
3588
  withCropFile,
3589
+ workflowStepHighlight,
3590
+ workflowStepStatusColor,
3591
+ workflowStepStatusLabel,
3592
+ workflowStepStatusTagVariant,
3593
+ workflowStepsToTimelineItems,
3568
3594
  writeCommentLikeOverlay,
3569
3595
  yieldDataExportFrame,
3570
3596
  zoomInIcon,
@@ -3635,6 +3661,7 @@ export { ImageAnnotation } from './components/ImageAnnotation.mjs';
3635
3661
  export { List } from './components/List.mjs';
3636
3662
  export { Descriptions } from './components/Descriptions.mjs';
3637
3663
  export { Timeline } from './components/Timeline.mjs';
3664
+ export { WorkflowTimeline, WorkflowActionBar } from './components/WorkflowTimeline.mjs';
3638
3665
  export { Countdown } from './components/Countdown.mjs';
3639
3666
  export { Tree } from './components/Tree.mjs';
3640
3667
  export { Skeleton } from './components/Skeleton.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expcat/tigercat-react",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "React components for Tigercat UI library",
5
5
  "license": "MIT",
6
6
  "author": "Yizhe Wang",
@@ -904,6 +904,16 @@
904
904
  "import": "./dist/components/Watermark.mjs",
905
905
  "default": "./dist/components/Watermark.mjs"
906
906
  },
907
+ "./WorkflowActionBar": {
908
+ "types": "./dist/components/WorkflowTimeline.d.mts",
909
+ "import": "./dist/components/WorkflowTimeline.mjs",
910
+ "default": "./dist/components/WorkflowTimeline.mjs"
911
+ },
912
+ "./WorkflowTimeline": {
913
+ "types": "./dist/components/WorkflowTimeline.d.mts",
914
+ "import": "./dist/components/WorkflowTimeline.mjs",
915
+ "default": "./dist/components/WorkflowTimeline.mjs"
916
+ },
907
917
  "./useDrag": {
908
918
  "types": "./dist/hooks/useDrag.d.mts",
909
919
  "import": "./dist/hooks/useDrag.mjs",
@@ -927,7 +937,7 @@
927
937
  "access": "public"
928
938
  },
929
939
  "dependencies": {
930
- "@expcat/tigercat-core": "2.2.0"
940
+ "@expcat/tigercat-core": "2.3.0"
931
941
  },
932
942
  "devDependencies": {
933
943
  "@types/node": "^26.1.1",