From fd9da4a04b7cd5e2661f1cc89209de7b1e4b8f5e Mon Sep 17 00:00:00 2001 From: github-actions Date: Tue, 4 May 2021 17:55:36 -0700 Subject: [PATCH] chore #316 - Updates for web-alert-manager Update package.json version Fix lint errors Rename getRemainingJSON to getJSONValueType Closes #316 --- package.json | 2 +- src/components/Input/index.tsx | 10 ++-------- src/components/JSONPathPicker/index.tsx | 4 ++-- src/components/JSONPathPicker/utils.tsx | 10 +++++----- src/components/utils.ts | 2 +- 5 files changed, 11 insertions(+), 17 deletions(-) diff --git a/package.json b/package.json index 2a3791f4..a1ef2b82 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@dassana-io/web-components", - "version": "0.10.15", + "version": "0.10.16", "publishConfig": { "registry": "https://npm.pkg.github.com/dassana-io" }, diff --git a/src/components/Input/index.tsx b/src/components/Input/index.tsx index be76865b..9030c0a0 100644 --- a/src/components/Input/index.tsx +++ b/src/components/Input/index.tsx @@ -12,13 +12,7 @@ import { fieldErrorStyles } from '../assets/styles/styleguide' import { generateAddonStyles, generateInputStyles } from './utils' -import React, { - FC, - FocusEvent, - KeyboardEvent, - LegacyRef, - RefObject -} from 'react' +import React, { FC, FocusEvent, KeyboardEvent, RefObject } from 'react' const { dark, light } = ThemeType @@ -43,7 +37,7 @@ export interface InputProps extends BaseFormElementProps { addonAfter?: string addonBefore?: string defaultValue?: string - inputRef?: LegacyRef + inputRef?: RefObject focused?: boolean onFocus?: (e: FocusEvent) => void onKeyDown?: (e: KeyboardEvent) => void diff --git a/src/components/JSONPathPicker/index.tsx b/src/components/JSONPathPicker/index.tsx index bca75219..a8ff2f5d 100644 --- a/src/components/JSONPathPicker/index.tsx +++ b/src/components/JSONPathPicker/index.tsx @@ -3,7 +3,7 @@ import { CodeControls } from 'components/Code/CodeControls' import { getJSONPathValue } from 'components/utils' import { useStyles } from './styles' import { copyToClipboard, stringifyCode } from 'components/Code/utils' -import { getRemainingJSONType, JSONDataTypes, recursiveRender } from './utils' +import { getJSONValueType, JSONDataTypes, recursiveRender } from './utils' import React, { FC, useEffect, useState } from 'react' export type JSONValue = @@ -63,4 +63,4 @@ export const JSONPathPicker: FC = ({ ) } -export { getJSONPathValue, getRemainingJSONType, JSONDataTypes } +export { getJSONPathValue, getJSONValueType, JSONDataTypes } diff --git a/src/components/JSONPathPicker/utils.tsx b/src/components/JSONPathPicker/utils.tsx index f6350df4..4ec598a9 100644 --- a/src/components/JSONPathPicker/utils.tsx +++ b/src/components/JSONPathPicker/utils.tsx @@ -249,11 +249,11 @@ const mappedTypesToRenderFns = { [string]: renderString } -export const getRemainingJSONType = (remainingJSON: RemainingJSON) => { - if (isNull(remainingJSON)) return nullType - else if (Array.isArray(remainingJSON)) return array +export const getJSONValueType = (json: RemainingJSON) => { + if (isNull(json)) return nullType + else if (Array.isArray(json)) return array else { - const type = typeof remainingJSON + const type = typeof json switch (type) { case 'number': @@ -279,7 +279,7 @@ export const recursiveRender = ({ onChange, remainingJSON }: RenderParams): ReactNode => - mappedTypesToRenderFns[getRemainingJSONType(remainingJSON)]({ + mappedTypesToRenderFns[getJSONValueType(remainingJSON)]({ classes, currPath, isLastItem, diff --git a/src/components/utils.ts b/src/components/utils.ts index cacf9c40..982b9474 100644 --- a/src/components/utils.ts +++ b/src/components/utils.ts @@ -1,10 +1,10 @@ import Color from 'color' import { JSONPath } from 'jsonpath-plus' +import { JSONValue } from './JSONPathPicker' import mapValues from 'lodash/mapValues' import { PopupContainerProps } from './types' import { TooltipPlacement } from 'antd/es/tooltip' import { useEffect, useState } from 'react' -import { JSONValue } from './JSONPathPicker' export const placementOptions: TooltipPlacement[] = [ 'bottom',