@douglasneuroinformatics/libui 4.9.0 → 5.0.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 (32) hide show
  1. package/dist/components.d.ts +5 -48
  2. package/dist/components.js +1111 -738
  3. package/dist/components.js.map +1 -1
  4. package/dist/hooks.d.ts +4 -2
  5. package/dist/providers.js +1 -1
  6. package/dist/providers.js.map +1 -1
  7. package/dist/{types-9zYgx7C8.d.ts → types-CQ7qbFhC.d.ts} +57 -1
  8. package/package.json +3 -2
  9. package/src/components/DataTable/DataTable.stories.tsx +207 -37
  10. package/src/components/DataTable/DataTable.tsx +22 -279
  11. package/src/components/DataTable/DataTableBody.tsx +69 -0
  12. package/src/components/DataTable/DataTableContent.tsx +36 -0
  13. package/src/components/DataTable/DataTableControls.tsx +55 -0
  14. package/src/components/DataTable/DataTableEmptyState.tsx +25 -0
  15. package/src/components/DataTable/DataTableHead.tsx +58 -0
  16. package/src/components/DataTable/DataTablePagination.tsx +62 -0
  17. package/src/components/DataTable/DataTableRowActionCell.tsx +67 -0
  18. package/src/components/DataTable/__tests__/DataTable.spec.tsx +60 -0
  19. package/src/components/DataTable/constants.ts +7 -0
  20. package/src/components/DataTable/context.ts +5 -0
  21. package/src/components/DataTable/hooks.ts +60 -0
  22. package/src/components/DataTable/store.ts +203 -0
  23. package/src/components/DataTable/types.ts +99 -0
  24. package/src/components/DataTable/utils.tsx +138 -0
  25. package/src/components/Form/BooleanField/BooleanFieldRadio.tsx +6 -12
  26. package/src/components/Form/Form.stories.tsx +2 -0
  27. package/src/hooks/useDestructiveAction/useDestructiveActionStore.test.ts +2 -7
  28. package/src/hooks/useNotificationsStore/useNotificationsStore.test.ts +1 -8
  29. package/src/providers/CoreProvider/DestructiveActionDialog.tsx +1 -1
  30. package/src/testing/setup-tests.ts +1 -3
  31. package/src/components/DataTable/DestructiveActionDialog.tsx +0 -67
  32. package/src/components/DataTable/RowActionsDropdown.tsx +0 -64
@@ -13,12 +13,13 @@ import * as recharts_types_util_payload_getUniqPayload from 'recharts/types/util
13
13
  import * as recharts_types_component_Tooltip from 'recharts/types/component/Tooltip';
14
14
  import * as recharts_types_util_types from 'recharts/types/util/types';
15
15
  import * as recharts_types_component_DefaultTooltipContent from 'recharts/types/component/DefaultTooltipContent';
16
- import { C as ChartConfig } from './types-9zYgx7C8.js';
16
+ import { C as ChartConfig, D as DataTableProps } from './types-CQ7qbFhC.js';
17
17
  import * as recharts from 'recharts';
18
18
  import { Legend, Tooltip as Tooltip$1, LineProps } from 'recharts';
19
19
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
20
20
  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
+ import { RowData } from '@tanstack/table-core';
22
23
  import * as _radix_ui_react_dialog from '@radix-ui/react-dialog';
23
24
  import { Drawer as Drawer$1 } from 'vaul';
24
25
  import { ZodTypeLike, ZodErrorLike } from '@douglasneuroinformatics/libjs';
@@ -38,6 +39,7 @@ import * as SeparatorPrimitive from '@radix-ui/react-separator';
38
39
  import * as _radix_ui_react_slider from '@radix-ui/react-slider';
39
40
  import * as SwitchPrimitives from '@radix-ui/react-switch';
40
41
  import * as _radix_ui_react_tabs from '@radix-ui/react-tabs';
42
+ import 'lucide-react';
41
43
 
42
44
  declare const Accordion: React$1.ForwardRefExoticComponent<(Omit<_radix_ui_react_accordion.AccordionSingleProps & React$1.RefAttributes<HTMLDivElement>, "ref"> | Omit<_radix_ui_react_accordion.AccordionMultipleProps & React$1.RefAttributes<HTMLDivElement>, "ref">) & React$1.RefAttributes<HTMLDivElement>> & {
43
45
  Content: React$1.ForwardRefExoticComponent<Omit<_radix_ui_react_accordion.AccordionContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
@@ -1191,52 +1193,7 @@ declare const CopyButton: React__default.FC<{
1191
1193
  variant?: ButtonProps['variant'];
1192
1194
  }>;
1193
1195
 
1194
- type RowAction<TData extends {
1195
- [key: string]: unknown;
1196
- }> = {
1197
- destructive?: boolean;
1198
- label: string;
1199
- onSelect: (row: TData) => Promisable<void>;
1200
- };
1201
-
1202
- type StaticDataTableColumn<TData extends {
1203
- [key: string]: unknown;
1204
- }> = {
1205
- [K in Extract<keyof TData, string>]: {
1206
- format?: 'email' | ((val: TData[K]) => unknown);
1207
- key: K;
1208
- label: string;
1209
- sortable?: boolean;
1210
- };
1211
- }[Extract<keyof TData, string>];
1212
- type DynamicDataTableColumn<TData extends {
1213
- [key: string]: unknown;
1214
- }> = {
1215
- compute: (row: TData) => unknown;
1216
- key?: never;
1217
- label: string;
1218
- };
1219
- type DataTableColumn<TData extends {
1220
- [key: string]: unknown;
1221
- }> = DynamicDataTableColumn<TData> | StaticDataTableColumn<TData>;
1222
- type DataTableProps<TData extends {
1223
- [key: string]: unknown;
1224
- }> = {
1225
- columns: DataTableColumn<TData>[];
1226
- data: TData[];
1227
- headerActions?: {
1228
- label: string;
1229
- onClick: () => void;
1230
- }[];
1231
- rowActions?: RowAction<TData>[];
1232
- search?: {
1233
- key: Extract<keyof TData, string>;
1234
- placeholder?: string;
1235
- };
1236
- };
1237
- declare const DataTable: <TData extends {
1238
- [key: string]: unknown;
1239
- }>({ columns, data, headerActions, rowActions, search }: DataTableProps<TData>) => react_jsx_runtime.JSX.Element;
1196
+ declare const DataTable: <T extends RowData>({ emptyStateProps, onSearchChange, togglesComponent, ...props }: DataTableProps<T>) => react_jsx_runtime.JSX.Element;
1240
1197
 
1241
1198
  type DatePickerProps = {
1242
1199
  onMouseEnter?: React$1.MouseEventHandler<HTMLDivElement>;
@@ -1642,4 +1599,4 @@ type NotificationHubProps = {
1642
1599
  };
1643
1600
  declare const NotificationHub: ({ timeout }: NotificationHubProps) => react_jsx_runtime.JSX.Element;
1644
1601
 
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, 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 };
1602
+ 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, 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, 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 };