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

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
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import * as React from "react";
2
4
  import { ReactNode, RefObject } from "react";
3
5
  import { VariantProps } from "class-variance-authority";
@@ -125,16 +127,23 @@ interface RunsViewState {
125
127
  event: string | null;
126
128
  replayOf: string | null;
127
129
  }
128
- interface RunsViewProps {
130
+ declare const DEFAULT_RUNS_VIEW_STATE: RunsViewState;
131
+ declare function useRunsViewState(initial?: Partial<RunsViewState>): {
129
132
  state: RunsViewState;
130
- onChange: (patch: Partial<RunsViewState>, opts?: {
133
+ onChange: (patch: Partial<RunsViewState>) => void;
134
+ };
135
+ interface RunsViewProps {
136
+ state?: RunsViewState;
137
+ onChange?: (patch: Partial<RunsViewState>, opts?: {
131
138
  push?: boolean;
132
139
  }) => void;
140
+ initialState?: Partial<RunsViewState>;
133
141
  readOnly?: boolean;
134
142
  }
135
143
  declare function RunsView({
136
- state,
137
- onChange,
144
+ state: controlledState,
145
+ onChange: controlledOnChange,
146
+ initialState,
138
147
  readOnly
139
148
  }: RunsViewProps): import("react").JSX.Element;
140
149
  //#endregion
@@ -672,7 +681,7 @@ declare function WorkflowsView({
672
681
  onOpenRun,
673
682
  renderRunAction
674
683
  }: {
675
- onOpenRun(runId: string): void;
684
+ onOpenRun?: (runId: string) => void;
676
685
  renderRunAction?: (workflow: WorkflowDef) => ReactNode;
677
686
  }): import("react").JSX.Element;
678
687
  //#endregion
@@ -1074,5 +1083,5 @@ declare const ACTION_LABELS: Record<ControlActionKind, string>;
1074
1083
  declare function actorLabel(actor?: string): string;
1075
1084
  declare function describeControlDetail(a: ControlAction): string;
1076
1085
  //#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 };
1086
+ 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
1087
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ "use client";
1
2
  import * as React from "react";
2
3
  import { Fragment, useCallback, useEffect, useMemo, useRef, useState } from "react";
3
4
  import { cva } from "class-variance-authority";
@@ -3017,7 +3018,35 @@ const RUN_TYPE_TO_TRIGGER = {
3017
3018
  triggered: "event",
3018
3019
  scheduled: "cron"
3019
3020
  };
3020
- function RunsView({ state, onChange, readOnly = false }) {
3021
+ const DEFAULT_RUNS_VIEW_STATE = {
3022
+ status: "all",
3023
+ app: "all",
3024
+ runType: "all",
3025
+ time: "1h",
3026
+ q: "",
3027
+ deep: false,
3028
+ sort: DEFAULT_RUN_SORT,
3029
+ run: null,
3030
+ event: null,
3031
+ replayOf: null
3032
+ };
3033
+ function useRunsViewState(initial) {
3034
+ const [state, setState] = useState(() => ({
3035
+ ...DEFAULT_RUNS_VIEW_STATE,
3036
+ ...initial
3037
+ }));
3038
+ return {
3039
+ state,
3040
+ onChange: useCallback((patch) => setState((s) => ({
3041
+ ...s,
3042
+ ...patch
3043
+ })), [])
3044
+ };
3045
+ }
3046
+ function RunsView({ state: controlledState, onChange: controlledOnChange, initialState, readOnly = false }) {
3047
+ const local = useRunsViewState(initialState);
3048
+ const state = controlledState ?? local.state;
3049
+ const onChange = controlledOnChange ?? local.onChange;
3021
3050
  const { app, runType, time, q: query, deep, sort, run: selectedRunId, event, replayOf, status } = state;
3022
3051
  const openRun = (id) => onChange({ run: id }, { push: true });
3023
3052
  const onSort = (key) => onChange({ sort: toggleRunSort(sort, key) });
@@ -3904,7 +3933,7 @@ function WorkflowsView({ onOpenRun, renderRunAction }) {
3904
3933
  children: /* @__PURE__ */ jsx(WorkflowDetail, {
3905
3934
  workflow: selected,
3906
3935
  onClose: () => setSelectedKey(null),
3907
- onOpenRun,
3936
+ onOpenRun: onOpenRun ?? (() => {}),
3908
3937
  renderRunAction
3909
3938
  }, selectedKey ?? "")
3910
3939
  })] })]
@@ -6402,6 +6431,6 @@ function watchSystemTheme(getPref) {
6402
6431
  return () => mq.removeEventListener("change", onChange);
6403
6432
  }
6404
6433
  //#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 };
6434
+ 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
6435
 
6407
6436
  //# sourceMappingURL=index.js.map