@douglasneuroinformatics/libui 4.4.0 → 4.4.1

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.
@@ -21,6 +21,7 @@ import * as _radix_ui_react_collapsible from '@radix-ui/react-collapsible';
21
21
  import * as _radix_ui_react_context_menu from '@radix-ui/react-context-menu';
22
22
  import * as _radix_ui_react_dialog from '@radix-ui/react-dialog';
23
23
  import { Drawer as Drawer$1 } from 'vaul';
24
+ import { ZodTypeLike, ZodErrorLike } from '@douglasneuroinformatics/libjs';
24
25
  import { FormDataType, FormContent, PartialNullableFormDataType } from '@douglasneuroinformatics/libui-form-types';
25
26
  import * as _radix_ui_react_hover_card from '@radix-ui/react-hover-card';
26
27
  import * as LabelPrimitive from '@radix-ui/react-label';
@@ -1196,6 +1197,53 @@ declare const CopyButton: React__default.FC<{
1196
1197
  variant?: ButtonProps['variant'];
1197
1198
  }>;
1198
1199
 
1200
+ type RowAction<TData extends {
1201
+ [key: string]: unknown;
1202
+ }> = {
1203
+ destructive?: boolean;
1204
+ label: string;
1205
+ onSelect: (row: TData) => Promisable<void>;
1206
+ };
1207
+
1208
+ type StaticDataTableColumn<TData extends {
1209
+ [key: string]: unknown;
1210
+ }> = {
1211
+ [K in Extract<keyof TData, string>]: {
1212
+ format?: 'email' | ((val: TData[K]) => unknown);
1213
+ key: K;
1214
+ label: string;
1215
+ sortable?: boolean;
1216
+ };
1217
+ }[Extract<keyof TData, string>];
1218
+ type DynamicDataTableColumn<TData extends {
1219
+ [key: string]: unknown;
1220
+ }> = {
1221
+ compute: (row: TData) => unknown;
1222
+ key?: never;
1223
+ label: string;
1224
+ };
1225
+ type DataTableColumn<TData extends {
1226
+ [key: string]: unknown;
1227
+ }> = DynamicDataTableColumn<TData> | StaticDataTableColumn<TData>;
1228
+ type DataTableProps<TData extends {
1229
+ [key: string]: unknown;
1230
+ }> = {
1231
+ columns: DataTableColumn<TData>[];
1232
+ data: TData[];
1233
+ headerActions?: {
1234
+ label: string;
1235
+ onClick: () => void;
1236
+ }[];
1237
+ rowActions?: RowAction<TData>[];
1238
+ search?: {
1239
+ key: Extract<keyof TData, string>;
1240
+ placeholder?: string;
1241
+ };
1242
+ };
1243
+ declare const DataTable: <TData extends {
1244
+ [key: string]: unknown;
1245
+ }>({ columns, data, headerActions, rowActions, search }: DataTableProps<TData>) => react_jsx_runtime.JSX.Element;
1246
+
1199
1247
  type DatePickerProps = {
1200
1248
  onMouseEnter?: React$1.MouseEventHandler<HTMLDivElement>;
1201
1249
  onMouseLeave?: React$1.MouseEventHandler<HTMLDivElement>;
@@ -1276,35 +1324,7 @@ type FileDropzoneProps = {
1276
1324
  };
1277
1325
  declare const FileDropzone: ({ acceptedFileTypes, className, description, file, setFile, titles }: FileDropzoneProps) => react_jsx_runtime.JSX.Element;
1278
1326
 
1279
- type ZodIssueLike = {
1280
- [key: string]: any;
1281
- readonly code: string;
1282
- readonly message: string;
1283
- readonly path: PropertyKey[];
1284
- };
1285
- type ZodErrorLike = {
1286
- cause?: unknown;
1287
- issues: ZodIssueLike[];
1288
- name: string;
1289
- };
1290
- type ZodSafeParseResultLike<T> = ZodSafeParseErrorLike | ZodSafeParseSuccessLike<T>;
1291
- type ZodSafeParseSuccessLike<TOutput> = {
1292
- data: TOutput;
1293
- error?: never;
1294
- success: true;
1295
- };
1296
- type ZodSafeParseErrorLike = {
1297
- data?: never;
1298
- error: ZodErrorLike;
1299
- success: false;
1300
- };
1301
- type ZodTypeLike<TOutput, TInput = TOutput> = {
1302
- readonly _input: TInput;
1303
- readonly _output: TOutput;
1304
- safeParseAsync: (data: unknown) => Promise<ZodSafeParseResultLike<TOutput>>;
1305
- };
1306
-
1307
- type FormProps<TSchema extends ZodTypeLike<FormDataType>, TData extends TSchema['_input'] = TSchema['_input']> = {
1327
+ type FormProps<TSchema extends ZodTypeLike<FormDataType>, TData extends TSchema['_output'] = TSchema['_output']> = {
1308
1328
  [key: `data-${string}`]: unknown;
1309
1329
  additionalButtons?: {
1310
1330
  left?: React.ReactNode;
@@ -1335,7 +1355,7 @@ type FormProps<TSchema extends ZodTypeLike<FormDataType>, TData extends TSchema[
1335
1355
  suspendWhileSubmitting?: boolean;
1336
1356
  validationSchema: ZodTypeLike<TData>;
1337
1357
  };
1338
- declare const Form: <TSchema extends ZodTypeLike<FormDataType>, TData extends TSchema["_input"] = TSchema["_input"]>({ additionalButtons, className, content, customStyles, fieldsFooter, id, initialValues, onBeforeSubmit, onError, onSubmit, preventResetValuesOnReset, readOnly, resetBtn, revalidateOnBlur, submitBtnLabel, suspendWhileSubmitting, validationSchema, ...props }: FormProps<TSchema, TData>) => react_jsx_runtime.JSX.Element;
1358
+ declare const Form: <TSchema extends ZodTypeLike<FormDataType>, TData extends TSchema["_output"] = TSchema["_output"]>({ additionalButtons, className, content, customStyles, fieldsFooter, id, initialValues, onBeforeSubmit, onError, onSubmit, preventResetValuesOnReset, readOnly, resetBtn, revalidateOnBlur, submitBtnLabel, suspendWhileSubmitting, validationSchema, ...props }: FormProps<TSchema, TData>) => react_jsx_runtime.JSX.Element;
1339
1359
 
1340
1360
  type HeadingProps = {
1341
1361
  children: string;
@@ -1622,4 +1642,4 @@ declare const Tooltip: (({ children, delayDuration, onOpenChange, open, skipDela
1622
1642
  Trigger: React$1.ForwardRefExoticComponent<TooltipTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
1623
1643
  };
1624
1644
 
1625
- export { Accordion, ActionDropdown, type ActionDropdownProps, AlertDialog, ArrowToggle, type ArrowToggleProps, Avatar, BUTTON_ICON_SIZE, Badge, type BadgeProps, type BaseSearchBarProps, Breadcrumb, Button, type ButtonProps, Card, Chart, ChartConfig, Checkbox, type ClientFieldFactory, ClientTable, type ClientTableColumn, type ClientTableColumnProps, type ClientTableDropdownOptions, type ClientTableEntry, type ClientTableProps, Collapsible, Command, ContextMenu, CopyButton, DatePicker, type DatePickerProps, Dialog, Drawer, DropdownButton, DropdownMenu, ErrorBoundary, ErrorFallback, type ErrorFallbackProps, FileDropzone, type FileDropzoneProps, Form, type FormProps, Heading, type HeadingProps, HoverCard, Input, type InputProps, Label, LanguageToggle, type LanguageToggleProps, LineGraph, type LineGraphData, type LineGraphLine, ListboxDropdown, type ListboxDropdownOption, type ListboxDropdownProps, MenuBar, NotificationHub, type NotificationHubProps, OneTimePasswordInput, Popover, Progress, RadioGroup, type RadioGroupProps, Resizable, ScrollArea, SearchBar, type SearchBarProps, Select, Separator, Sheet, Slider, Spinner, SpinnerIcon, StatisticCard, Switch, Table, Tabs, TextArea, type TextAreaProps, ThemeToggle, type ThemeToggleProps, Tooltip, badgeVariants, buttonVariants, labelVariants };
1645
+ export { Accordion, ActionDropdown, type ActionDropdownProps, AlertDialog, ArrowToggle, type ArrowToggleProps, Avatar, BUTTON_ICON_SIZE, Badge, type BadgeProps, type BaseSearchBarProps, Breadcrumb, Button, type ButtonProps, Card, Chart, ChartConfig, Checkbox, type ClientFieldFactory, ClientTable, type ClientTableColumn, type ClientTableColumnProps, type ClientTableDropdownOptions, type ClientTableEntry, type ClientTableProps, Collapsible, Command, ContextMenu, CopyButton, DataTable, type DataTableColumn, DatePicker, type DatePickerProps, Dialog, Drawer, DropdownButton, DropdownMenu, ErrorBoundary, ErrorFallback, type ErrorFallbackProps, FileDropzone, type FileDropzoneProps, Form, type FormProps, Heading, type HeadingProps, HoverCard, Input, type InputProps, Label, LanguageToggle, type LanguageToggleProps, LineGraph, type LineGraphData, type LineGraphLine, ListboxDropdown, type ListboxDropdownOption, type ListboxDropdownProps, MenuBar, NotificationHub, type NotificationHubProps, OneTimePasswordInput, Popover, Progress, RadioGroup, type RadioGroupProps, Resizable, ScrollArea, SearchBar, type SearchBarProps, Select, Separator, Sheet, Slider, Spinner, SpinnerIcon, StatisticCard, Switch, Table, Tabs, TextArea, type TextAreaProps, ThemeToggle, type ThemeToggleProps, Tooltip, badgeVariants, buttonVariants, labelVariants };