@durablex/react-ui 0.1.0-beta.3 → 0.1.0-beta.4

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.d.ts CHANGED
@@ -125,16 +125,23 @@ interface RunsViewState {
125
125
  event: string | null;
126
126
  replayOf: string | null;
127
127
  }
128
- interface RunsViewProps {
128
+ declare const DEFAULT_RUNS_VIEW_STATE: RunsViewState;
129
+ declare function useRunsViewState(initial?: Partial<RunsViewState>): {
129
130
  state: RunsViewState;
130
- onChange: (patch: Partial<RunsViewState>, opts?: {
131
+ onChange: (patch: Partial<RunsViewState>) => void;
132
+ };
133
+ interface RunsViewProps {
134
+ state?: RunsViewState;
135
+ onChange?: (patch: Partial<RunsViewState>, opts?: {
131
136
  push?: boolean;
132
137
  }) => void;
138
+ initialState?: Partial<RunsViewState>;
133
139
  readOnly?: boolean;
134
140
  }
135
141
  declare function RunsView({
136
- state,
137
- onChange,
142
+ state: controlledState,
143
+ onChange: controlledOnChange,
144
+ initialState,
138
145
  readOnly
139
146
  }: RunsViewProps): import("react").JSX.Element;
140
147
  //#endregion
@@ -672,7 +679,7 @@ declare function WorkflowsView({
672
679
  onOpenRun,
673
680
  renderRunAction
674
681
  }: {
675
- onOpenRun(runId: string): void;
682
+ onOpenRun?: (runId: string) => void;
676
683
  renderRunAction?: (workflow: WorkflowDef) => ReactNode;
677
684
  }): import("react").JSX.Element;
678
685
  //#endregion
@@ -1074,5 +1081,5 @@ declare const ACTION_LABELS: Record<ControlActionKind, string>;
1074
1081
  declare function actorLabel(actor?: string): string;
1075
1082
  declare function describeControlDetail(a: ControlAction): string;
1076
1083
  //#endregion
1077
- export { ACTION_LABELS, ALL_FILTER, AnimatedDurablexMark, AppFilter, AppShell, AppStatusBadge, AppTag, AppsView, BulkReplayButton, Button, CursorPager, DEFAULT_RUN_SORT, DEFAULT_TIME_RANGE, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DurablexLogo, type EventRunOption, EventsList, EventsView, FLOW_ADAPTERS, Facts, FilterDropdown, FilterDropdownButton, FilterDropdownItem, type FlowAdapter, FlowControlBadge, FlowControlSection, type FlowRow, FlowSummary, GlyphBadge, Input, JSON_TOKEN_COLOR, JsonBlock, JsonEditor, type JsonTokenKind, LogList, MARK_BARS, Meta, type NavGroup, type NavItem, OverviewView, type ParsedJson, RESUME_TRIANGLE, RUN_SORT_KEYS, RUN_TYPE_FILTERS, ReplayRunDialog, ResizableHandle, ResizablePanel, ResizablePanelGroup, ResumeMark, RetryFromStepButton, RunCancelButton, RunCharts, RunControlHistory, RunInspector, RunInspectorActions, type RunInspectorProps, RunPauseButton, type RunSort, type RunSortKey, type RunTypeFilter, RunnerLiveBadge, RunsFilterBar, RunsTable, RunsTableHead, RunsTableLoader, RunsTablePlaceholder, RunsTableRow, RunsView, type RunsViewProps, type RunsViewState, SORT_DIRS, STATUS_LABELS, ScheduledBadge, SectionHeader, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, Skeleton, type SortDir, type StatTile, StatTileGrid, StatsTiles, StatusBadge, type StatusFilter, TABLE_HEAD_CLASS, THEME_PREFS, TIME_OPTIONS, TIME_ZONES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableStatusRows, type ThemePref, TimeRangeFilter, TimeZoneFilter, type TimeZoneMode, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Topbar, TriggerEventDialog, TriggerEventResult, WebhooksView, WorkflowDetail, WorkflowRunAction, WorkflowRunDialog, type WorkflowRunPlan, WorkflowsView, actorLabel, appHue, applyThemePref, bucketTickLabel, buttonVariants, cn, currentStepNumber, describeControlDetail, expectedStepTotals, flowControlRows, formatDuration, formatError, formatNextFire, formatRelative, formatTime, getThemePref, hasFlowControl, highlightedJsonSpans, localTimeZone, parseJson, parseWindowMs, seriesBucketSeconds, setThemePref, stepCellLabel, stepProgress, timeLabel, toggleRunSort, tokenizeJson, useClickOutside, useConfirmAction, useCopyToClipboard, useIsMobile, useKeysetPager, watchSystemTheme, windowSince, workflowRunPlan };
1084
+ export { ACTION_LABELS, ALL_FILTER, AnimatedDurablexMark, AppFilter, AppShell, AppStatusBadge, AppTag, AppsView, BulkReplayButton, Button, CursorPager, DEFAULT_RUNS_VIEW_STATE, DEFAULT_RUN_SORT, DEFAULT_TIME_RANGE, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DurablexLogo, type EventRunOption, EventsList, EventsView, FLOW_ADAPTERS, Facts, FilterDropdown, FilterDropdownButton, FilterDropdownItem, type FlowAdapter, FlowControlBadge, FlowControlSection, type FlowRow, FlowSummary, GlyphBadge, Input, JSON_TOKEN_COLOR, JsonBlock, JsonEditor, type JsonTokenKind, LogList, MARK_BARS, Meta, type NavGroup, type NavItem, OverviewView, type ParsedJson, RESUME_TRIANGLE, RUN_SORT_KEYS, RUN_TYPE_FILTERS, ReplayRunDialog, ResizableHandle, ResizablePanel, ResizablePanelGroup, ResumeMark, RetryFromStepButton, RunCancelButton, RunCharts, RunControlHistory, RunInspector, RunInspectorActions, type RunInspectorProps, RunPauseButton, type RunSort, type RunSortKey, type RunTypeFilter, RunnerLiveBadge, RunsFilterBar, RunsTable, RunsTableHead, RunsTableLoader, RunsTablePlaceholder, RunsTableRow, RunsView, type RunsViewProps, type RunsViewState, SORT_DIRS, STATUS_LABELS, ScheduledBadge, SectionHeader, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, Skeleton, type SortDir, type StatTile, StatTileGrid, StatsTiles, StatusBadge, type StatusFilter, TABLE_HEAD_CLASS, THEME_PREFS, TIME_OPTIONS, TIME_ZONES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableStatusRows, type ThemePref, TimeRangeFilter, TimeZoneFilter, type TimeZoneMode, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Topbar, TriggerEventDialog, TriggerEventResult, WebhooksView, WorkflowDetail, WorkflowRunAction, WorkflowRunDialog, type WorkflowRunPlan, WorkflowsView, actorLabel, appHue, applyThemePref, bucketTickLabel, buttonVariants, cn, currentStepNumber, describeControlDetail, expectedStepTotals, flowControlRows, formatDuration, formatError, formatNextFire, formatRelative, formatTime, getThemePref, hasFlowControl, highlightedJsonSpans, localTimeZone, parseJson, parseWindowMs, seriesBucketSeconds, setThemePref, stepCellLabel, stepProgress, timeLabel, toggleRunSort, tokenizeJson, useClickOutside, useConfirmAction, useCopyToClipboard, useIsMobile, useKeysetPager, useRunsViewState, watchSystemTheme, windowSince, workflowRunPlan };
1078
1085
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -3017,7 +3017,35 @@ const RUN_TYPE_TO_TRIGGER = {
3017
3017
  triggered: "event",
3018
3018
  scheduled: "cron"
3019
3019
  };
3020
- function RunsView({ state, onChange, readOnly = false }) {
3020
+ const DEFAULT_RUNS_VIEW_STATE = {
3021
+ status: "all",
3022
+ app: "all",
3023
+ runType: "all",
3024
+ time: "1h",
3025
+ q: "",
3026
+ deep: false,
3027
+ sort: DEFAULT_RUN_SORT,
3028
+ run: null,
3029
+ event: null,
3030
+ replayOf: null
3031
+ };
3032
+ function useRunsViewState(initial) {
3033
+ const [state, setState] = useState(() => ({
3034
+ ...DEFAULT_RUNS_VIEW_STATE,
3035
+ ...initial
3036
+ }));
3037
+ return {
3038
+ state,
3039
+ onChange: useCallback((patch) => setState((s) => ({
3040
+ ...s,
3041
+ ...patch
3042
+ })), [])
3043
+ };
3044
+ }
3045
+ function RunsView({ state: controlledState, onChange: controlledOnChange, initialState, readOnly = false }) {
3046
+ const local = useRunsViewState(initialState);
3047
+ const state = controlledState ?? local.state;
3048
+ const onChange = controlledOnChange ?? local.onChange;
3021
3049
  const { app, runType, time, q: query, deep, sort, run: selectedRunId, event, replayOf, status } = state;
3022
3050
  const openRun = (id) => onChange({ run: id }, { push: true });
3023
3051
  const onSort = (key) => onChange({ sort: toggleRunSort(sort, key) });
@@ -3904,7 +3932,7 @@ function WorkflowsView({ onOpenRun, renderRunAction }) {
3904
3932
  children: /* @__PURE__ */ jsx(WorkflowDetail, {
3905
3933
  workflow: selected,
3906
3934
  onClose: () => setSelectedKey(null),
3907
- onOpenRun,
3935
+ onOpenRun: onOpenRun ?? (() => {}),
3908
3936
  renderRunAction
3909
3937
  }, selectedKey ?? "")
3910
3938
  })] })]
@@ -6402,6 +6430,6 @@ function watchSystemTheme(getPref) {
6402
6430
  return () => mq.removeEventListener("change", onChange);
6403
6431
  }
6404
6432
  //#endregion
6405
- export { ACTION_LABELS, ALL_FILTER, AnimatedDurablexMark, AppFilter, AppShell, AppStatusBadge, AppTag, AppsView, BulkReplayButton, Button, CursorPager, DEFAULT_RUN_SORT, DEFAULT_TIME_RANGE, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DurablexLogo, EventsList, EventsView, FLOW_ADAPTERS, Facts, FilterDropdown, FilterDropdownButton, FilterDropdownItem, FlowControlBadge, FlowControlSection, FlowSummary, GlyphBadge, Input, JSON_TOKEN_COLOR, JsonBlock, JsonEditor, LogList, MARK_BARS, Meta, OverviewView, RESUME_TRIANGLE, RUN_SORT_KEYS, RUN_TYPE_FILTERS, ReplayRunDialog, ResizableHandle, ResizablePanel, ResizablePanelGroup, ResumeMark, RetryFromStepButton, RunCancelButton, RunCharts, RunControlHistory, RunInspector, RunInspectorActions, RunPauseButton, RunnerLiveBadge, RunsFilterBar, RunsTable, RunsTableHead, RunsTableLoader, RunsTablePlaceholder, RunsTableRow, RunsView, SORT_DIRS, STATUS_LABELS, ScheduledBadge, SectionHeader, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, Skeleton, StatTileGrid, StatsTiles, StatusBadge, TABLE_HEAD_CLASS, THEME_PREFS, TIME_OPTIONS, TIME_ZONES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableStatusRows, TimeRangeFilter, TimeZoneFilter, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Topbar, TriggerEventDialog, TriggerEventResult, WebhooksView, WorkflowDetail, WorkflowRunAction, WorkflowRunDialog, WorkflowsView, actorLabel, appHue, applyThemePref, bucketTickLabel, buttonVariants, cn, currentStepNumber, describeControlDetail, expectedStepTotals, flowControlRows, formatDuration, formatError, formatNextFire, formatRelative, formatTime, getThemePref, hasFlowControl, highlightedJsonSpans, localTimeZone, parseJson, parseWindowMs, seriesBucketSeconds, setThemePref, stepCellLabel, stepProgress, timeLabel, toggleRunSort, tokenizeJson, useClickOutside, useConfirmAction, useCopyToClipboard, useIsMobile, useKeysetPager, watchSystemTheme, windowSince, workflowRunPlan };
6433
+ export { ACTION_LABELS, ALL_FILTER, AnimatedDurablexMark, AppFilter, AppShell, AppStatusBadge, AppTag, AppsView, BulkReplayButton, Button, CursorPager, DEFAULT_RUNS_VIEW_STATE, DEFAULT_RUN_SORT, DEFAULT_TIME_RANGE, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DurablexLogo, EventsList, EventsView, FLOW_ADAPTERS, Facts, FilterDropdown, FilterDropdownButton, FilterDropdownItem, FlowControlBadge, FlowControlSection, FlowSummary, GlyphBadge, Input, JSON_TOKEN_COLOR, JsonBlock, JsonEditor, LogList, MARK_BARS, Meta, OverviewView, RESUME_TRIANGLE, RUN_SORT_KEYS, RUN_TYPE_FILTERS, ReplayRunDialog, ResizableHandle, ResizablePanel, ResizablePanelGroup, ResumeMark, RetryFromStepButton, RunCancelButton, RunCharts, RunControlHistory, RunInspector, RunInspectorActions, RunPauseButton, RunnerLiveBadge, RunsFilterBar, RunsTable, RunsTableHead, RunsTableLoader, RunsTablePlaceholder, RunsTableRow, RunsView, SORT_DIRS, STATUS_LABELS, ScheduledBadge, SectionHeader, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Sidebar, Skeleton, StatTileGrid, StatsTiles, StatusBadge, TABLE_HEAD_CLASS, THEME_PREFS, TIME_OPTIONS, TIME_ZONES, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableStatusRows, TimeRangeFilter, TimeZoneFilter, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Topbar, TriggerEventDialog, TriggerEventResult, WebhooksView, WorkflowDetail, WorkflowRunAction, WorkflowRunDialog, WorkflowsView, actorLabel, appHue, applyThemePref, bucketTickLabel, buttonVariants, cn, currentStepNumber, describeControlDetail, expectedStepTotals, flowControlRows, formatDuration, formatError, formatNextFire, formatRelative, formatTime, getThemePref, hasFlowControl, highlightedJsonSpans, localTimeZone, parseJson, parseWindowMs, seriesBucketSeconds, setThemePref, stepCellLabel, stepProgress, timeLabel, toggleRunSort, tokenizeJson, useClickOutside, useConfirmAction, useCopyToClipboard, useIsMobile, useKeysetPager, useRunsViewState, watchSystemTheme, windowSince, workflowRunPlan };
6406
6434
 
6407
6435
  //# sourceMappingURL=index.js.map