@yusr_systems/ui 2.1.2 → 2.1.4

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/index.d.ts CHANGED
@@ -1,14 +1,16 @@
1
1
  import { ActionCreatorWithPayload } from '@reduxjs/toolkit';
2
2
  import * as AlertDialogPrimitive from '@radix-ui/react-alert-dialog';
3
3
  import { AsyncThunk } from '@reduxjs/toolkit';
4
+ import { AsyncThunkConfig } from '@reduxjs/toolkit';
4
5
  import * as AvatarPrimitive from '@radix-ui/react-avatar';
5
- import { BaseApiService } from '@yusr_systems/core/src/networking';
6
- import { BaseEntity } from '@yusr_systems/core/src/entities';
7
- import { BaseFilterableApiService } from '@yusr_systems/core/src/networking';
6
+ import { BaseApiService } from '@yusr_systems/core';
7
+ import { BaseEntity } from '@yusr_systems/core';
8
+ import { BaseFilterableApiService } from '@yusr_systems/core';
9
+ import { CaseReducerActions } from '@reduxjs/toolkit';
8
10
  import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
9
11
  import { ClassProp } from 'class-variance-authority/types';
10
12
  import { ClassValue } from 'clsx';
11
- import { ColumnName } from '@yusr_systems/core/src/types';
13
+ import { ColumnName } from '@yusr_systems/core';
12
14
  import { Combobox as Combobox_2 } from '@base-ui/react/combobox';
13
15
  import { Command as Command_2 } from 'cmdk';
14
16
  import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
@@ -23,8 +25,8 @@ import { Dispatch as Dispatch_2 } from '@reduxjs/toolkit';
23
25
  import { Draft } from 'immer';
24
26
  import { Drawer as Drawer_2 } from 'vaul';
25
27
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
26
- import { FilterCondition } from '@yusr_systems/core/src/entities';
27
- import { FilterResult } from '@yusr_systems/core/src/types';
28
+ import { FilterCondition } from '@yusr_systems/core';
29
+ import { FilterResult } from '@yusr_systems/core';
28
30
  import { JSX } from 'react/jsx-runtime';
29
31
  import * as LabelPrimitive from '@radix-ui/react-label';
30
32
  import { Locale } from 'react-day-picker';
@@ -34,17 +36,18 @@ import { PropsWithChildren } from 'react';
34
36
  import * as React_2 from 'react';
35
37
  import { ReactNode } from 'react';
36
38
  import * as RechartsPrimitive from 'recharts';
37
- import { Reducer } from '@reduxjs/toolkit';
39
+ import { Reducer } from 'redux';
38
40
  import { RefObject } from 'react';
39
- import { RequestResult } from '@yusr_systems/core/src/types';
40
- import { ResourcePermissions } from '@yusr_systems/core/src/auth/permissionSelector';
41
+ import { RequestResult } from '@yusr_systems/core';
42
+ import { ResourcePermissions } from '@yusr_systems/core';
41
43
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
42
44
  import * as SelectPrimitive from '@radix-ui/react-select';
43
45
  import * as SeparatorPrimitive from '@radix-ui/react-separator';
44
46
  import { SetStateAction } from 'react';
45
47
  import { Slice } from '@reduxjs/toolkit';
48
+ import { SliceCaseReducers } from '@reduxjs/toolkit';
46
49
  import { SliceSelectors } from '@reduxjs/toolkit';
47
- import { StorageFile } from '@yusr_systems/core/src/entities';
50
+ import { StorageFile } from '@yusr_systems/core';
48
51
  import * as SwitchPrimitive from '@radix-ui/react-switch';
49
52
  import * as TabsPrimitive from '@radix-ui/react-tabs';
50
53
  import { ToasterProps } from 'sonner';
@@ -53,7 +56,7 @@ import * as TogglePrimitive from '@radix-ui/react-toggle';
53
56
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
54
57
  import { UnknownAction } from '@reduxjs/toolkit';
55
58
  import { UseEmblaCarouselType } from 'embla-carousel-react';
56
- import { ValidationRule } from '@yusr_systems/core/src/validation/validationRule';
59
+ import { ValidationRule } from '@yusr_systems/core';
57
60
  import { VariantProps } from 'class-variance-authority';
58
61
 
59
62
  export declare function Alert({ className, variant, ...props }: React_2.ComponentProps<"div"> & VariantProps<typeof alertVariants>): JSX.Element;
@@ -149,7 +152,7 @@ export declare function Button({ className, variant, size, asChild, ...props }:
149
152
 
150
153
  export declare const buttonVariants: (props?: ({
151
154
  variant?: "link" | "default" | "outline" | "secondary" | "ghost" | "destructive" | null | undefined;
152
- size?: "default" | "icon" | "xs" | "sm" | "lg" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
155
+ size?: "default" | "xs" | "sm" | "lg" | "icon" | "icon-xs" | "icon-sm" | "icon-lg" | null | undefined;
153
156
  } & ClassProp) | undefined) => string;
154
157
 
155
158
  export declare function Calendar({ className, classNames, showOutsideDays, captionLayout, buttonVariant, locale, formatters, components, ...props }: React_2.ComponentProps<typeof DayPicker> & {
@@ -402,9 +405,35 @@ export declare function createGenericDialogSlice<T>(sliceName: string): Slice<ID
402
405
  }, action: PayloadAction<boolean>) => void;
403
406
  }, string, string, SliceSelectors<IDialogState<T>>>;
404
407
 
405
- export declare function createGenericEntitySlice<T extends BaseEntity>(sliceName: string, service: BaseFilterableApiService<T>, filterMethod?: FilterMethodType<T>): {
408
+ export declare function createGenericEntitySlice<T extends BaseEntity, CR extends SliceCaseReducers<IEntityState<T>> = {}>(sliceName: string, service: BaseFilterableApiService<T>, filterMethod?: FilterMethodType<T>, customReducers?: CR): {
406
409
  reducer: Reducer<IEntityState<T>>;
407
- actions: EntityActions<T>;
410
+ actions: CaseReducerActions<{
411
+ setCurrentPage: (state: {
412
+ entities: {
413
+ data: Draft<T>[] | undefined;
414
+ count: number;
415
+ };
416
+ isLoaded: boolean;
417
+ isLoading: boolean;
418
+ currentPage: number;
419
+ rowsPerPage: number;
420
+ }, action: PayloadAction<number>) => void;
421
+ refresh: (state: {
422
+ entities: {
423
+ data: Draft<T>[] | undefined;
424
+ count: number;
425
+ };
426
+ isLoaded: boolean;
427
+ isLoading: boolean;
428
+ currentPage: number;
429
+ rowsPerPage: number;
430
+ }, action: PayloadAction<{
431
+ data?: T;
432
+ deletedId?: number;
433
+ }>) => void;
434
+ } & CR, string> & {
435
+ filter: AsyncThunk<FilterResult<T> | undefined, FilterCondition | undefined, AsyncThunkConfig>;
436
+ };
408
437
  };
409
438
 
410
439
  export declare interface CrudActions<T extends BaseEntity> {
@@ -634,15 +663,6 @@ declare type EmptyTablePreviewProps = {
634
663
 
635
664
  export declare function EmptyTitle({ className, ...props }: React.ComponentProps<"div">): JSX.Element;
636
665
 
637
- export declare type EntityActions<T> = {
638
- setCurrentPage: ActionCreatorWithPayload<number, string>;
639
- refresh: ActionCreatorWithPayload<{
640
- data?: T;
641
- deletedId?: number;
642
- }, string>;
643
- filter: AsyncThunk<FilterResult<T> | undefined, FilterCondition | undefined, any>;
644
- };
645
-
646
666
  export declare function Field({ className, orientation, ...props }: React.ComponentProps<"div"> & VariantProps<typeof fieldVariants>): JSX.Element;
647
667
 
648
668
  export declare function FieldContent({ className, ...props }: React.ComponentProps<"div">): JSX.Element;