mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Remove unnecessary use of SingleOrMany<SafeReactNode>
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
adb288e48a
commit
e88de58b5d
@ -1,11 +1,11 @@
|
|||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
|
|
||||||
import invokeShortcutInjectable, { InvokeShortcut } from "./invoke-shortcut.injectable";
|
import invokeShortcutInjectable, { InvokeShortcut } from "./invoke-shortcut.injectable";
|
||||||
|
|
||||||
export interface KeyboardShortcutListenerProps {
|
export interface KeyboardShortcutListenerProps {
|
||||||
children: SingleOrMany<SafeReactNode>;
|
children: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export interface KeyboardShortcutScopeProps {
|
export interface KeyboardShortcutScopeProps {
|
||||||
id: string;
|
id: string;
|
||||||
children: SingleOrMany<SafeReactNode>;
|
children: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const KeyboardShortcutScope = ({ id, children }: KeyboardShortcutScopeProps) => (
|
export const KeyboardShortcutScope = ({ id, children }: KeyboardShortcutScopeProps) => (
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import "./animate.scss";
|
import "./animate.scss";
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames, noop } from "@k8slens/utilities";
|
import { cssNames, noop } from "@k8slens/utilities";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import type { RequestAnimationFrame } from "./request-animation-frame.injectable";
|
import type { RequestAnimationFrame } from "./request-animation-frame.injectable";
|
||||||
@ -22,7 +22,7 @@ export interface AnimateProps {
|
|||||||
onLeave?: () => void;
|
onLeave?: () => void;
|
||||||
enterDuration?: number;
|
enterDuration?: number;
|
||||||
leaveDuration?: number;
|
leaveDuration?: number;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import styles from "./avatar.module.scss";
|
|||||||
import type { ImgHTMLAttributes, MouseEventHandler } from "react";
|
import type { ImgHTMLAttributes, MouseEventHandler } from "react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import randomColor from "randomcolor";
|
import randomColor from "randomcolor";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames } from "@k8slens/utilities";
|
import { cssNames } from "@k8slens/utilities";
|
||||||
import { computeDefaultShortName } from "../../../common/catalog/helpers";
|
import { computeDefaultShortName } from "../../../common/catalog/helpers";
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ export interface AvatarProps {
|
|||||||
variant?: "circle" | "rounded" | "square";
|
variant?: "circle" | "rounded" | "square";
|
||||||
imgProps?: ImgHTMLAttributes<HTMLImageElement>;
|
imgProps?: ImgHTMLAttributes<HTMLImageElement>;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
id?: string;
|
id?: string;
|
||||||
onClick?: MouseEventHandler<HTMLDivElement>;
|
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import styles from "./badge.module.scss";
|
|||||||
import React, { useEffect, useRef, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
import { action, observable } from "mobx";
|
import { action, observable } from "mobx";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames } from "@k8slens/utilities";
|
import { cssNames } from "@k8slens/utilities";
|
||||||
import { withTooltip } from "@k8slens/tooltip";
|
import { withTooltip } from "@k8slens/tooltip";
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|||||||
expandable?: boolean;
|
expandable?: boolean;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
scrollable?: boolean;
|
scrollable?: boolean;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Common handler for all Badge instances
|
// Common handler for all Badge instances
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import "./checkbox.scss";
|
import "./checkbox.scss";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames, noop } from "@k8slens/utilities";
|
import { cssNames, noop } from "@k8slens/utilities";
|
||||||
|
|
||||||
export interface CheckboxProps {
|
export interface CheckboxProps {
|
||||||
@ -15,7 +15,7 @@ export interface CheckboxProps {
|
|||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
value?: boolean;
|
value?: boolean;
|
||||||
onChange?(value: boolean, evt: React.ChangeEvent<HTMLInputElement>): void;
|
onChange?(value: boolean, evt: React.ChangeEvent<HTMLInputElement>): void;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Checkbox({ label, inline, className, value, children, onChange = noop, disabled, ...inputProps }: CheckboxProps) {
|
export function Checkbox({ label, inline, className, value, children, onChange = noop, disabled, ...inputProps }: CheckboxProps) {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import { createPortal } from "react-dom";
|
|||||||
import { disposeOnUnmount, observer } from "mobx-react";
|
import { disposeOnUnmount, observer } from "mobx-react";
|
||||||
import { reaction } from "mobx";
|
import { reaction } from "mobx";
|
||||||
import { Animate } from "../animate";
|
import { Animate } from "../animate";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames, noop, stopPropagation } from "@k8slens/utilities";
|
import { cssNames, noop, stopPropagation } from "@k8slens/utilities";
|
||||||
import type { ObservableHistory } from "mobx-observable-history";
|
import type { ObservableHistory } from "mobx-observable-history";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
@ -30,7 +30,7 @@ export interface DialogProps {
|
|||||||
pinned?: boolean;
|
pinned?: boolean;
|
||||||
animated?: boolean;
|
animated?: boolean;
|
||||||
"data-testid"?: string;
|
"data-testid"?: string;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DialogState {
|
interface DialogState {
|
||||||
|
|||||||
@ -6,12 +6,12 @@
|
|||||||
import "./drawer-param-toggler.scss";
|
import "./drawer-param-toggler.scss";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames } from "@k8slens/utilities";
|
import { cssNames } from "@k8slens/utilities";
|
||||||
|
|
||||||
export interface DrawerParamTogglerProps {
|
export interface DrawerParamTogglerProps {
|
||||||
label: string | number;
|
label: string | number;
|
||||||
children: SingleOrMany<SafeReactNode>;
|
children: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
|
|||||||
@ -8,7 +8,7 @@ import "./drawer.scss";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { clipboard } from "electron";
|
import { clipboard } from "electron";
|
||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames, noop } from "@k8slens/utilities";
|
import { cssNames, noop } from "@k8slens/utilities";
|
||||||
import { Icon } from "../icon";
|
import { Icon } from "../icon";
|
||||||
import type { AnimateName } from "../animate";
|
import type { AnimateName } from "../animate";
|
||||||
@ -39,7 +39,7 @@ export interface DrawerProps {
|
|||||||
animation?: AnimateName;
|
animation?: AnimateName;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
toolbar?: SafeReactNode;
|
toolbar?: SafeReactNode;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
"data-testid"?: string;
|
"data-testid"?: string;
|
||||||
testIdForClose?: string;
|
testIdForClose?: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { toSafeReactChildrenArray } from "@k8slens/utilities";
|
import { toSafeReactChildrenArray } from "@k8slens/utilities";
|
||||||
import type { HTMLAttributes } from "react";
|
import type { HTMLAttributes } from "react";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
@ -11,7 +11,7 @@ import { Menu } from "../menu";
|
|||||||
|
|
||||||
interface DropdownProps extends HTMLAttributes<HTMLDivElement> {
|
interface DropdownProps extends HTMLAttributes<HTMLDivElement> {
|
||||||
contentForToggle: SafeReactNode;
|
contentForToggle: SafeReactNode;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Dropdown(props: DropdownProps) {
|
export function Dropdown(props: DropdownProps) {
|
||||||
|
|||||||
@ -5,11 +5,11 @@
|
|||||||
import "./hotbar-menu.scss";
|
import "./hotbar-menu.scss";
|
||||||
|
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames } from "@k8slens/utilities";
|
import { cssNames } from "@k8slens/utilities";
|
||||||
|
|
||||||
export interface HotbarCellProps extends React.HTMLAttributes<HTMLDivElement> {
|
export interface HotbarCellProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
index: number;
|
index: number;
|
||||||
innerRef?: React.Ref<HTMLDivElement>;
|
innerRef?: React.Ref<HTMLDivElement>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ import Workloads from "./workloads.svg";
|
|||||||
import type { Logger } from "@k8slens/logger";
|
import type { Logger } from "@k8slens/logger";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import { loggerInjectionToken } from "@k8slens/logger";
|
import { loggerInjectionToken } from "@k8slens/logger";
|
||||||
import type { SingleOrMany, SafeReactNode } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
|
|
||||||
const hrefValidation = /https?:\/\//;
|
const hrefValidation = /https?:\/\//;
|
||||||
|
|
||||||
@ -159,7 +159,7 @@ export interface BaseIconProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface IconProps extends React.HTMLAttributes<any>, BaseIconProps {
|
export interface IconProps extends React.HTMLAttributes<any>, BaseIconProps {
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isSvg(content: string): boolean {
|
export function isSvg(content: string): boolean {
|
||||||
|
|||||||
@ -7,7 +7,7 @@ import styles from "./main-layout.module.scss";
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames } from "@k8slens/utilities";
|
import { cssNames } from "@k8slens/utilities";
|
||||||
import { ErrorBoundary } from "@k8slens/error-boundary";
|
import { ErrorBoundary } from "@k8slens/error-boundary";
|
||||||
import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "@k8slens/resizing-anchor";
|
import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "@k8slens/resizing-anchor";
|
||||||
@ -20,7 +20,7 @@ export interface MainLayoutProps {
|
|||||||
sidebar: SafeReactNode;
|
sidebar: SafeReactNode;
|
||||||
className?: string;
|
className?: string;
|
||||||
footer?: SafeReactNode;
|
footer?: SafeReactNode;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
import "./sub-header.scss";
|
import "./sub-header.scss";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames } from "@k8slens/utilities";
|
import { cssNames } from "@k8slens/utilities";
|
||||||
|
|
||||||
export interface SubHeaderProps {
|
export interface SubHeaderProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
withLine?: boolean; // add bottom line
|
withLine?: boolean; // add bottom line
|
||||||
compact?: boolean; // no extra padding around content
|
compact?: boolean; // no extra padding around content
|
||||||
children: SingleOrMany<SafeReactNode>;
|
children: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SubHeader extends React.Component<SubHeaderProps> {
|
export class SubHeader extends React.Component<SubHeaderProps> {
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import "./sub-title.scss";
|
import "./sub-title.scss";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames } from "@k8slens/utilities";
|
import { cssNames } from "@k8slens/utilities";
|
||||||
|
|
||||||
export interface SubTitleProps {
|
export interface SubTitleProps {
|
||||||
@ -13,7 +13,7 @@ export interface SubTitleProps {
|
|||||||
title: SafeReactNode;
|
title: SafeReactNode;
|
||||||
compact?: boolean; // no bottom padding
|
compact?: boolean; // no bottom padding
|
||||||
id?: string;
|
id?: string;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SubTitle extends React.Component<SubTitleProps> {
|
export class SubTitle extends React.Component<SubTitleProps> {
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import "./line-progress.scss";
|
import "./line-progress.scss";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames } from "@k8slens/utilities";
|
import { cssNames } from "@k8slens/utilities";
|
||||||
import { withTooltip } from "@k8slens/tooltip";
|
import { withTooltip } from "@k8slens/tooltip";
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ export interface LineProgressProps extends React.HTMLProps<HTMLDivElement> {
|
|||||||
max?: number;
|
max?: number;
|
||||||
className?: any;
|
className?: any;
|
||||||
precise?: number;
|
precise?: number;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function valuePercent({ value, min, max, precise }: Required<Pick<LineProgressProps, "value" | "min" | "max" | "precise">>) {
|
function valuePercent({ value, min, max, precise }: Required<Pick<LineProgressProps, "value" | "min" | "max" | "precise">>) {
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import type { RequestIdleCallback } from "./request-idle-callback.injectable";
|
import type { RequestIdleCallback } from "./request-idle-callback.injectable";
|
||||||
import type { CancelIdleCallback } from "./cancel-idle-callback.injectable";
|
import type { CancelIdleCallback } from "./cancel-idle-callback.injectable";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
@ -14,7 +14,7 @@ import idleCallbackTimeoutInjectable from "./idle-callback-timeout.injectable";
|
|||||||
|
|
||||||
export interface RenderDelayProps {
|
export interface RenderDelayProps {
|
||||||
placeholder?: SafeReactNode;
|
placeholder?: SafeReactNode;
|
||||||
children: SingleOrMany<SafeReactNode>;
|
children: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface Dependencies {
|
interface Dependencies {
|
||||||
|
|||||||
@ -6,12 +6,12 @@
|
|||||||
import "./status-brick.scss";
|
import "./status-brick.scss";
|
||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { cssNames } from "@k8slens/utilities";
|
import { cssNames } from "@k8slens/utilities";
|
||||||
import { withTooltip } from "@k8slens/tooltip";
|
import { withTooltip } from "@k8slens/tooltip";
|
||||||
|
|
||||||
export interface StatusBrickProps extends React.HTMLAttributes<HTMLDivElement> {
|
export interface StatusBrickProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const StatusBrick = withTooltip(({ className, ...elemProps }: StatusBrickProps) => (
|
export const StatusBrick = withTooltip(({ className, ...elemProps }: StatusBrickProps) => (
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
import "./button.scss";
|
import "./button.scss";
|
||||||
import type { ButtonHTMLAttributes } from "react";
|
import type { ButtonHTMLAttributes } from "react";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { cssNames, SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import { cssNames, SafeReactNode } from "@k8slens/utilities";
|
||||||
import { withTooltip } from "@k8slens/tooltip";
|
import { withTooltip } from "@k8slens/tooltip";
|
||||||
|
|
||||||
export interface ButtonProps extends ButtonHTMLAttributes<any> {
|
export interface ButtonProps extends ButtonHTMLAttributes<any> {
|
||||||
@ -23,7 +23,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<any> {
|
|||||||
round?: boolean;
|
round?: boolean;
|
||||||
href?: string; // render as hyperlink
|
href?: string; // render as hyperlink
|
||||||
target?: "_blank"; // in case of using @href
|
target?: "_blank"; // in case of using @href
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Button = withTooltip((props: ButtonProps) => {
|
export const Button = withTooltip((props: ButtonProps) => {
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import type { ErrorInfo } from "react";
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import { observer } from "mobx-react";
|
import { observer } from "mobx-react";
|
||||||
import { Button } from "@k8slens/button";
|
import { Button } from "@k8slens/button";
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import type { ObservableHistory } from "mobx-observable-history";
|
import type { ObservableHistory } from "mobx-observable-history";
|
||||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||||
import { observableHistoryInjectionToken } from "@k8slens/routing";
|
import { observableHistoryInjectionToken } from "@k8slens/routing";
|
||||||
@ -18,7 +18,7 @@ const issuesTrackerUrl = "https://github.com/lensapp/lens/issues";
|
|||||||
const forumsUrl = "https://forums.k8slens.dev";
|
const forumsUrl = "https://forums.k8slens.dev";
|
||||||
|
|
||||||
export interface ErrorBoundaryProps {
|
export interface ErrorBoundaryProps {
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface State {
|
interface State {
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
import type { SafeReactNode } from "@k8slens/utilities";
|
||||||
import { render, RenderResult } from "@testing-library/react";
|
import { render, RenderResult } from "@testing-library/react";
|
||||||
import userEvent from "@testing-library/user-event";
|
import userEvent from "@testing-library/user-event";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
@ -12,7 +12,7 @@ import { withTooltip } from "./withTooltip";
|
|||||||
type MyComponentProps = {
|
type MyComponentProps = {
|
||||||
text: string;
|
text: string;
|
||||||
id?: string;
|
id?: string;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
"data-testid"?: string;
|
"data-testid"?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export interface TooltipDecoratorProps {
|
|||||||
*/
|
*/
|
||||||
tooltipOverrideDisabled?: boolean;
|
tooltipOverrideDisabled?: boolean;
|
||||||
id?: string;
|
id?: string;
|
||||||
children?: SingleOrMany<SafeReactNode>;
|
children?: SafeReactNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function withTooltip<TargetProps>(
|
export function withTooltip<TargetProps>(
|
||||||
|
|||||||
@ -9,7 +9,7 @@ import type { SingleOrMany } from "./types";
|
|||||||
|
|
||||||
export type SafeReactNode = React.ReactElement | React.ReactText | boolean | null | undefined | Iterable<SafeReactNode>;
|
export type SafeReactNode = React.ReactElement | React.ReactText | boolean | null | undefined | Iterable<SafeReactNode>;
|
||||||
|
|
||||||
export function toSafeReactChildrenArray(children: SingleOrMany<SafeReactNode>) {
|
export function toSafeReactChildrenArray(children: SafeReactNode) {
|
||||||
return React.Children.toArray(children) as (Exclude<SafeReactNode, boolean | null | undefined>)[];
|
return React.Children.toArray(children) as (Exclude<SafeReactNode, boolean | null | undefined>)[];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user