hs-uix 2.1.1 → 2.2.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.
Files changed (49) hide show
  1. package/README.md +3 -1
  2. package/common-components.d.ts +319 -68
  3. package/dist/calendar.js +355 -57
  4. package/dist/calendar.mjs +356 -57
  5. package/dist/common-components.js +3546 -88
  6. package/dist/common-components.mjs +3530 -84
  7. package/dist/datatable.js +108 -18
  8. package/dist/datatable.mjs +108 -18
  9. package/dist/experimental.js +2876 -0
  10. package/dist/experimental.mjs +2883 -0
  11. package/dist/feed.js +267 -38
  12. package/dist/feed.mjs +260 -37
  13. package/dist/filter.js +1379 -0
  14. package/dist/filter.mjs +1334 -0
  15. package/dist/form.js +222 -26
  16. package/dist/form.mjs +227 -27
  17. package/dist/index.js +3208 -287
  18. package/dist/index.mjs +3156 -283
  19. package/dist/kanban.js +282 -62
  20. package/dist/kanban.mjs +273 -61
  21. package/dist/safe.js +9207 -0
  22. package/dist/safe.mjs +9298 -0
  23. package/dist/utils.js +491 -75
  24. package/dist/utils.mjs +491 -75
  25. package/experimental.d.ts +1 -0
  26. package/filter.d.ts +1 -0
  27. package/index.d.ts +45 -3
  28. package/package.json +19 -1
  29. package/safe.d.ts +1 -0
  30. package/src/calendar/README.md +74 -5
  31. package/src/calendar/index.d.ts +95 -1
  32. package/src/common-components/README.md +140 -1
  33. package/src/datatable/README.md +0 -2
  34. package/src/experimental/README.md +126 -0
  35. package/src/experimental/index.d.ts +346 -0
  36. package/src/feed/README.md +69 -0
  37. package/src/feed/index.d.ts +103 -0
  38. package/src/filter/README.md +148 -0
  39. package/src/filter/index.d.ts +221 -0
  40. package/src/form/README.md +132 -4
  41. package/src/form/index.d.ts +82 -1
  42. package/src/kanban/README.md +119 -6
  43. package/src/kanban/index.d.ts +153 -2
  44. package/src/safe/README.md +108 -0
  45. package/src/safe/index.d.ts +158 -0
  46. package/src/utils/README.md +39 -0
  47. package/src/wizard/README.md +158 -0
  48. package/src/wizard/index.d.ts +138 -0
  49. package/utils.d.ts +17 -0
@@ -0,0 +1,138 @@
1
+ import type { ReactNode } from "react";
2
+
3
+ export type WizardOrientation = "vertical" | "horizontal";
4
+
5
+ export type WizardValues = Record<string, unknown>;
6
+
7
+ export interface WizardStepContext {
8
+ /** Id of the active step. */
9
+ stepId: string | null;
10
+ /** Zero-based index of the active step. */
11
+ stepIndex: number;
12
+ /** Validate the active step; on pass, advance (or fire onComplete on the last step). */
13
+ goNext: () => void;
14
+ /** Move to the previous step (never gated). */
15
+ goBack: () => void;
16
+ /** Jump to a step by id or index. No-op when the target isn't reachable. */
17
+ goTo: (stepOrId: string | number) => void;
18
+ /** Shared values bag owned by the Wizard. */
19
+ values: WizardValues;
20
+ /**
21
+ * Shallow-merge an object patch into the values bag, or replace it via an
22
+ * updater function `(prev) => next`.
23
+ */
24
+ setValues: (
25
+ patch: Partial<WizardValues> | ((prev: WizardValues) => WizardValues)
26
+ ) => void;
27
+ }
28
+
29
+ export interface WizardLabels {
30
+ back?: string;
31
+ next?: string;
32
+ finish?: string;
33
+ optional?: string;
34
+ errorTitle?: string;
35
+ }
36
+
37
+ export interface WizardFooterContext extends WizardStepContext {
38
+ isFirst: boolean;
39
+ isLast: boolean;
40
+ /** Current validation error (string) or null. */
41
+ error: string | null;
42
+ labels: Required<WizardLabels>;
43
+ }
44
+
45
+ export interface WizardStep {
46
+ /** Stable identifier. Falls back to `step-<index>` when omitted. */
47
+ id?: string | number;
48
+ /** Card heading. NOTE: the native Accordion (collapsible mode) only accepts a string title — a non-string node falls back to "Getting started". */
49
+ title?: ReactNode | string;
50
+ description?: ReactNode;
51
+ /** Optional steps never block jump-ahead reachability in linear mode. */
52
+ optional?: boolean;
53
+ /** Renders the step's arbitrary content. */
54
+ render?: (ctx: WizardStepContext) => ReactNode;
55
+ /**
56
+ * Gate for Next/Finish: return a non-empty string to block the transition
57
+ * (shown as an inline error Alert); anything else passes.
58
+ */
59
+ validate?: (ctx: WizardStepContext) => true | string | boolean | null | undefined;
60
+ }
61
+
62
+ export interface WizardStepIndicatorProps {
63
+ circleSize?: "xs" | "sm" | "md" | "lg" | "xl";
64
+ variant?: "default" | "compact" | "flush";
65
+ [key: string]: unknown;
66
+ }
67
+
68
+ export interface WizardProps {
69
+ steps?: WizardStep[];
70
+ /** Controlled current step (id or zero-based index). */
71
+ step?: string | number;
72
+ /** Initial step (id or zero-based index) when uncontrolled. */
73
+ defaultStep?: string | number;
74
+ onStepChange?: (stepId: string, stepIndex: number) => void;
75
+ /** Fires when Finish passes validation on the last step. */
76
+ onComplete?: (values: WizardValues) => void;
77
+ /** Initial contents of the shared values bag. */
78
+ defaultValues?: WizardValues;
79
+ onValuesChange?: (values: WizardValues) => void;
80
+ orientation?: WizardOrientation;
81
+ showStepNav?: boolean;
82
+ /** Allow clicking any future step without completing the ones before it. */
83
+ allowJumpAhead?: boolean;
84
+ /** Render the active step's title/description above its content. */
85
+ showStepHeader?: boolean;
86
+ labels?: WizardLabels;
87
+ /** Replaces the Back / Next / Finish footer row. */
88
+ renderFooter?: (ctx: WizardFooterContext) => ReactNode;
89
+ /** Flex ratio of the vertical step-nav column. */
90
+ navFlex?: number;
91
+ /** Flex ratio of the vertical content column. */
92
+ contentFlex?: number;
93
+ /** Extra props for the native StepIndicator (horizontal orientation). */
94
+ stepIndicatorProps?: WizardStepIndicatorProps;
95
+ }
96
+
97
+ export declare function Wizard(props: WizardProps): ReactNode;
98
+
99
+ export interface OnboardingChecklistAction {
100
+ label: ReactNode;
101
+ onClick?: () => void;
102
+ variant?: "primary" | "secondary" | "destructive" | "transparent";
103
+ disabled?: boolean;
104
+ }
105
+
106
+ export interface OnboardingChecklistItem {
107
+ id?: string | number;
108
+ title?: ReactNode;
109
+ description?: ReactNode;
110
+ /** Drives the success marker and the progress bar. */
111
+ done?: boolean;
112
+ /** Inline CTA shown on incomplete rows (and done rows with showCompletedActions). */
113
+ action?: OnboardingChecklistAction;
114
+ [key: string]: unknown;
115
+ }
116
+
117
+ export interface OnboardingChecklistLabels {
118
+ progress?: (done: number, total: number) => string;
119
+ }
120
+
121
+ export interface OnboardingChecklistProps {
122
+ items?: OnboardingChecklistItem[];
123
+ title?: ReactNode;
124
+ description?: ReactNode;
125
+ /** Show the ProgressBar headline. */
126
+ progress?: boolean;
127
+ /** When provided, item titles render as Links invoking this with the item. */
128
+ onItemClick?: (item: OnboardingChecklistItem) => void;
129
+ /** Wrap the checklist in an Accordion (open while incomplete by default). */
130
+ collapsible?: boolean;
131
+ /** Initial open state for collapsible mode. */
132
+ defaultOpen?: boolean;
133
+ /** Keep action buttons visible on completed rows. */
134
+ showCompletedActions?: boolean;
135
+ labels?: OnboardingChecklistLabels;
136
+ }
137
+
138
+ export declare function OnboardingChecklist(props: OnboardingChecklistProps): ReactNode;
package/utils.d.ts CHANGED
@@ -247,6 +247,23 @@ export interface DerivedCardField<Row = Record<string, unknown>> {
247
247
  href?: (row: Row) => string | { url: string; external?: boolean };
248
248
  }
249
249
 
250
+ export type JsonPatchOp = "add" | "replace" | "remove" | "move" | "copy" | "test";
251
+
252
+ export interface JsonPatchOperation {
253
+ /** Supported: add / replace / remove / move / copy. Others (incl. `test`) are skipped with a warning. */
254
+ op: JsonPatchOp;
255
+ /** JSON Pointer (RFC 6901), e.g. "/elements/hero/props/title". "" or "/" addresses the document root. */
256
+ path: string;
257
+ /** Source pointer for "move" / "copy". */
258
+ from?: string;
259
+ value?: unknown;
260
+ }
261
+
262
+ export declare function applyPatches<Doc = unknown>(
263
+ doc: Doc | null | undefined,
264
+ patches: ReadonlyArray<JsonPatchOperation> | null | undefined
265
+ ): Doc;
266
+
250
267
  export declare function formatCurrency(value: unknown, options?: FormatCurrencyOptions): string;
251
268
  export declare function formatCurrencyCompact(value: unknown, options?: FormatCurrencyCompactOptions): string;
252
269
  export declare function formatDate(value: unknown, options?: FormatDateOptions): string;