@cronocode/react-box 3.0.13 → 3.0.14
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/array.d.ts +13 -0
- package/components/checkbox.mjs +4 -4
- package/components/dataGrid/contracts/dataGridContract.d.ts +36 -0
- package/components/dataGrid/dataGridCell.d.ts +8 -0
- package/components/dataGrid/dataGridGroupRow.d.ts +6 -0
- package/components/dataGrid/dataGridHeaderCell.d.ts +6 -0
- package/components/dataGrid/dataGridPagination.d.ts +6 -0
- package/components/dataGrid/dataGridRow.d.ts +6 -0
- package/components/dataGrid/models/cellModel.d.ts +10 -0
- package/components/dataGrid/models/columnModel.d.ts +36 -0
- package/components/dataGrid/models/gridModel.d.ts +44 -0
- package/components/dataGrid/models/groupRowCellModel.d.ts +10 -0
- package/components/dataGrid/models/groupRowModel.d.ts +23 -0
- package/components/dataGrid/models/rowModel.d.ts +16 -0
- package/components/dataGrid/useGrid.d.ts +3 -0
- package/components/dataGrid.cjs +1 -1
- package/components/dataGrid.d.ts +2 -7
- package/components/dataGrid.mjs +656 -18
- package/components/dropdown.cjs +1 -1
- package/components/dropdown.d.ts +2 -2
- package/components/dropdown.mjs +62 -61
- package/components/form.mjs +5 -5
- package/components/semantics.d.ts +25 -25
- package/components/tooltip.cjs +1 -1
- package/components/tooltip.mjs +20 -22
- package/core/boxConstants.d.ts +1 -0
- package/core/boxStyles.d.ts +108 -35
- package/core/boxStylesFormatters.d.ts +1 -1
- package/core/classNames.d.ts +1 -1
- package/core/extends/boxComponents.d.ts +86 -1
- package/core/useStyles.d.ts +2 -2
- package/core/variables.d.ts +1 -0
- package/core.cjs +4 -4
- package/core.mjs +623 -507
- package/hooks/useVisibility.d.ts +9 -1
- package/icons/arrowIcon.d.ts +2 -0
- package/icons/dotsIcon.d.ts +2 -0
- package/icons/groupingIcon.d.ts +2 -0
- package/icons/pinIcon.d.ts +2 -0
- package/package.json +1 -1
- package/types.d.ts +12 -23
- package/utils/fn/fnUtils.d.ts +4 -0
- package/utils/memo.d.ts +5 -0
- package/utils/object/objectUtils.d.ts +1 -1
- package/components/dataGrid/dataGridContract.d.ts +0 -24
- package/components/dataGrid/useGridData.d.ts +0 -7
package/hooks/useVisibility.d.ts
CHANGED
|
@@ -1 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
interface Props<T extends HTMLElement = HTMLDivElement> {
|
|
2
|
+
node?: Nullable<T>;
|
|
3
|
+
event?: 'mousedown' | 'click';
|
|
4
|
+
hideOnScroll?: boolean;
|
|
5
|
+
hideOnResize?: boolean;
|
|
6
|
+
hideOnEscape?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export default function useVisibility<T extends HTMLElement = HTMLDivElement>(props?: Props<T>): [boolean, React.Dispatch<React.SetStateAction<boolean>>, React.RefObject<T>];
|
|
9
|
+
export {};
|
package/package.json
CHANGED
package/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { breakpoints, cssStyles, pseudo1, pseudo2, pseudoClasses, pseudoGroupClasses } from './core/boxStyles';
|
|
2
|
+
import { ClassNameType } from './core/classNames';
|
|
2
3
|
import { BoxStyle, BoxStylesType, ExtractKeys } from './core/coreTypes';
|
|
3
4
|
import { default as boxComponents } from './core/extends/boxComponents';
|
|
4
5
|
export declare namespace Augmented {
|
|
@@ -29,30 +30,18 @@ type ExtractVariants<T> = T extends {
|
|
|
29
30
|
} ? keyof Variants extends never ? never : Extract<keyof Variants, string> : never;
|
|
30
31
|
type ExtractChildrenVariants<T> = T extends {
|
|
31
32
|
children?: infer Children;
|
|
32
|
-
} ?
|
|
33
|
-
|
|
33
|
+
} ? {
|
|
34
|
+
[K in keyof Children & string]: ExtractVariants<Children[K]> | ExtractChildrenVariants<Children[K]>;
|
|
35
|
+
}[keyof Children & string] : never;
|
|
36
|
+
type ExtractChildrenNames<T, Prefix extends string = ''> = T extends {
|
|
34
37
|
children?: infer Children;
|
|
35
|
-
} ?
|
|
38
|
+
} ? {
|
|
39
|
+
[K in keyof Children & string]: `${Prefix}${Prefix extends '' ? '' : '.'}${K}` | ExtractChildrenNames<Children[K], `${Prefix}${Prefix extends '' ? '' : '.'}${K}`>;
|
|
40
|
+
}[keyof Children & string] : never;
|
|
36
41
|
export type ExtractComponentsAndVariants<T> = {
|
|
37
|
-
[K in keyof T
|
|
42
|
+
[K in keyof T & string]: ExtractVariants<T[K]> | ExtractChildrenVariants<T[K]>;
|
|
38
43
|
} & {
|
|
39
|
-
[K in keyof T as ExtractChildrenNames<T[K],
|
|
40
|
-
} & {
|
|
41
|
-
[K in keyof T as T[K] extends {
|
|
42
|
-
children?: infer Children;
|
|
43
|
-
} ? ExtractChildrenNames<Children[keyof Children], `${K & string}.${keyof Children & string}`> : never]: T[K] extends {
|
|
44
|
-
children?: infer Children;
|
|
45
|
-
} ? ExtractChildrenVariants<Children[keyof Children]> : never;
|
|
46
|
-
} & {
|
|
47
|
-
[K in keyof T as T[K] extends {
|
|
48
|
-
children?: infer Children;
|
|
49
|
-
} ? Children[keyof Children] extends {
|
|
50
|
-
children?: infer Children2;
|
|
51
|
-
} ? ExtractChildrenNames<Children2[keyof Children2], `${K & string}.${keyof Children & string}.${keyof Children2 & string}`> : never : never]: T[K] extends {
|
|
52
|
-
children?: infer Children;
|
|
53
|
-
} ? Children[keyof Children] extends {
|
|
54
|
-
children?: infer Children2;
|
|
55
|
-
} ? ExtractChildrenVariants<Children2[keyof Children2]> : never : never;
|
|
44
|
+
[K in keyof T & string as ExtractChildrenNames<T[K], K>]: ExtractChildrenVariants<T[K]>;
|
|
56
45
|
};
|
|
57
46
|
type MergeUnion<T, U> = {
|
|
58
47
|
[K in keyof T | keyof U]: K extends keyof T ? K extends keyof U ? T[K] | U[K] : T[K] : K extends keyof U ? U[K] : never;
|
|
@@ -60,11 +49,11 @@ type MergeUnion<T, U> = {
|
|
|
60
49
|
type Simplify<T> = T extends infer U ? {
|
|
61
50
|
[K in keyof U]: U[K];
|
|
62
51
|
} : never;
|
|
63
|
-
export type ComponentsAndVariants = MergeUnion<
|
|
52
|
+
export type ComponentsAndVariants = Simplify<MergeUnion<ExtractComponentsAndVariants<typeof boxComponents>, Augmented.ComponentsTypes>>;
|
|
64
53
|
export interface ComponentProps<TKey extends keyof ComponentsAndVariants = never> {
|
|
65
54
|
clean?: boolean;
|
|
66
55
|
component?: TKey;
|
|
67
|
-
variant?: ComponentsAndVariants[TKey]
|
|
56
|
+
variant?: ClassNameType<ComponentsAndVariants[TKey]>;
|
|
68
57
|
}
|
|
69
58
|
export type BoxStyleProps<TKey extends keyof ComponentsAndVariants = never> = Simplify<BoxStyles & BoxPseudoClassesStyles1 & BoxPseudoClassesStyles2TopLevel & BoxPseudoGroupClassesStyles & BoxBreakpointsStyles & ComponentProps<TKey>>;
|
|
70
59
|
export type BoxComponentStyles = Simplify<BoxStylesWithPseudoClasses & BoxBreakpointsStyles & BoxPseudoGroupClassesStyles>;
|
package/utils/memo.d.ts
ADDED
|
@@ -3,7 +3,7 @@ declare namespace ObjectUtils {
|
|
|
3
3
|
props?: Object;
|
|
4
4
|
}, TKey extends keyof T>(props: T, keys: Readonly<TKey[]>, extraTagProps?: Object): T;
|
|
5
5
|
function isObject(value: unknown): value is object;
|
|
6
|
-
function mergeDeep<T>(...objects:
|
|
6
|
+
function mergeDeep<T>(...objects: T[]): T;
|
|
7
7
|
function isKeyOf<T extends object>(key: any, obj: T): key is keyof T;
|
|
8
8
|
}
|
|
9
9
|
export default ObjectUtils;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Key } from 'react';
|
|
2
|
-
type KeysMatching<T, V> = {
|
|
3
|
-
[K in keyof T]-?: T[K] extends V ? K : never;
|
|
4
|
-
}[keyof T];
|
|
5
|
-
export interface GridDef<TRow> {
|
|
6
|
-
rowKey?: KeysMatching<TRow, Key> | ((rowData: TRow) => Key);
|
|
7
|
-
columns: GridColumn<TRow>[];
|
|
8
|
-
}
|
|
9
|
-
export interface GridCell<TRow> {
|
|
10
|
-
key: keyof TRow;
|
|
11
|
-
value: React.ReactNode;
|
|
12
|
-
}
|
|
13
|
-
export interface GridColumn<TRow> {
|
|
14
|
-
key: keyof TRow;
|
|
15
|
-
}
|
|
16
|
-
export interface GridRow<TRow> {
|
|
17
|
-
dataRow: TRow;
|
|
18
|
-
cells: GridCell<TRow>[];
|
|
19
|
-
}
|
|
20
|
-
export interface GridData<TRow> {
|
|
21
|
-
columns: GridColumn<TRow>[];
|
|
22
|
-
rows: GridRow<TRow>[];
|
|
23
|
-
}
|
|
24
|
-
export {};
|