hazo_ui 2.9.0 → 2.16.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.
- package/CHANGE_LOG.md +500 -0
- package/README.md +539 -0
- package/SETUP_CHECKLIST.md +418 -0
- package/dist/index.cjs +2522 -499
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +534 -1
- package/dist/index.d.ts +534 -1
- package/dist/index.js +2461 -468
- package/dist/index.js.map +1 -1
- package/dist/styles.css +40 -0
- package/package.json +5 -2
package/dist/index.d.cts
CHANGED
|
@@ -23,6 +23,7 @@ import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
|
|
|
23
23
|
import * as TogglePrimitive from '@radix-ui/react-toggle';
|
|
24
24
|
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
25
25
|
import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
|
|
26
|
+
export { toast as rawToast } from 'sonner';
|
|
26
27
|
|
|
27
28
|
/**
|
|
28
29
|
* hazo_ui_config.ts
|
|
@@ -1003,4 +1004,536 @@ declare function ButtonGroupText({ className, asChild, ...props }: React.Compone
|
|
|
1003
1004
|
}): react_jsx_runtime.JSX.Element;
|
|
1004
1005
|
declare function ButtonGroupSeparator({ className, orientation, ...props }: React.ComponentProps<typeof Separator>): react_jsx_runtime.JSX.Element;
|
|
1005
1006
|
|
|
1006
|
-
|
|
1007
|
+
interface SkeletonBaseProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1008
|
+
className?: string;
|
|
1009
|
+
}
|
|
1010
|
+
declare const Skeleton: React.ForwardRefExoticComponent<SkeletonBaseProps & React.RefAttributes<HTMLDivElement>>;
|
|
1011
|
+
interface SkeletonCircleProps {
|
|
1012
|
+
/** Diameter in px. Default 40. */
|
|
1013
|
+
size?: number;
|
|
1014
|
+
className?: string;
|
|
1015
|
+
}
|
|
1016
|
+
declare function SkeletonCircle({ size, className }: SkeletonCircleProps): react_jsx_runtime.JSX.Element;
|
|
1017
|
+
interface SkeletonBarProps {
|
|
1018
|
+
/** CSS width — accepts px (number) or any CSS length string. Default "100%". */
|
|
1019
|
+
width?: number | string;
|
|
1020
|
+
/** Height in px. Default 12. */
|
|
1021
|
+
height?: number;
|
|
1022
|
+
className?: string;
|
|
1023
|
+
}
|
|
1024
|
+
declare function SkeletonBar({ width, height, className }: SkeletonBarProps): react_jsx_runtime.JSX.Element;
|
|
1025
|
+
interface SkeletonRectProps {
|
|
1026
|
+
width?: number | string;
|
|
1027
|
+
height?: number | string;
|
|
1028
|
+
/** CSS border-radius. Default 6 (matches rounded-md). */
|
|
1029
|
+
radius?: number | string;
|
|
1030
|
+
className?: string;
|
|
1031
|
+
}
|
|
1032
|
+
declare function SkeletonRect({ width, height, radius, className }: SkeletonRectProps): react_jsx_runtime.JSX.Element;
|
|
1033
|
+
interface SkeletonGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
1034
|
+
/** Optional `aria-label` for the loading region. Default "Loading content". */
|
|
1035
|
+
label?: string;
|
|
1036
|
+
children: React.ReactNode;
|
|
1037
|
+
}
|
|
1038
|
+
declare function SkeletonGroup({ label, children, className, ...rest }: SkeletonGroupProps): react_jsx_runtime.JSX.Element;
|
|
1039
|
+
|
|
1040
|
+
interface EmptyStateProps {
|
|
1041
|
+
/** Icon element. Recommended size 48x48. Wrap a lucide icon in a div if you want background styling. */
|
|
1042
|
+
icon?: React.ReactNode;
|
|
1043
|
+
/** Required main heading. */
|
|
1044
|
+
title: string;
|
|
1045
|
+
/** Optional secondary description. */
|
|
1046
|
+
description?: React.ReactNode;
|
|
1047
|
+
/** Optional CTA region — typically one or two <Button> elements. */
|
|
1048
|
+
action?: React.ReactNode;
|
|
1049
|
+
/** Visual size. "sm" for inline use (cards, panels), "md" default, "lg" for full-page emptiness. */
|
|
1050
|
+
size?: "sm" | "md" | "lg";
|
|
1051
|
+
className?: string;
|
|
1052
|
+
}
|
|
1053
|
+
declare function EmptyState({ icon, title, description, action, size, className, }: EmptyStateProps): react_jsx_runtime.JSX.Element;
|
|
1054
|
+
|
|
1055
|
+
type ErrorBannerSeverity = "warning" | "error";
|
|
1056
|
+
interface ErrorBannerProps {
|
|
1057
|
+
/** Defaults to "error". */
|
|
1058
|
+
severity?: ErrorBannerSeverity;
|
|
1059
|
+
/** Optional bold heading shown above the message. */
|
|
1060
|
+
title?: string;
|
|
1061
|
+
/** Required body text or node. */
|
|
1062
|
+
message: React.ReactNode;
|
|
1063
|
+
/** Override the auto-selected icon. */
|
|
1064
|
+
icon?: React.ReactNode;
|
|
1065
|
+
/** Optional CTA region — typically one <Button>. */
|
|
1066
|
+
action?: React.ReactNode;
|
|
1067
|
+
/** When provided, renders a dismiss "X" button that calls this on click. */
|
|
1068
|
+
onDismiss?: () => void;
|
|
1069
|
+
className?: string;
|
|
1070
|
+
}
|
|
1071
|
+
declare function ErrorBanner({ severity, title, message, icon, action, onDismiss, className, }: ErrorBannerProps): react_jsx_runtime.JSX.Element;
|
|
1072
|
+
|
|
1073
|
+
interface ErrorPageProps {
|
|
1074
|
+
/** Defaults to "Something went wrong". */
|
|
1075
|
+
title?: string;
|
|
1076
|
+
/** Optional explanation paragraph(s). */
|
|
1077
|
+
description?: React.ReactNode;
|
|
1078
|
+
/** Short symbolic code (e.g., "500", "NOT_FOUND") rendered as a tag. */
|
|
1079
|
+
errorCode?: string;
|
|
1080
|
+
/** Correlation id from hazo_logs — rendered in a copyable mono block when present. */
|
|
1081
|
+
correlationId?: string;
|
|
1082
|
+
/** CTA region — typically one or two <Button> elements ("Try again", "Go home"). */
|
|
1083
|
+
actions?: React.ReactNode;
|
|
1084
|
+
/** Override the default OctagonAlert icon. */
|
|
1085
|
+
illustration?: React.ReactNode;
|
|
1086
|
+
className?: string;
|
|
1087
|
+
}
|
|
1088
|
+
declare function ErrorPage({ title, description, errorCode, correlationId, actions, illustration, className, }: ErrorPageProps): react_jsx_runtime.JSX.Element;
|
|
1089
|
+
|
|
1090
|
+
interface LoadingTimeoutProps {
|
|
1091
|
+
/** When true, the timeout runs and escalation states render. When false, renders children. */
|
|
1092
|
+
active: boolean;
|
|
1093
|
+
/** Children shown when not loading. */
|
|
1094
|
+
children?: React.ReactNode;
|
|
1095
|
+
/** Optional skeleton rendered during the "silent" phase (0–5s). */
|
|
1096
|
+
skeleton?: React.ReactNode;
|
|
1097
|
+
/** Called when the user clicks the retry button in the "expired" phase. */
|
|
1098
|
+
onRetry?: () => void;
|
|
1099
|
+
/** Customise the timeout thresholds in ms. Defaults: 5000/15000/30000. */
|
|
1100
|
+
thresholds?: {
|
|
1101
|
+
gentle?: number;
|
|
1102
|
+
firm?: number;
|
|
1103
|
+
expired?: number;
|
|
1104
|
+
};
|
|
1105
|
+
/** Optional label used in the gentle/firm messages. Default "content". */
|
|
1106
|
+
label?: string;
|
|
1107
|
+
className?: string;
|
|
1108
|
+
}
|
|
1109
|
+
declare function LoadingTimeout({ active, children, skeleton, onRetry, thresholds, label, className, }: LoadingTimeoutProps): react_jsx_runtime.JSX.Element;
|
|
1110
|
+
|
|
1111
|
+
interface ProgressiveImageProps {
|
|
1112
|
+
/** Required final image src. */
|
|
1113
|
+
src: string;
|
|
1114
|
+
/** Required alt text. Empty string is allowed for decorative images. */
|
|
1115
|
+
alt: string;
|
|
1116
|
+
/** Low-quality placeholder data URL or tiny image url. Renders blurred under the main image. */
|
|
1117
|
+
lqip?: string;
|
|
1118
|
+
/** Width in px or CSS length. Required for stable aspect ratio. */
|
|
1119
|
+
width: number | string;
|
|
1120
|
+
/** Height in px or CSS length. Required for stable aspect ratio. */
|
|
1121
|
+
height: number | string;
|
|
1122
|
+
/** Native loading attribute. Default "lazy". */
|
|
1123
|
+
loading?: "eager" | "lazy";
|
|
1124
|
+
/** Object fit for the final image. Default "cover". */
|
|
1125
|
+
fit?: "cover" | "contain" | "fill" | "none" | "scale-down";
|
|
1126
|
+
className?: string;
|
|
1127
|
+
onLoad?: () => void;
|
|
1128
|
+
onError?: () => void;
|
|
1129
|
+
}
|
|
1130
|
+
declare function ProgressiveImage({ src, alt, lqip, width, height, loading, fit, className, onLoad, onError, }: ProgressiveImageProps): react_jsx_runtime.JSX.Element;
|
|
1131
|
+
|
|
1132
|
+
interface HazoUiToasterProps {
|
|
1133
|
+
/** Position of the toast stack. Default "bottom-right". */
|
|
1134
|
+
position?: "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-center" | "bottom-center";
|
|
1135
|
+
/** Whether toasts include a close (X) button. Default true. */
|
|
1136
|
+
closeButton?: boolean;
|
|
1137
|
+
/** Max number of toasts visible at once. Default 5. */
|
|
1138
|
+
visibleToasts?: number;
|
|
1139
|
+
}
|
|
1140
|
+
declare function HazoUiToaster({ position, closeButton, visibleToasts, }?: HazoUiToasterProps): react_jsx_runtime.JSX.Element;
|
|
1141
|
+
interface ToastOptions {
|
|
1142
|
+
title: string;
|
|
1143
|
+
description?: string;
|
|
1144
|
+
/** Auto-dismiss duration in ms. Default 3000 for success, 5000 for error. */
|
|
1145
|
+
duration?: number;
|
|
1146
|
+
/** Optional action button rendered inside the toast. */
|
|
1147
|
+
action?: {
|
|
1148
|
+
label: string;
|
|
1149
|
+
onClick: () => void;
|
|
1150
|
+
};
|
|
1151
|
+
}
|
|
1152
|
+
declare function successToast({ title, description, duration, action }: ToastOptions): string | number;
|
|
1153
|
+
declare function errorToast({ title, description, duration, action }: ToastOptions): string | number;
|
|
1154
|
+
|
|
1155
|
+
interface UseLoadingStateResult {
|
|
1156
|
+
/** Current loading flag. */
|
|
1157
|
+
isLoading: boolean;
|
|
1158
|
+
/** Set the loading flag manually. */
|
|
1159
|
+
setLoading: (value: boolean) => void;
|
|
1160
|
+
/**
|
|
1161
|
+
* Wraps an async function: sets loading=true, awaits the function,
|
|
1162
|
+
* sets loading=false in a finally block. Returns the function's result
|
|
1163
|
+
* (or throws its error).
|
|
1164
|
+
*/
|
|
1165
|
+
withLoading: <T>(fn: () => Promise<T>) => Promise<T>;
|
|
1166
|
+
}
|
|
1167
|
+
declare function useLoadingState(initial?: boolean): UseLoadingStateResult;
|
|
1168
|
+
|
|
1169
|
+
interface UseErrorDisplayResult {
|
|
1170
|
+
/** Current error message, or null when cleared. */
|
|
1171
|
+
error: string | null;
|
|
1172
|
+
/**
|
|
1173
|
+
* Set the error. Accepts a string, an Error instance (uses .message),
|
|
1174
|
+
* or null to clear. Anything else is coerced via String().
|
|
1175
|
+
*/
|
|
1176
|
+
setError: (value: unknown) => void;
|
|
1177
|
+
/** Clear the error. Same as `setError(null)`. */
|
|
1178
|
+
clearError: () => void;
|
|
1179
|
+
}
|
|
1180
|
+
declare function useErrorDisplay(): UseErrorDisplayResult;
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Types for HazoUiKanban - Drag-Drop Kanban
|
|
1184
|
+
*
|
|
1185
|
+
* Public type surface for the kanban components. No @dnd-kit types leak here;
|
|
1186
|
+
* consumers see only HazoUi* shapes.
|
|
1187
|
+
*/
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Priority levels drive the left-border tint. P0..P3 ship with default colors;
|
|
1191
|
+
* any other string is allowed if the consumer defines a custom CSS variable
|
|
1192
|
+
* (e.g. priority "critical" → --hazo-kanban-priority-critical).
|
|
1193
|
+
*/
|
|
1194
|
+
type KanbanPriority = "P0" | "P1" | "P2" | "P3" | string;
|
|
1195
|
+
/**
|
|
1196
|
+
* Minimal item shape required by the board. Consumers extend this with their
|
|
1197
|
+
* own payload fields (title, category, etc.).
|
|
1198
|
+
*/
|
|
1199
|
+
interface KanbanItem {
|
|
1200
|
+
id: string;
|
|
1201
|
+
columnKey: string;
|
|
1202
|
+
priority?: KanbanPriority;
|
|
1203
|
+
}
|
|
1204
|
+
/**
|
|
1205
|
+
* Column descriptor passed to the board.
|
|
1206
|
+
*/
|
|
1207
|
+
interface KanbanColumn {
|
|
1208
|
+
key: string;
|
|
1209
|
+
title: string;
|
|
1210
|
+
/** Optional gate: returning false rejects an incoming drop. */
|
|
1211
|
+
accepts?: (item: KanbanItem) => boolean;
|
|
1212
|
+
}
|
|
1213
|
+
/**
|
|
1214
|
+
* Handle attached to move/reorder events. Calling revert() removes the
|
|
1215
|
+
* library's optimistic overlay entry, snapping the visible state back to
|
|
1216
|
+
* whatever the consumer's `items` prop currently says.
|
|
1217
|
+
*/
|
|
1218
|
+
interface KanbanMoveHandle {
|
|
1219
|
+
revert: () => void;
|
|
1220
|
+
}
|
|
1221
|
+
/**
|
|
1222
|
+
* Fired when a card is dropped into a different column.
|
|
1223
|
+
*/
|
|
1224
|
+
type KanbanMoveEvent<T extends KanbanItem = KanbanItem> = {
|
|
1225
|
+
itemId: string;
|
|
1226
|
+
item: T;
|
|
1227
|
+
fromColumn: string;
|
|
1228
|
+
toColumn: string;
|
|
1229
|
+
newIndex: number;
|
|
1230
|
+
} & KanbanMoveHandle;
|
|
1231
|
+
/**
|
|
1232
|
+
* Fired when a card is reordered within the same column.
|
|
1233
|
+
*/
|
|
1234
|
+
type KanbanReorderEvent<T extends KanbanItem = KanbanItem> = {
|
|
1235
|
+
itemId: string;
|
|
1236
|
+
item: T;
|
|
1237
|
+
columnKey: string;
|
|
1238
|
+
newIndex: number;
|
|
1239
|
+
} & KanbanMoveHandle;
|
|
1240
|
+
/**
|
|
1241
|
+
* Screen-reader announcement strings produced from drag lifecycle events.
|
|
1242
|
+
* Defaults are provided; consumers can pass a partial override.
|
|
1243
|
+
*/
|
|
1244
|
+
interface KanbanAnnouncements {
|
|
1245
|
+
onDragStart: (ctx: {
|
|
1246
|
+
item: KanbanItem;
|
|
1247
|
+
fromColumn: string;
|
|
1248
|
+
}) => string;
|
|
1249
|
+
onDragOver: (ctx: {
|
|
1250
|
+
item: KanbanItem;
|
|
1251
|
+
overColumn: string | null;
|
|
1252
|
+
}) => string;
|
|
1253
|
+
onDragEnd: (ctx: {
|
|
1254
|
+
item: KanbanItem;
|
|
1255
|
+
fromColumn: string;
|
|
1256
|
+
toColumn: string;
|
|
1257
|
+
newIndex: number;
|
|
1258
|
+
}) => string;
|
|
1259
|
+
onDragCancel: (ctx: {
|
|
1260
|
+
item: KanbanItem;
|
|
1261
|
+
fromColumn: string;
|
|
1262
|
+
}) => string;
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
* Props for HazoUiKanban.
|
|
1266
|
+
*/
|
|
1267
|
+
interface HazoUiKanbanProps<T extends KanbanItem = KanbanItem> {
|
|
1268
|
+
columns: KanbanColumn[];
|
|
1269
|
+
items: T[];
|
|
1270
|
+
renderCard: (item: T) => React.ReactNode;
|
|
1271
|
+
onMove?: (event: KanbanMoveEvent<T>) => void;
|
|
1272
|
+
onReorder?: (event: KanbanReorderEvent<T>) => void;
|
|
1273
|
+
/** Default 640 (Tailwind sm). Below this width the board collapses to tabs. */
|
|
1274
|
+
mobileBreakpoint?: number;
|
|
1275
|
+
/** Override default screen-reader messages. Partial — unset keys use defaults. */
|
|
1276
|
+
announcements?: Partial<KanbanAnnouncements>;
|
|
1277
|
+
/** Rendered when a column has zero items. Default: muted "—" placeholder. */
|
|
1278
|
+
emptyColumn?: React.ReactNode;
|
|
1279
|
+
/** Class on the board root. */
|
|
1280
|
+
className?: string;
|
|
1281
|
+
/** Class on each card shell (the wrapper around renderCard output). */
|
|
1282
|
+
cardClassName?: string;
|
|
1283
|
+
/**
|
|
1284
|
+
* Optional accessor for the announcement label of an item.
|
|
1285
|
+
* Defaults to item.id if not provided.
|
|
1286
|
+
*/
|
|
1287
|
+
itemLabel?: (item: T) => string;
|
|
1288
|
+
/**
|
|
1289
|
+
* Declarative field schema for the default editor. If omitted, the
|
|
1290
|
+
* editor auto-detects all string-typed fields on the item except `id`,
|
|
1291
|
+
* `columnKey`, and `priority`, rendering each as a text input.
|
|
1292
|
+
*/
|
|
1293
|
+
editorFields?: KanbanEditorField[];
|
|
1294
|
+
/**
|
|
1295
|
+
* Pool of priorities used when a field has `type: 'priority'`.
|
|
1296
|
+
* Defaults to ["P0","P1","P2","P3"].
|
|
1297
|
+
*/
|
|
1298
|
+
editorPriorities?: KanbanPriority[];
|
|
1299
|
+
/**
|
|
1300
|
+
* Dialog title. Defaults to `Edit ${item.id}`.
|
|
1301
|
+
*/
|
|
1302
|
+
editorTitle?: (item: T) => string;
|
|
1303
|
+
/**
|
|
1304
|
+
* Override the body of the editor dialog. The library still renders the
|
|
1305
|
+
* Dialog wrapper, title, and (by default) the Cancel/Save footer.
|
|
1306
|
+
*/
|
|
1307
|
+
renderCardEditor?: (item: T, ctx: KanbanEditorCtx<T>) => React.ReactNode;
|
|
1308
|
+
/**
|
|
1309
|
+
* Suppress the library's default Cancel/Save footer. Only honored when
|
|
1310
|
+
* renderCardEditor is also provided — in default mode there is no
|
|
1311
|
+
* alternate way to trigger save, so the footer always renders.
|
|
1312
|
+
*/
|
|
1313
|
+
hideEditorFooter?: boolean;
|
|
1314
|
+
/**
|
|
1315
|
+
* Fired when the user clicks Save. Consumer is responsible for
|
|
1316
|
+
* persisting and (on success) updating `items`. Returning a Promise
|
|
1317
|
+
* gates the dialog close and shows a spinner on Save; rejecting the
|
|
1318
|
+
* Promise keeps the dialog open with the error rendered.
|
|
1319
|
+
*/
|
|
1320
|
+
onCardSave?: (event: KanbanSaveEvent<T>) => void | Promise<void>;
|
|
1321
|
+
/**
|
|
1322
|
+
* Hide the edit pencil entirely (read-only board). The pencil is also
|
|
1323
|
+
* automatically hidden when onCardSave is not provided.
|
|
1324
|
+
*/
|
|
1325
|
+
disableEdit?: boolean;
|
|
1326
|
+
}
|
|
1327
|
+
/**
|
|
1328
|
+
* Filter shape consumed by HazoUiKanbanFilter and applyKanbanFilter.
|
|
1329
|
+
*/
|
|
1330
|
+
interface KanbanFilterValue {
|
|
1331
|
+
search: string;
|
|
1332
|
+
categories: string[];
|
|
1333
|
+
priority: KanbanPriority | null;
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* Props for HazoUiKanbanFilter.
|
|
1337
|
+
*/
|
|
1338
|
+
interface HazoUiKanbanFilterProps {
|
|
1339
|
+
/** Show the search input. Default true. */
|
|
1340
|
+
search?: boolean;
|
|
1341
|
+
/** Search input placeholder. Default "Search...". */
|
|
1342
|
+
searchPlaceholder?: string;
|
|
1343
|
+
/** Categories rendered as multi-select chips. Hidden when omitted/empty. */
|
|
1344
|
+
categories?: string[];
|
|
1345
|
+
/** Priority chips (single-select). Hidden when omitted/empty. */
|
|
1346
|
+
priorities?: KanbanPriority[];
|
|
1347
|
+
/** Controlled value. */
|
|
1348
|
+
value?: KanbanFilterValue;
|
|
1349
|
+
/** Default value for uncontrolled usage. */
|
|
1350
|
+
defaultValue?: KanbanFilterValue;
|
|
1351
|
+
/** Called whenever any filter field changes. */
|
|
1352
|
+
onChange?: (value: KanbanFilterValue) => void;
|
|
1353
|
+
/** Class on the filter root. */
|
|
1354
|
+
className?: string;
|
|
1355
|
+
}
|
|
1356
|
+
/**
|
|
1357
|
+
* Built-in field types the default editor knows how to render.
|
|
1358
|
+
* `priority` renders a Select pre-populated from HazoUiKanban's
|
|
1359
|
+
* `editorPriorities` prop (defaulting to ["P0","P1","P2","P3"]).
|
|
1360
|
+
* `status` renders a Select pre-populated from HazoUiKanban's `columns`
|
|
1361
|
+
* prop (using each column's `title` as the option label and `key` as the
|
|
1362
|
+
* value). Bound to `columnKey` by convention — saving with a different
|
|
1363
|
+
* status moves the card to a new column through the consumer's
|
|
1364
|
+
* onCardSave handler.
|
|
1365
|
+
*/
|
|
1366
|
+
type KanbanEditorFieldType = "text" | "textarea" | "select" | "number" | "checkbox" | "priority" | "status";
|
|
1367
|
+
/**
|
|
1368
|
+
* Declarative field config for the default editor. One per editable key.
|
|
1369
|
+
*/
|
|
1370
|
+
interface KanbanEditorField {
|
|
1371
|
+
/** Top-level string key on the item being edited. */
|
|
1372
|
+
key: string;
|
|
1373
|
+
/** Display label. Defaults to a humanized version of `key`. */
|
|
1374
|
+
label?: string;
|
|
1375
|
+
type: KanbanEditorFieldType;
|
|
1376
|
+
/** Options list for `type: 'select'`. Ignored otherwise. */
|
|
1377
|
+
options?: string[];
|
|
1378
|
+
/** Placeholder for `type: 'text' | 'textarea' | 'number' | 'select' | 'priority'`. */
|
|
1379
|
+
placeholder?: string;
|
|
1380
|
+
/**
|
|
1381
|
+
* If true, the field shows a `*` marker on its label and Save is disabled
|
|
1382
|
+
* when empty. Only honored for text / textarea / number; ignored for
|
|
1383
|
+
* select / priority / checkbox (those types are never "empty").
|
|
1384
|
+
*/
|
|
1385
|
+
required?: boolean;
|
|
1386
|
+
}
|
|
1387
|
+
/**
|
|
1388
|
+
* Context passed to renderCardEditor render-prop. The library owns the
|
|
1389
|
+
* dialog open/close lifecycle; the consumer reads and writes the draft
|
|
1390
|
+
* through this handle and calls save()/close() to drive the lifecycle.
|
|
1391
|
+
*/
|
|
1392
|
+
interface KanbanEditorCtx<T extends KanbanItem = KanbanItem> {
|
|
1393
|
+
/** Current draft. Mutated as the user types. */
|
|
1394
|
+
draft: T;
|
|
1395
|
+
/** Update the draft. Accepts a value or an updater function. */
|
|
1396
|
+
setDraft: (next: T | ((prev: T) => T)) => void;
|
|
1397
|
+
/** Trigger the save lifecycle: validates required fields, calls onCardSave. */
|
|
1398
|
+
save: () => Promise<void>;
|
|
1399
|
+
/** Dismiss the dialog without saving. */
|
|
1400
|
+
close: () => void;
|
|
1401
|
+
/** True while onCardSave's returned promise is pending. */
|
|
1402
|
+
saving: boolean;
|
|
1403
|
+
/** Last save error message, or null. Cleared at the start of each save attempt. */
|
|
1404
|
+
error: string | null;
|
|
1405
|
+
/** True when JSON.stringify(draft) !== JSON.stringify(item). */
|
|
1406
|
+
isDirty: boolean;
|
|
1407
|
+
}
|
|
1408
|
+
/**
|
|
1409
|
+
* Fired when the user clicks Save (or the consumer's renderCardEditor
|
|
1410
|
+
* calls ctx.save()).
|
|
1411
|
+
*/
|
|
1412
|
+
interface KanbanSaveEvent<T extends KanbanItem = KanbanItem> {
|
|
1413
|
+
itemId: string;
|
|
1414
|
+
/** Original item before edits. */
|
|
1415
|
+
item: T;
|
|
1416
|
+
/** New item with the user's edits applied. */
|
|
1417
|
+
next: T;
|
|
1418
|
+
}
|
|
1419
|
+
|
|
1420
|
+
declare function HazoUiKanbanFilter({ search, searchPlaceholder, categories, priorities, value, defaultValue, onChange, className, }: HazoUiKanbanFilterProps): react_jsx_runtime.JSX.Element;
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* Pure helper: filters KanbanItem[] by search / categories / priority.
|
|
1424
|
+
*
|
|
1425
|
+
* - search: case-insensitive substring against any string-typed field of the item.
|
|
1426
|
+
* - categories: keep items whose item.category (string) is in the list.
|
|
1427
|
+
* - priority: exact equality on item.priority.
|
|
1428
|
+
*
|
|
1429
|
+
* Consumers needing different filter logic should write their own — this is
|
|
1430
|
+
* a convenience export, not the public contract for filtering.
|
|
1431
|
+
*/
|
|
1432
|
+
|
|
1433
|
+
declare function applyKanbanFilter<T extends KanbanItem>(items: T[], filter: KanbanFilterValue): T[];
|
|
1434
|
+
|
|
1435
|
+
declare function HazoUiKanban<T extends KanbanItem = KanbanItem>({ columns, items, renderCard, onMove, onReorder, mobileBreakpoint, announcements, emptyColumn, className, cardClassName, itemLabel, editorFields, editorPriorities, editorTitle, renderCardEditor, hideEditorFooter, onCardSave, disableEdit, }: HazoUiKanbanProps<T>): react_jsx_runtime.JSX.Element;
|
|
1436
|
+
|
|
1437
|
+
declare const Table: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableElement> & React.RefAttributes<HTMLTableElement>>;
|
|
1438
|
+
declare const TableHeader: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
1439
|
+
declare const TableBody: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
1440
|
+
declare const TableFooter: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableSectionElement> & React.RefAttributes<HTMLTableSectionElement>>;
|
|
1441
|
+
declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableRowElement> & React.RefAttributes<HTMLTableRowElement>>;
|
|
1442
|
+
declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
1443
|
+
declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
|
|
1444
|
+
declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
|
|
1445
|
+
|
|
1446
|
+
/**
|
|
1447
|
+
* HazoUiTable — public types.
|
|
1448
|
+
*
|
|
1449
|
+
* The `TableColumn` is the single source of truth: it carries display,
|
|
1450
|
+
* sort, filter, and search metadata. From it the component derives the
|
|
1451
|
+
* `availableFields` arrays for the existing HazoUiMultiSortDialog and
|
|
1452
|
+
* HazoUiMultiFilterDialog.
|
|
1453
|
+
*/
|
|
1454
|
+
|
|
1455
|
+
type SortDir = "asc" | "desc";
|
|
1456
|
+
interface TableSortEntry {
|
|
1457
|
+
key: string;
|
|
1458
|
+
dir: SortDir;
|
|
1459
|
+
}
|
|
1460
|
+
type TableSort = TableSortEntry[];
|
|
1461
|
+
/** Public prop shape — accepts single entry, array, or null; normalized to array internally. */
|
|
1462
|
+
type TableSortProp = TableSortEntry | TableSort | null;
|
|
1463
|
+
interface TableFilter {
|
|
1464
|
+
search?: string;
|
|
1465
|
+
fields?: FilterConfig[];
|
|
1466
|
+
}
|
|
1467
|
+
type TableFormatter = "date" | "number" | "currency" | "percent";
|
|
1468
|
+
interface TableColumn<TRow extends object = any> {
|
|
1469
|
+
key: keyof TRow & string;
|
|
1470
|
+
label: string;
|
|
1471
|
+
sortable?: boolean;
|
|
1472
|
+
cell?: (row: TRow, index: number) => React.ReactNode;
|
|
1473
|
+
formatter?: TableFormatter;
|
|
1474
|
+
/** ISO-4217 currency code used when `formatter` is "currency". Defaults to "USD". */
|
|
1475
|
+
currency?: string;
|
|
1476
|
+
/**
|
|
1477
|
+
* BCP-47 locale tag for the `number`, `currency`, and `percent`
|
|
1478
|
+
* formatters. Defaults to `"en-US"` (matches across SSR + CSR).
|
|
1479
|
+
* Set explicitly to override per column (e.g. `"de-DE"`, `"ja-JP"`).
|
|
1480
|
+
*/
|
|
1481
|
+
locale?: string;
|
|
1482
|
+
align?: "left" | "right" | "center";
|
|
1483
|
+
className?: string;
|
|
1484
|
+
headerClassName?: string;
|
|
1485
|
+
filterType?: FilterField["type"];
|
|
1486
|
+
filterConfig?: Pick<FilterField, "textConfig" | "numberConfig" | "comboboxOptions" | "booleanLabels">;
|
|
1487
|
+
searchable?: boolean;
|
|
1488
|
+
}
|
|
1489
|
+
interface HazoUiTablePagination {
|
|
1490
|
+
pageSize: number;
|
|
1491
|
+
}
|
|
1492
|
+
interface HazoUiTableServerLoadArgs {
|
|
1493
|
+
page: number;
|
|
1494
|
+
sort: TableSort;
|
|
1495
|
+
filter: TableFilter;
|
|
1496
|
+
}
|
|
1497
|
+
interface HazoUiTableServerLoadResult<TRow> {
|
|
1498
|
+
rows: TRow[];
|
|
1499
|
+
total: number;
|
|
1500
|
+
}
|
|
1501
|
+
interface HazoUiTableProps<TRow extends object = any> {
|
|
1502
|
+
columns: TableColumn<TRow>[];
|
|
1503
|
+
rows: TRow[];
|
|
1504
|
+
getRowKey?: (row: TRow, index: number) => string | number;
|
|
1505
|
+
sort?: TableSortProp;
|
|
1506
|
+
defaultSort?: TableSortProp;
|
|
1507
|
+
onSortChange?: (sort: TableSort) => void;
|
|
1508
|
+
filter?: TableFilter;
|
|
1509
|
+
defaultFilter?: TableFilter;
|
|
1510
|
+
onFilterChange?: (filter: TableFilter) => void;
|
|
1511
|
+
page?: number;
|
|
1512
|
+
defaultPage?: number;
|
|
1513
|
+
onPageChange?: (page: number) => void;
|
|
1514
|
+
pagination?: HazoUiTablePagination | false;
|
|
1515
|
+
enableSortDialog?: boolean;
|
|
1516
|
+
enableFilterDialog?: boolean;
|
|
1517
|
+
enableSearch?: boolean;
|
|
1518
|
+
searchPlaceholder?: string;
|
|
1519
|
+
searchDebounceMs?: number;
|
|
1520
|
+
loading?: boolean;
|
|
1521
|
+
empty?: React.ReactNode;
|
|
1522
|
+
noResults?: React.ReactNode;
|
|
1523
|
+
/**
|
|
1524
|
+
* Rendered when `onLoad` rejects. Receives the thrown error.
|
|
1525
|
+
* If not provided (or returns null), the table falls back to the
|
|
1526
|
+
* `noResults` empty-state visual. `console.warn` runs regardless.
|
|
1527
|
+
*/
|
|
1528
|
+
error?: React.ReactNode | ((err: unknown) => React.ReactNode);
|
|
1529
|
+
onRowClick?: (row: TRow, index: number) => void;
|
|
1530
|
+
mobileCardFallback?: boolean;
|
|
1531
|
+
mobileBreakpoint?: number;
|
|
1532
|
+
onLoad?: (args: HazoUiTableServerLoadArgs) => Promise<HazoUiTableServerLoadResult<TRow>>;
|
|
1533
|
+
className?: string;
|
|
1534
|
+
caption?: string;
|
|
1535
|
+
}
|
|
1536
|
+
|
|
1537
|
+
declare function HazoUiTable<TRow extends object = any>(props: HazoUiTableProps<TRow>): react_jsx_runtime.JSX.Element;
|
|
1538
|
+
|
|
1539
|
+
export { ANIMATION_PRESETS, Accordion, AccordionContent, AccordionItem, AccordionTrigger, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogOverlay, AlertDialogPortal, AlertDialogTitle, AlertDialogTrigger, type AnimationPreset, type BaseCommandInputProps, Button, ButtonGroup, ButtonGroupSeparator, ButtonGroupText, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type CommandEditContext, type CommandItem$1 as CommandItem, CommandNodeExtension, CommandPill, type CommandPillProps, CommandPopover, type CommandPopoverProps, type CommandTextOutput, type ConfirmDialogVariant, type DialogVariant, Drawer, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerOverlay, DrawerPortal, DrawerTitle, DrawerTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyState, type EmptyStateProps, ErrorBanner, type ErrorBannerProps, type ErrorBannerSeverity, ErrorPage, type ErrorPageProps, type FilterConfig, type FilterField, type HazoUiConfig, HazoUiConfirmDialog, type HazoUiConfirmDialogProps, HazoUiDialog, DialogClose as HazoUiDialogClose, DialogContent as HazoUiDialogContent, DialogDescription as HazoUiDialogDescription, DialogFooter as HazoUiDialogFooter, DialogHeader as HazoUiDialogHeader, DialogOverlay as HazoUiDialogOverlay, DialogPortal as HazoUiDialogPortal, type HazoUiDialogProps, Dialog as HazoUiDialogRoot, DialogTitle as HazoUiDialogTitle, DialogTrigger as HazoUiDialogTrigger, HazoUiFlexInput, type HazoUiFlexInputProps, HazoUiFlexRadio, type HazoUiFlexRadioItem, type HazoUiFlexRadioProps, HazoUiKanban, HazoUiKanbanFilter, type HazoUiKanbanFilterProps, type HazoUiKanbanProps, HazoUiMultiFilterDialog, HazoUiMultiSortDialog, HazoUiPillRadio, type HazoUiPillRadioItem, type HazoUiPillRadioProps, HazoUiRte, type HazoUiRteProps, HazoUiTable, type HazoUiTablePagination, type HazoUiTableProps, type HazoUiTableServerLoadArgs, type HazoUiTableServerLoadResult, HazoUiTextarea, type HazoUiTextareaProps, HazoUiTextbox, type HazoUiTextboxProps, HazoUiToaster, type HazoUiToasterProps, HoverCard, HoverCardContent, HoverCardTrigger, Input, type InsertedCommand, type KanbanAnnouncements, type KanbanColumn, type KanbanEditorCtx, type KanbanEditorField, type KanbanEditorFieldType, type KanbanFilterValue, type KanbanItem, type KanbanMoveEvent, type KanbanMoveHandle, type KanbanPriority, type KanbanReorderEvent, type KanbanSaveEvent, Label, LoadingTimeout, type LoadingTimeoutProps, Popover, PopoverContent, PopoverTrigger, type PrefixColor, type PrefixConfig, ProgressiveImage, type ProgressiveImageProps, RadioGroup, RadioGroupItem, type RteAttachment, type RteOutput, type RteVariable, ScrollArea, ScrollBar, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Command as ShadcnCommand, CommandEmpty as ShadcnCommandEmpty, CommandGroup as ShadcnCommandGroup, CommandInput as ShadcnCommandInput, CommandItem as ShadcnCommandItem, CommandList as ShadcnCommandList, Skeleton, SkeletonBar, type SkeletonBarProps, SkeletonCircle, type SkeletonCircleProps, SkeletonGroup, type SkeletonGroupProps, SkeletonRect, type SkeletonRectProps, type SortConfig, type SortField, Spinner, type SuggestionState, Switch, Table, TableBody, TableCaption, TableCell, type TableColumn, type TableFilter, TableFooter, type TableFormatter, TableHead, TableHeader, TableRow, type TableSort, type TableSortEntry, type TableSortProp, Tabs, TabsContent, TabsList, TabsTrigger, Textarea, type ToastOptions, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type UseErrorDisplayResult, type UseLoadingStateResult, applyKanbanFilter, buttonGroupVariants, create_command_suggestion_extension, errorToast, get_hazo_ui_config, parse_commands_from_text, reset_hazo_ui_config, resolve_animation_classes, set_hazo_ui_config, successToast, text_to_tiptap_content, toggleVariants, useErrorDisplay, useLoadingState, useMediaQuery };
|