@douglasneuroinformatics/libui 4.3.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.
- package/dist/components.d.ts +53 -6
- package/dist/components.js +948 -652
- package/dist/components.js.map +1 -1
- package/package.json +3 -3
- package/src/components/DataTable/DataTable.stories.tsx +14 -14
- package/src/components/DataTable/DataTable.tsx +24 -23
- package/src/components/DataTable/DestructiveActionDialog.tsx +2 -6
- package/src/components/Form/Form.stories.tsx +4 -3
- package/src/components/Form/Form.test.tsx +1 -1
- package/src/components/Form/Form.tsx +6 -6
- package/src/components/index.ts +1 -0
package/dist/components.d.ts
CHANGED
|
@@ -21,8 +21,8 @@ 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
|
-
import { z } from 'zod';
|
|
26
26
|
import * as _radix_ui_react_hover_card from '@radix-ui/react-hover-card';
|
|
27
27
|
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
28
28
|
import { L as Language } from './types-DDyMlEuL.js';
|
|
@@ -1197,6 +1197,53 @@ declare const CopyButton: React__default.FC<{
|
|
|
1197
1197
|
variant?: ButtonProps['variant'];
|
|
1198
1198
|
}>;
|
|
1199
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
|
+
|
|
1200
1247
|
type DatePickerProps = {
|
|
1201
1248
|
onMouseEnter?: React$1.MouseEventHandler<HTMLDivElement>;
|
|
1202
1249
|
onMouseLeave?: React$1.MouseEventHandler<HTMLDivElement>;
|
|
@@ -1277,7 +1324,7 @@ type FileDropzoneProps = {
|
|
|
1277
1324
|
};
|
|
1278
1325
|
declare const FileDropzone: ({ acceptedFileTypes, className, description, file, setFile, titles }: FileDropzoneProps) => react_jsx_runtime.JSX.Element;
|
|
1279
1326
|
|
|
1280
|
-
type FormProps<TSchema extends
|
|
1327
|
+
type FormProps<TSchema extends ZodTypeLike<FormDataType>, TData extends TSchema['_output'] = TSchema['_output']> = {
|
|
1281
1328
|
[key: `data-${string}`]: unknown;
|
|
1282
1329
|
additionalButtons?: {
|
|
1283
1330
|
left?: React.ReactNode;
|
|
@@ -1298,7 +1345,7 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
|
|
|
1298
1345
|
} | {
|
|
1299
1346
|
success: true;
|
|
1300
1347
|
}>) | null;
|
|
1301
|
-
onError?: (error:
|
|
1348
|
+
onError?: (error: ZodErrorLike) => void;
|
|
1302
1349
|
onSubmit: (data: NoInfer<TData>) => Promisable<void>;
|
|
1303
1350
|
preventResetValuesOnReset?: boolean;
|
|
1304
1351
|
readOnly?: boolean;
|
|
@@ -1306,9 +1353,9 @@ type FormProps<TSchema extends z.ZodType<FormDataType>, TData extends z.TypeOf<T
|
|
|
1306
1353
|
revalidateOnBlur?: boolean;
|
|
1307
1354
|
submitBtnLabel?: string;
|
|
1308
1355
|
suspendWhileSubmitting?: boolean;
|
|
1309
|
-
validationSchema:
|
|
1356
|
+
validationSchema: ZodTypeLike<TData>;
|
|
1310
1357
|
};
|
|
1311
|
-
declare const Form: <TSchema extends
|
|
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;
|
|
1312
1359
|
|
|
1313
1360
|
type HeadingProps = {
|
|
1314
1361
|
children: string;
|
|
@@ -1595,4 +1642,4 @@ declare const Tooltip: (({ children, delayDuration, onOpenChange, open, skipDela
|
|
|
1595
1642
|
Trigger: React$1.ForwardRefExoticComponent<TooltipTriggerProps & React$1.RefAttributes<HTMLButtonElement>>;
|
|
1596
1643
|
};
|
|
1597
1644
|
|
|
1598
|
-
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 };
|