@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onewelcome/react-lib-components",
3
- "version": "0.2.3",
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 'src/**/*.{ts,tsx}'",
21
+ "lint": "eslint --fix '**/*.{ts,tsx}'",
22
22
  "prepare": "husky install && dts build",
23
23
  "size": "size-limit",
24
24
  "start": "dts watch",
@@ -85,7 +85,7 @@ describe("ContextMenu should render", () => {
85
85
 
86
86
  const child = getByRole("menuitem");
87
87
 
88
- expect(child).toHaveClass("custom");
88
+ expect(child.parentElement).toHaveClass("custom");
89
89
  });
90
90
 
91
91
  it("should throw an error", () => {
@@ -46,8 +46,9 @@ export const ContextMenuItem = React.forwardRef<HTMLButtonElement, Props>(
46
46
  }, [hasFocus, innerButtonRef, contextMenuOpened]);
47
47
 
48
48
  return (
49
- <li role="menuitem" className={`${classes["context-menu-item"]} ${className ?? ""}`}>
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?.length! > index ? !headers![index].hidden : true;
26
+ const visible = headers && headers.length > index ? !headers[index].hidden : true;
27
27
  return visible && cellWithSpacing;
28
28
  }
29
29
  return null;
@@ -11,5 +11,5 @@ export interface FormSelector extends FormElement {
11
11
  /** Default form elements */
12
12
  export interface FormElement {
13
13
  error?: boolean;
14
- [dataAttribute: DataAttributeKey]: any;
14
+ [dataAttribute: DataAttributeKey]: unknown;
15
15
  }
@@ -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<any> | undefined;
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;
@@ -8,7 +8,7 @@ export interface ConfigObject {
8
8
  offset?: Offset;
9
9
  }
10
10
 
11
- export type HorizontalPlacment = "left" | "center" | "centerh" | "right";
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: HorizontalPlacment;
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: HorizontalPlacment | VerticalPlacement,
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\'t "vertical" or "horizontal" ${requestedReturnValue} was given.`
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: HorizontalPlacment | VerticalPlacement,
246
+ placement: HorizontalPlacement | VerticalPlacement,
246
247
  requestedReturnValue: Axis,
247
248
  relEl: DomRectObject,
248
249
  elDimensions: Dimensions
package/src/interfaces.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export type DataAttributeKey = `data-${string}`;
2
2
 
3
3
  export interface KeyValuePair {
4
- [dataAttribute: DataAttributeKey]: any;
4
+ [dataAttribute: DataAttributeKey]: unknown;
5
5
  }