@onewelcome/react-lib-components 0.2.3 → 0.2.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/DataGrid/DataGrid.d.ts +1 -1
- package/dist/Form/form.interfaces.d.ts +1 -1
- package/dist/hooks/usePosition.d.ts +2 -2
- package/dist/interfaces.d.ts +1 -1
- package/dist/react-lib-components.cjs.development.js +7 -3
- package/dist/react-lib-components.cjs.development.js.map +1 -1
- package/dist/react-lib-components.cjs.production.min.js +1 -1
- package/dist/react-lib-components.cjs.production.min.js.map +1 -1
- package/dist/react-lib-components.esm.js +7 -3
- package/dist/react-lib-components.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/ContextMenu/ContextMenu.test.tsx +1 -1
- package/src/ContextMenu/ContextMenuItem.tsx +2 -1
- package/src/DataGrid/DataGrid.tsx +1 -1
- package/src/DataGrid/DataGridBody/DataGridRow.tsx +1 -1
- package/src/Form/form.interfaces.ts +1 -1
- package/src/Link/types.d.ts +1 -1
- package/src/hooks/usePosition.ts +6 -5
- package/src/interfaces.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onewelcome/react-lib-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"author": "OneWelcome B.V.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"build": "dts build",
|
|
19
19
|
"build-storybook": "build-storybook",
|
|
20
20
|
"dev": "npm-run-all -p start test:watch storybook",
|
|
21
|
-
"lint": "eslint --fix '
|
|
21
|
+
"lint": "eslint --fix '**/*.{ts,tsx}'",
|
|
22
22
|
"prepare": "husky install && dts build",
|
|
23
23
|
"size": "size-limit",
|
|
24
24
|
"start": "dts watch",
|
|
@@ -46,8 +46,9 @@ export const ContextMenuItem = React.forwardRef<HTMLButtonElement, Props>(
|
|
|
46
46
|
}, [hasFocus, innerButtonRef, contextMenuOpened]);
|
|
47
47
|
|
|
48
48
|
return (
|
|
49
|
-
<li role="
|
|
49
|
+
<li role="none" className={`${classes["context-menu-item"]} ${className ?? ""}`}>
|
|
50
50
|
<button
|
|
51
|
+
role="menuitem"
|
|
51
52
|
{...rest}
|
|
52
53
|
ref={innerButtonRef}
|
|
53
54
|
data-focus={hasFocus}
|
|
@@ -8,7 +8,7 @@ import { ColumnName, HeaderCell, OnSortFunction, Sort } from "./datagrid.interfa
|
|
|
8
8
|
import { Pagination, Props as PaginationProps } from "../Pagination/Pagination";
|
|
9
9
|
import { Spacing, useSpacing } from "../hooks/useSpacing";
|
|
10
10
|
|
|
11
|
-
export interface Props<T> extends ComponentPropsWithRef<"div"> {
|
|
11
|
+
export interface Props<T> extends Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
12
12
|
children: ({ item, index }: { item: T; index: number }) => ReactElement;
|
|
13
13
|
data?: T[];
|
|
14
14
|
initialSort?: Sort;
|
|
@@ -23,7 +23,7 @@ export const DataGridRow = React.forwardRef<HTMLTableRowElement, Props>(
|
|
|
23
23
|
disableContextMenuColumn
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
const visible = headers
|
|
26
|
+
const visible = headers && headers.length > index ? !headers[index].hidden : true;
|
|
27
27
|
return visible && cellWithSpacing;
|
|
28
28
|
}
|
|
29
29
|
return null;
|
package/src/Link/types.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as H from "history";
|
|
|
2
2
|
|
|
3
3
|
export interface LinkProps<S = H.LocationState>
|
|
4
4
|
extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
5
|
-
component?: React.ComponentType<
|
|
5
|
+
component?: React.ComponentType<unknown> | undefined;
|
|
6
6
|
to: H.LocationDescriptor<S> | ((location: H.Location<S>) => H.LocationDescriptor<S>);
|
|
7
7
|
replace?: boolean | undefined;
|
|
8
8
|
innerRef?: React.Ref<HTMLAnchorElement> | undefined;
|
package/src/hooks/usePosition.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface ConfigObject {
|
|
|
8
8
|
offset?: Offset;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
-
export type
|
|
11
|
+
export type HorizontalPlacement = "left" | "center" | "centerh" | "right";
|
|
12
12
|
export type VerticalPlacement = "top" | "center" | "centerv" | "bottom";
|
|
13
13
|
|
|
14
14
|
type Axis = "vertical" | "horizontal";
|
|
@@ -29,7 +29,7 @@ interface DomRectObject {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
export interface Placement {
|
|
32
|
-
horizontal:
|
|
32
|
+
horizontal: HorizontalPlacement;
|
|
33
33
|
vertical: VerticalPlacement;
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -73,6 +73,7 @@ const defaultConfigObject: ConfigObject = {
|
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-non-null-asserted-optional-chain*/
|
|
76
77
|
export const usePosition = (providedConfigObject: ConfigObject = defaultConfigObject) => {
|
|
77
78
|
const configObject = { ...defaultConfigObject, ...providedConfigObject };
|
|
78
79
|
|
|
@@ -198,7 +199,7 @@ export const usePosition = (providedConfigObject: ConfigObject = defaultConfigOb
|
|
|
198
199
|
transformOrigin: Placement,
|
|
199
200
|
requestedReturnValue: Axis,
|
|
200
201
|
relEl: DomRectObject,
|
|
201
|
-
placementOriginDefinition:
|
|
202
|
+
placementOriginDefinition: HorizontalPlacement | VerticalPlacement,
|
|
202
203
|
elDimensions: Dimensions
|
|
203
204
|
) => {
|
|
204
205
|
let value = 0;
|
|
@@ -236,13 +237,13 @@ export const usePosition = (providedConfigObject: ConfigObject = defaultConfigOb
|
|
|
236
237
|
return "centerv";
|
|
237
238
|
}
|
|
238
239
|
throw new Error(
|
|
239
|
-
`the requested return value isn
|
|
240
|
+
`the requested return value isn't "vertical" or "horizontal" ${requestedReturnValue} was given.`
|
|
240
241
|
);
|
|
241
242
|
};
|
|
242
243
|
|
|
243
244
|
const _calculatePlacementValue = (
|
|
244
245
|
transformOrigin: Placement,
|
|
245
|
-
placement:
|
|
246
|
+
placement: HorizontalPlacement | VerticalPlacement,
|
|
246
247
|
requestedReturnValue: Axis,
|
|
247
248
|
relEl: DomRectObject,
|
|
248
249
|
elDimensions: Dimensions
|
package/src/interfaces.ts
CHANGED