@dvrd/dvr-controls 1.1.24 → 1.1.26

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": "@dvrd/dvr-controls",
3
- "version": "1.1.24",
3
+ "version": "1.1.26",
4
4
  "description": "Custom web controls",
5
5
  "main": "index.ts",
6
6
  "files": [
@@ -3,10 +3,10 @@
3
3
  */
4
4
 
5
5
  import './style/withBackground.scss';
6
+ import classNames from 'classnames';
6
7
 
7
8
  import React, {CSSProperties, PropsWithChildren, useEffect, useMemo, useRef} from 'react';
8
- import classNames from 'classnames';
9
- import {escapePressed, hasHover} from "../util/controlUtil";
9
+ import {escapePressed} from '../util/controlUtil';
10
10
 
11
11
  interface Props {
12
12
  onClickBackground?: Function,
@@ -39,7 +39,7 @@ export default function WithBackground(props: PropsWithChildren<Props>) {
39
39
  function _onClickBackground(evt: React.MouseEvent) {
40
40
  if (preventBackgroundClick) return;
41
41
  if (onClickBackground) onClickBackground(evt);
42
- else if (!hasHover(contentRef.current)) onClose(evt);
42
+ else if (evt.target === evt.currentTarget) onClose(evt);
43
43
  }
44
44
 
45
45
  function onKeyDown(evt: KeyboardEvent) {
@@ -102,7 +102,7 @@ export const downloadFile = (blob: Blob, fileName: string) => {
102
102
  link.click();
103
103
  };
104
104
 
105
- export const downloadRequiredFile = (path: string | {default: string}, fileName?: string) => {
105
+ export const downloadRequiredFile = (path: string | { default: string }, fileName?: string) => {
106
106
  if (typeof path !== 'string') path = path.default;
107
107
  const name = getFileName(path, fileName);
108
108
  const link = document.createElement('a');
@@ -138,7 +138,7 @@ export const shuffleArray = (arr: any[]): any[] => {
138
138
 
139
139
  export function nullify<T extends string | Array<any> | Set<any> | number | bigint>(value?: T | null): T | null {
140
140
  if (typeof value === 'number' || typeof value === 'bigint') {
141
- if (value === 0) return null;
141
+ if (value === 0 || value === 0n) return null;
142
142
  return value;
143
143
  }
144
144
  if (!value) return null;
@@ -151,7 +151,7 @@ export function nullify<T extends string | Array<any> | Set<any> | number | bigi
151
151
 
152
152
  export function undefine<T>(value?: T | null): T | undefined {
153
153
  if (value === null || value === undefined) return undefined;
154
- if (value.hasOwnProperty('length') && !(value as unknown as {length: number}).length) return undefined;
154
+ if (value.hasOwnProperty('length') && !(value as unknown as { length: number }).length) return undefined;
155
155
  if (value instanceof Set && !value.size) return undefined;
156
156
  return value;
157
157
  }