mirror of
https://github.com/lensapp/lens.git
synced 2024-09-11 09:25:26 +03:00
chore: Change name from SafeReactNode to StrictReactNode
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
e88de58b5d
commit
d8823085a8
@ -1,11 +1,11 @@
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import React, { useEffect } from "react";
|
||||
|
||||
import invokeShortcutInjectable, { InvokeShortcut } from "./invoke-shortcut.injectable";
|
||||
|
||||
export interface KeyboardShortcutListenerProps {
|
||||
children: SafeReactNode;
|
||||
children: StrictReactNode;
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
|
@ -1,9 +1,9 @@
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import React from "react";
|
||||
|
||||
export interface KeyboardShortcutScopeProps {
|
||||
id: string;
|
||||
children: SafeReactNode;
|
||||
children: StrictReactNode;
|
||||
}
|
||||
|
||||
export const KeyboardShortcutScope = ({ id, children }: KeyboardShortcutScopeProps) => (
|
||||
|
@ -7,7 +7,7 @@ import EventEmitter from "events";
|
||||
import type TypedEmitter from "typed-emitter";
|
||||
import { observable, makeObservable } from "mobx";
|
||||
import { once } from "lodash";
|
||||
import type { Disposer, SafeReactNode } from "@k8slens/utilities";
|
||||
import type { Disposer, StrictReactNode } from "@k8slens/utilities";
|
||||
import { iter } from "@k8slens/utilities";
|
||||
import type { CategoryColumnRegistration, TitleCellProps } from "../../renderer/components/catalog/custom-category-columns";
|
||||
|
||||
@ -201,7 +201,7 @@ export abstract class CatalogCategory extends (EventEmitter as new () => TypedEm
|
||||
* Defaults to no badge.
|
||||
* The badge is displayed next to the Category name in the Catalog Category menu
|
||||
*/
|
||||
public getBadge(): SafeReactNode {
|
||||
public getBadge(): StrictReactNode {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
import "./add-remove-buttons.scss";
|
||||
|
||||
import React from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { Button } from "@k8slens/button";
|
||||
import { Icon } from "../icon";
|
||||
@ -14,8 +14,8 @@ import { Icon } from "../icon";
|
||||
export interface AddRemoveButtonsProps extends React.HTMLAttributes<any> {
|
||||
onAdd?: () => void;
|
||||
onRemove?: () => void;
|
||||
addTooltip?: SafeReactNode;
|
||||
removeTooltip?: SafeReactNode;
|
||||
addTooltip?: StrictReactNode;
|
||||
removeTooltip?: StrictReactNode;
|
||||
}
|
||||
|
||||
export class AddRemoveButtons extends React.PureComponent<AddRemoveButtonsProps> {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import "./animate.scss";
|
||||
import React, { useEffect, useState } from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, noop } from "@k8slens/utilities";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import type { RequestAnimationFrame } from "./request-animation-frame.injectable";
|
||||
@ -22,7 +22,7 @@ export interface AnimateProps {
|
||||
onLeave?: () => void;
|
||||
enterDuration?: number;
|
||||
leaveDuration?: number;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
|
@ -8,7 +8,7 @@ import styles from "./avatar.module.scss";
|
||||
import type { ImgHTMLAttributes, MouseEventHandler } from "react";
|
||||
import React from "react";
|
||||
import randomColor from "randomcolor";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { computeDefaultShortName } from "../../../common/catalog/helpers";
|
||||
|
||||
@ -21,7 +21,7 @@ export interface AvatarProps {
|
||||
variant?: "circle" | "rounded" | "square";
|
||||
imgProps?: ImgHTMLAttributes<HTMLImageElement>;
|
||||
disabled?: boolean;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
className?: string;
|
||||
id?: string;
|
||||
onClick?: MouseEventHandler<HTMLDivElement>;
|
||||
|
@ -8,18 +8,18 @@ import styles from "./badge.module.scss";
|
||||
import React, { useEffect, useRef, useState } from "react";
|
||||
import { action, observable } from "mobx";
|
||||
import { observer } from "mobx-react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { withTooltip } from "@k8slens/tooltip";
|
||||
|
||||
export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
small?: boolean;
|
||||
flat?: boolean;
|
||||
label?: SafeReactNode;
|
||||
label?: StrictReactNode;
|
||||
expandable?: boolean;
|
||||
disabled?: boolean;
|
||||
scrollable?: boolean;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
// Common handler for all Badge instances
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import type { DiContainer } from "@ogre-tools/injectable";
|
||||
import { computed } from "mobx";
|
||||
import type { LensRendererExtension } from "../../../../extensions/lens-renderer-extension";
|
||||
@ -20,8 +20,8 @@ describe("Custom Category Views", () => {
|
||||
});
|
||||
|
||||
it("should order items correctly over all extensions", () => {
|
||||
const component1 = (): SafeReactNode => null;
|
||||
const component2 = (): SafeReactNode => null;
|
||||
const component1 = (): StrictReactNode => null;
|
||||
const component2 = (): StrictReactNode => null;
|
||||
|
||||
di.override(rendererExtensionsInjectable, () => computed(() => [
|
||||
{
|
||||
@ -58,8 +58,8 @@ describe("Custom Category Views", () => {
|
||||
});
|
||||
|
||||
it("should put put priority < 50 items in before", () => {
|
||||
const component1 = (): SafeReactNode => null;
|
||||
const component2 = (): SafeReactNode => null;
|
||||
const component1 = (): StrictReactNode => null;
|
||||
const component2 = (): StrictReactNode => null;
|
||||
|
||||
di.override(rendererExtensionsInjectable, () => computed(() => [
|
||||
{
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { orderBy } from "lodash";
|
||||
import type { CatalogCategory, CatalogEntity } from "../../../../common/catalog";
|
||||
@ -36,7 +36,7 @@ const getCategoryColumnsInjectable = getInjectable({
|
||||
const sortingCallbacks: CategoryColumns["sortingCallbacks"] = {};
|
||||
const searchFilters: CategoryColumns["searchFilters"] = [];
|
||||
const renderTableHeader: CategoryColumns["renderTableHeader"] = [];
|
||||
const tableRowRenderers: ((entity: CatalogEntity) => SafeReactNode)[] = [];
|
||||
const tableRowRenderers: ((entity: CatalogEntity) => StrictReactNode)[] = [];
|
||||
|
||||
for (const registration of allRegistrations) {
|
||||
if (registration.sortCallback) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import type { CatalogEntity } from "../../../common/catalog";
|
||||
import type { TableCellProps } from "../table";
|
||||
|
||||
@ -32,7 +32,7 @@ export interface CategoryColumnRegistration {
|
||||
/**
|
||||
* This function will be called to generate the cells (on demand) for the column
|
||||
*/
|
||||
renderCell: (entity: CatalogEntity) => SafeReactNode;
|
||||
renderCell: (entity: CatalogEntity) => StrictReactNode;
|
||||
|
||||
/**
|
||||
* This function will be used to generate the columns title cell.
|
||||
@ -79,7 +79,7 @@ export interface AdditionalCategoryColumnRegistration extends CategoryColumnRegi
|
||||
export interface RegisteredAdditionalCategoryColumn {
|
||||
id: string;
|
||||
priority: number;
|
||||
renderCell: (entity: CatalogEntity) => SafeReactNode;
|
||||
renderCell: (entity: CatalogEntity) => StrictReactNode;
|
||||
titleProps: TableCellProps;
|
||||
sortCallback?: (entity: CatalogEntity) => string | number | (string | number)[];
|
||||
searchFilter?: (entity: CatalogEntity) => string | string[];
|
||||
|
@ -11,7 +11,7 @@ import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import type { IComputedValue } from "mobx";
|
||||
import type { Hotbar } from "../../../features/hotbar/storage/common/hotbar";
|
||||
import activeHotbarInjectable from "../../../features/hotbar/storage/common/active.injectable";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
interface Dependencies {
|
||||
activeHotbar: IComputedValue<Hotbar | undefined>;
|
||||
@ -19,8 +19,8 @@ interface Dependencies {
|
||||
|
||||
interface HotbarToggleMenuItemProps {
|
||||
entity: CatalogEntity;
|
||||
addContent: SafeReactNode;
|
||||
removeContent: SafeReactNode;
|
||||
addContent: StrictReactNode;
|
||||
removeContent: StrictReactNode;
|
||||
}
|
||||
|
||||
function NonInjectedHotbarToggleMenuItem({
|
||||
|
@ -5,17 +5,17 @@
|
||||
|
||||
import "./checkbox.scss";
|
||||
import React from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, noop } from "@k8slens/utilities";
|
||||
|
||||
export interface CheckboxProps {
|
||||
className?: string;
|
||||
label?: SafeReactNode;
|
||||
label?: StrictReactNode;
|
||||
inline?: boolean;
|
||||
disabled?: boolean;
|
||||
value?: boolean;
|
||||
onChange?(value: boolean, evt: React.ChangeEvent<HTMLInputElement>): void;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
export function Checkbox({ label, inline, className, value, children, onChange = noop, disabled, ...inputProps }: CheckboxProps) {
|
||||
|
@ -22,7 +22,7 @@ import type { RequestClusterActivation } from "../../../features/cluster/activat
|
||||
import requestClusterActivationInjectable from "../../../features/cluster/activation/renderer/request-activation.injectable";
|
||||
import type { GetClusterById } from "../../../features/cluster/storage/common/get-by-id.injectable";
|
||||
import getClusterByIdInjectable from "../../../features/cluster/storage/common/get-by-id.injectable";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
interface Dependencies {
|
||||
clusterId: IComputedValue<string>;
|
||||
@ -94,7 +94,7 @@ class NonInjectedClusterView extends React.Component<Dependencies> {
|
||||
]);
|
||||
}
|
||||
|
||||
renderStatus(): SafeReactNode {
|
||||
renderStatus(): StrictReactNode {
|
||||
const { cluster, isReady } = this;
|
||||
|
||||
if (cluster && !isReady) {
|
||||
|
@ -14,10 +14,10 @@ import storesAndApisCanBeCreatedInjectable from "../../stores-apis-can-be-create
|
||||
import type { DiRender } from "../test-utils/renderFor";
|
||||
import { renderFor } from "../test-utils/renderFor";
|
||||
import { HorizontalPodAutoscalerDetails } from "./details";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
jest.mock("react-router-dom", () => ({
|
||||
Link: ({ children }: { children: SafeReactNode }) => children,
|
||||
Link: ({ children }: { children: StrictReactNode }) => children,
|
||||
}));
|
||||
|
||||
const hpaV2 = {
|
||||
|
@ -9,7 +9,7 @@ import React from "react";
|
||||
import type { IObservableValue } from "mobx";
|
||||
import { observable, makeObservable, computed } from "mobx";
|
||||
import { observer } from "mobx-react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, noop, prevDefault } from "@k8slens/utilities";
|
||||
import type { ButtonProps } from "@k8slens/button";
|
||||
import { Button } from "@k8slens/button";
|
||||
@ -30,10 +30,10 @@ export interface ConfirmDialogParams extends ConfirmDialogBooleanParams {
|
||||
}
|
||||
|
||||
export interface ConfirmDialogBooleanParams {
|
||||
labelOk?: SafeReactNode;
|
||||
labelCancel?: SafeReactNode;
|
||||
message: SafeReactNode;
|
||||
icon?: SafeReactNode;
|
||||
labelOk?: StrictReactNode;
|
||||
labelCancel?: StrictReactNode;
|
||||
message: StrictReactNode;
|
||||
icon?: StrictReactNode;
|
||||
okButtonProps?: Partial<ButtonProps>;
|
||||
cancelButtonProps?: Partial<ButtonProps>;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import "./crd-resource-details.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, safeJSONPathValue } from "@k8slens/utilities";
|
||||
import { Badge } from "../badge";
|
||||
import { DrawerItem } from "../drawer";
|
||||
@ -23,7 +23,7 @@ export interface CustomResourceDetailsProps extends KubeObjectDetailsProps<KubeO
|
||||
crd?: CustomResourceDefinition;
|
||||
}
|
||||
|
||||
function convertSpecValue(value: unknown): SafeReactNode {
|
||||
function convertSpecValue(value: unknown): StrictReactNode {
|
||||
if (Array.isArray(value)) {
|
||||
return (
|
||||
<ul>
|
||||
|
@ -10,7 +10,7 @@ import { createPortal } from "react-dom";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import { reaction } from "mobx";
|
||||
import { Animate } from "../animate";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, noop, stopPropagation } from "@k8slens/utilities";
|
||||
import type { ObservableHistory } from "mobx-observable-history";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
@ -30,7 +30,7 @@ export interface DialogProps {
|
||||
pinned?: boolean;
|
||||
animated?: boolean;
|
||||
"data-testid"?: string;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
interface DialogState {
|
||||
|
@ -7,7 +7,7 @@ import styles from "./dock-tab.module.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, prevDefault, isMiddleClick } from "@k8slens/utilities";
|
||||
import type { DockStore, DockTab as DockTabModel } from "./dock/store";
|
||||
import type { TabProps } from "../tabs";
|
||||
@ -22,7 +22,7 @@ import isMacInjectable from "../../../common/vars/is-mac.injectable";
|
||||
import autoBindReact from "auto-bind/react";
|
||||
|
||||
export interface DockTabProps extends TabProps<DockTabModel> {
|
||||
moreActions?: SafeReactNode;
|
||||
moreActions?: StrictReactNode;
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
|
@ -8,7 +8,7 @@ import "./info-panel.scss";
|
||||
import React, { Component } from "react";
|
||||
import { computed, observable, reaction, makeObservable } from "mobx";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { Button } from "@k8slens/button";
|
||||
import { Icon } from "../icon";
|
||||
@ -29,9 +29,9 @@ export interface InfoPanelProps extends OptionalProps {
|
||||
export interface OptionalProps {
|
||||
className?: string;
|
||||
error?: string;
|
||||
controls?: SafeReactNode;
|
||||
submitLabel?: SafeReactNode;
|
||||
submittingMessage?: SafeReactNode;
|
||||
controls?: StrictReactNode;
|
||||
submitLabel?: StrictReactNode;
|
||||
submittingMessage?: StrictReactNode;
|
||||
disableSubmit?: boolean;
|
||||
showButtons?: boolean;
|
||||
showSubmitClose?: boolean;
|
||||
|
@ -5,11 +5,11 @@
|
||||
|
||||
import "./drawer-item.scss";
|
||||
import React from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface DrawerItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
name: SafeReactNode;
|
||||
name: StrictReactNode;
|
||||
title?: string;
|
||||
labelsOnly?: boolean;
|
||||
hidden?: boolean;
|
||||
|
@ -6,12 +6,12 @@
|
||||
import "./drawer-param-toggler.scss";
|
||||
import React from "react";
|
||||
import { Icon } from "../icon";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface DrawerParamTogglerProps {
|
||||
label: string | number;
|
||||
children: SafeReactNode;
|
||||
children: StrictReactNode;
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
@ -5,17 +5,17 @@
|
||||
|
||||
import styles from "./drawer-title.module.css";
|
||||
import React from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface DrawerTitleProps {
|
||||
className?: string;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
|
||||
/**
|
||||
* @deprecated Prefer passing the value as `children`
|
||||
*/
|
||||
title?: SafeReactNode;
|
||||
title?: StrictReactNode;
|
||||
|
||||
/**
|
||||
* Specifies how large this title is
|
||||
|
@ -8,7 +8,7 @@ import "./drawer.scss";
|
||||
import React from "react";
|
||||
import { clipboard } from "electron";
|
||||
import { createPortal } from "react-dom";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, noop } from "@k8slens/utilities";
|
||||
import { Icon } from "../icon";
|
||||
import type { AnimateName } from "../animate";
|
||||
@ -24,7 +24,7 @@ export type DrawerPosition = "top" | "left" | "right" | "bottom";
|
||||
|
||||
export interface DrawerProps {
|
||||
open: boolean;
|
||||
title: SafeReactNode;
|
||||
title: StrictReactNode;
|
||||
|
||||
/**
|
||||
* The width or heigh (depending on `position`) of the Drawer.
|
||||
@ -38,8 +38,8 @@ export interface DrawerProps {
|
||||
position?: DrawerPosition;
|
||||
animation?: AnimateName;
|
||||
onClose?: () => void;
|
||||
toolbar?: SafeReactNode;
|
||||
children?: SafeReactNode;
|
||||
toolbar?: StrictReactNode;
|
||||
children?: StrictReactNode;
|
||||
"data-testid"?: string;
|
||||
testIdForClose?: string;
|
||||
}
|
||||
|
@ -3,15 +3,15 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { toSafeReactChildrenArray } from "@k8slens/utilities";
|
||||
import type { HTMLAttributes } from "react";
|
||||
import React, { useState } from "react";
|
||||
import { Menu } from "../menu";
|
||||
|
||||
interface DropdownProps extends HTMLAttributes<HTMLDivElement> {
|
||||
contentForToggle: SafeReactNode;
|
||||
children?: SafeReactNode;
|
||||
contentForToggle: StrictReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
export function Dropdown(props: DropdownProps) {
|
||||
|
@ -11,7 +11,7 @@ import React from "react";
|
||||
import { Icon } from "../icon";
|
||||
import type { InputProps, InputValidator } from "../input";
|
||||
import { Input } from "../input";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { StrictReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import autoBindReact from "auto-bind/react";
|
||||
|
||||
export interface EditableListProps<T> {
|
||||
@ -23,7 +23,7 @@ export interface EditableListProps<T> {
|
||||
|
||||
// An optional prop used to convert T to a displayable string
|
||||
// defaults to `String`
|
||||
renderItem?: (item: T, index: number) => SafeReactNode;
|
||||
renderItem?: (item: T, index: number) => StrictReactNode;
|
||||
inputTheme?: InputProps["theme"];
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ import { Spinner } from "../spinner";
|
||||
import { observable, makeObservable } from "mobx";
|
||||
import { observer } from "mobx-react";
|
||||
import _ from "lodash";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
export interface FileUploadProps {
|
||||
uploadDir: string;
|
||||
@ -49,7 +49,7 @@ export enum OverTotalSizeLimitStyle {
|
||||
|
||||
export interface BaseProps {
|
||||
accept?: string;
|
||||
label: SafeReactNode;
|
||||
label: StrictReactNode;
|
||||
multiple?: boolean;
|
||||
|
||||
// limit is the optional maximum number of files to upload
|
||||
@ -221,7 +221,7 @@ class DefaultedFilePicker extends React.Component<FilePickerProps & typeof defau
|
||||
);
|
||||
}
|
||||
|
||||
getIconRight(): SafeReactNode {
|
||||
getIconRight(): StrictReactNode {
|
||||
switch (this.status) {
|
||||
case FileInputStatus.PROCESSING:
|
||||
return <Spinner />;
|
||||
|
@ -5,11 +5,11 @@
|
||||
import "./hotbar-menu.scss";
|
||||
|
||||
import React, { useState } from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface HotbarCellProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
index: number;
|
||||
innerRef?: React.Ref<HTMLDivElement>;
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import "./hotbar-menu.scss";
|
||||
import React, { useState } from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { HotbarEntityIcon } from "./hotbar-entity-icon";
|
||||
import type { IClassName, SafeReactNode } from "@k8slens/utilities";
|
||||
import type { IClassName, StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import type { CatalogEntityRegistry } from "../../api/catalog/entity/registry";
|
||||
import type { CatalogEntity } from "../../api/catalog-entity";
|
||||
@ -147,7 +147,7 @@ const NonInjectedHotbarMenu = observer((props: Dependencies & HotbarMenuProps) =
|
||||
)}
|
||||
</Draggable>
|
||||
)}
|
||||
{provided.placeholder as SafeReactNode}
|
||||
{provided.placeholder as StrictReactNode}
|
||||
</HotbarCell>
|
||||
)}
|
||||
</Droppable>
|
||||
|
@ -36,7 +36,7 @@ import Workloads from "./workloads.svg";
|
||||
import type { Logger } from "@k8slens/logger";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
const hrefValidation = /https?:\/\//;
|
||||
|
||||
@ -159,7 +159,7 @@ export interface BaseIconProps {
|
||||
}
|
||||
|
||||
export interface IconProps extends React.HTMLAttributes<any>, BaseIconProps {
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
export function isSvg(content: string): boolean {
|
||||
@ -206,7 +206,7 @@ const RawIcon = (props: IconProps & Dependencies) => {
|
||||
onKeyDown?.(event);
|
||||
};
|
||||
|
||||
let iconContent: SafeReactNode;
|
||||
let iconContent: StrictReactNode;
|
||||
const iconProps: Partial<IconProps> = {
|
||||
className: cssNames("Icon", className,
|
||||
{ svg, material, interactive: isInteractive, disabled, sticker, active, focusable },
|
||||
|
@ -7,7 +7,7 @@ import "./input.scss";
|
||||
|
||||
import type { DOMAttributes, InputHTMLAttributes, TextareaHTMLAttributes } from "react";
|
||||
import React from "react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { StrictReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import { debouncePromise, isPromiseSettledFulfilled, cssNames } from "@k8slens/utilities";
|
||||
import { Icon } from "../icon";
|
||||
import type { TooltipProps } from "@k8slens/tooltip";
|
||||
@ -58,7 +58,7 @@ export interface IconDataFnArg {
|
||||
* - A react node
|
||||
* - Or a function that produces a react node
|
||||
*/
|
||||
export type IconData = string | SafeReactNode | ((opt: IconDataFnArg) => SafeReactNode);
|
||||
export type IconData = string | StrictReactNode | ((opt: IconDataFnArg) => StrictReactNode);
|
||||
|
||||
export type InputProps = Omit<InputElementProps, "onChange" | "onSubmit"> & {
|
||||
theme?: "round-black" | "round";
|
||||
@ -74,7 +74,7 @@ export type InputProps = Omit<InputElementProps, "onChange" | "onSubmit"> & {
|
||||
showErrorsAsTooltip?: boolean | Omit<TooltipProps, "targetId">; // show validation errors as a tooltip :hover (instead of block below)
|
||||
iconLeft?: IconData;
|
||||
iconRight?: IconData;
|
||||
contentRight?: string | SafeReactNode; // Any component of string goes after iconRight
|
||||
contentRight?: string | StrictReactNode; // Any component of string goes after iconRight
|
||||
validators?: SingleOrMany<InputValidator>;
|
||||
blurOnEnter?: boolean;
|
||||
onChange?(value: string, evt: React.ChangeEvent<InputElement>): void;
|
||||
@ -86,7 +86,7 @@ interface State {
|
||||
dirty: boolean;
|
||||
valid: boolean;
|
||||
validating: boolean;
|
||||
errors: SafeReactNode[];
|
||||
errors: StrictReactNode[];
|
||||
submitted: boolean;
|
||||
}
|
||||
|
||||
@ -171,8 +171,8 @@ export class Input extends React.Component<InputProps, State> {
|
||||
async validate() {
|
||||
const value = this.getValue();
|
||||
let validationId = (this.validationId = ""); // reset every time for async validators
|
||||
const asyncValidators: Promise<SafeReactNode>[] = [];
|
||||
const errors: SafeReactNode[] = [];
|
||||
const asyncValidators: Promise<StrictReactNode>[] = [];
|
||||
const errors: StrictReactNode[] = [];
|
||||
|
||||
// run validators
|
||||
for (const validator of this.validators) {
|
||||
@ -222,7 +222,7 @@ export class Input extends React.Component<InputProps, State> {
|
||||
this.input?.setCustomValidity(errors[0]?.toString() ?? "");
|
||||
}
|
||||
|
||||
setValidation(errors: SafeReactNode[]) {
|
||||
setValidation(errors: StrictReactNode[]) {
|
||||
this.setState({
|
||||
validating: false,
|
||||
valid: !errors.length,
|
||||
@ -434,7 +434,7 @@ export class Input extends React.Component<InputProps, State> {
|
||||
const componentId = id || showErrorsAsTooltip
|
||||
? `input_tooltip_id_${uuid.v4()}`
|
||||
: undefined;
|
||||
let tooltipError: SafeReactNode;
|
||||
let tooltipError: StrictReactNode;
|
||||
|
||||
if (showErrorsAsTooltip && showErrors) {
|
||||
const tooltipProps = typeof showErrorsAsTooltip === "object" ? showErrorsAsTooltip : {};
|
||||
|
@ -7,7 +7,7 @@ import type { InputProps } from "./input";
|
||||
import fse from "fs-extra";
|
||||
import { TypedRegEx } from "typed-regex";
|
||||
import type { SetRequired } from "type-fest";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
export type InputValidationResult<IsAsync extends boolean> =
|
||||
IsAsync extends true
|
||||
@ -16,7 +16,7 @@ export type InputValidationResult<IsAsync extends boolean> =
|
||||
|
||||
export type InputValidation<IsAsync extends boolean> = (value: string, props?: InputProps) => InputValidationResult<IsAsync>;
|
||||
|
||||
export type SyncValidationMessage = SafeReactNode | ((value: string, props?: InputProps) => SafeReactNode);
|
||||
export type SyncValidationMessage = StrictReactNode | ((value: string, props?: InputProps) => StrictReactNode);
|
||||
|
||||
/**
|
||||
* @deprecated This type is not as type safe as it is possible to specify an async input validator without specifying a `debounce` time.
|
||||
|
@ -12,7 +12,7 @@ import { Observer, observer } from "mobx-react";
|
||||
import type { ConfirmDialogParams } from "../confirm-dialog";
|
||||
import type { TableCellProps, TableProps, TableRowProps, TableSortCallbacks } from "../table";
|
||||
import { Table, TableCell, TableHead, TableRow } from "../table";
|
||||
import type { IClassName, SafeReactNode } from "@k8slens/utilities";
|
||||
import type { IClassName, StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, isDefined, isReactNode, noop, prevDefault, stopPropagation } from "@k8slens/utilities";
|
||||
import type { AddRemoveButtonsProps } from "../add-remove-buttons";
|
||||
import { AddRemoveButtons } from "../add-remove-buttons";
|
||||
@ -49,8 +49,8 @@ export interface ItemListLayoutContentProps<Item extends ItemObject, PreLoadStor
|
||||
sortingCallbacks?: TableSortCallbacks<Item>;
|
||||
tableProps?: Partial<TableProps<Item>>; // low-level table configuration
|
||||
renderTableHeader?: (TableCellProps | undefined | null)[];
|
||||
renderTableContents: (item: Item) => (SafeReactNode | TableCellProps)[];
|
||||
renderItemMenu?: (item: Item, store: ItemListStore<Item, PreLoadStores>) => SafeReactNode;
|
||||
renderTableContents: (item: Item) => (StrictReactNode | TableCellProps)[];
|
||||
renderItemMenu?: (item: Item, store: ItemListStore<Item, PreLoadStores>) => StrictReactNode;
|
||||
customizeTableRowProps?: (item: Item) => Partial<TableRowProps<Item>>;
|
||||
addRemoveButtons?: Partial<AddRemoveButtonsProps>;
|
||||
virtual?: boolean;
|
||||
@ -70,7 +70,7 @@ export interface ItemListLayoutContentProps<Item extends ItemObject, PreLoadStor
|
||||
*
|
||||
* @default "Failed to load items"
|
||||
*/
|
||||
failedToLoadMessage?: SafeReactNode;
|
||||
failedToLoadMessage?: StrictReactNode;
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
|
@ -7,7 +7,7 @@ import "./item-list-layout.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { IClassName, SafeReactNode } from "@k8slens/utilities";
|
||||
import type { IClassName, StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, isDefined } from "@k8slens/utilities";
|
||||
import type { ItemObject } from "@k8slens/list-layout";
|
||||
import type { Filter } from "./page-filters/store";
|
||||
@ -26,8 +26,8 @@ export interface ItemListLayoutHeaderProps<I extends ItemObject, PreLoadStores e
|
||||
showHeader?: boolean;
|
||||
headerClassName?: IClassName;
|
||||
renderHeaderTitle?:
|
||||
| SafeReactNode
|
||||
| (() => SafeReactNode);
|
||||
| StrictReactNode
|
||||
| (() => StrictReactNode);
|
||||
customizeHeader?: HeaderCustomizer | HeaderCustomizer[];
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ import type { IComputedValue } from "mobx";
|
||||
import { computed, makeObservable, untracked } from "mobx";
|
||||
import type { ConfirmDialogParams } from "../confirm-dialog";
|
||||
import type { TableCellProps, TableProps, TableRowProps, TableSortCallbacks } from "../table";
|
||||
import type { IClassName, SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { IClassName, StrictReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import { cssNames, noop } from "@k8slens/utilities";
|
||||
import type { AddRemoveButtonsProps } from "../add-remove-buttons";
|
||||
import type { ItemObject } from "@k8slens/list-layout";
|
||||
@ -38,10 +38,10 @@ export type ItemsFilter<I extends ItemObject> = (items: I[]) => I[];
|
||||
export type ItemsFilters<I extends ItemObject> = Record<string, ItemsFilter<I>>;
|
||||
|
||||
export interface HeaderPlaceholders {
|
||||
title?: SafeReactNode;
|
||||
title?: StrictReactNode;
|
||||
searchProps?: SearchInputUrlProps;
|
||||
filters?: SafeReactNode;
|
||||
info?: SafeReactNode;
|
||||
filters?: StrictReactNode;
|
||||
info?: StrictReactNode;
|
||||
}
|
||||
|
||||
function normalizeText(value: Primitive) {
|
||||
@ -78,7 +78,7 @@ export type ItemListStore<I extends ItemObject, PreLoadStores extends boolean> =
|
||||
export type RenderHeaderTitle<
|
||||
Item extends ItemObject,
|
||||
PreLoadStores extends boolean,
|
||||
> = SafeReactNode | ((parent: NonInjectedItemListLayout<Item, PreLoadStores>) => SafeReactNode);
|
||||
> = StrictReactNode | ((parent: NonInjectedItemListLayout<Item, PreLoadStores>) => StrictReactNode);
|
||||
|
||||
export type HeaderCustomizer = (placeholders: HeaderPlaceholders) => HeaderPlaceholders;
|
||||
export type ItemListLayoutProps<Item extends ItemObject, PreLoadStores extends boolean = boolean> = {
|
||||
@ -107,8 +107,8 @@ export type ItemListLayoutProps<Item extends ItemObject, PreLoadStores extends b
|
||||
sortingCallbacks?: TableSortCallbacks<Item>;
|
||||
tableProps?: Partial<TableProps<Item>>; // low-level table configuration
|
||||
renderTableHeader?: (TableCellProps | undefined | null)[];
|
||||
renderTableContents: (item: Item) => (SafeReactNode | TableCellProps)[];
|
||||
renderItemMenu?: (item: Item, store: ItemListStore<Item, PreLoadStores>) => SafeReactNode;
|
||||
renderTableContents: (item: Item) => (StrictReactNode | TableCellProps)[];
|
||||
renderItemMenu?: (item: Item, store: ItemListStore<Item, PreLoadStores>) => StrictReactNode;
|
||||
customizeTableRowProps?: (item: Item) => Partial<TableRowProps<Item>>;
|
||||
addRemoveButtons?: Partial<AddRemoveButtonsProps>;
|
||||
virtual?: boolean;
|
||||
@ -120,7 +120,7 @@ export type ItemListLayoutProps<Item extends ItemObject, PreLoadStores extends b
|
||||
|
||||
// other
|
||||
customizeRemoveDialog?: (selectedItems: Item[]) => Partial<ConfirmDialogParams>;
|
||||
renderFooter?: (parent: NonInjectedItemListLayout<Item, PreLoadStores>) => SafeReactNode;
|
||||
renderFooter?: (parent: NonInjectedItemListLayout<Item, PreLoadStores>) => StrictReactNode;
|
||||
|
||||
spinnerTestId?: string;
|
||||
|
||||
@ -129,7 +129,7 @@ export type ItemListLayoutProps<Item extends ItemObject, PreLoadStores extends b
|
||||
*
|
||||
* @default "Failed to load items"
|
||||
*/
|
||||
failedToLoadMessage?: SafeReactNode;
|
||||
failedToLoadMessage?: StrictReactNode;
|
||||
|
||||
filterCallbacks?: ItemsFilters<Item>;
|
||||
"data-testid"?: string;
|
||||
|
@ -7,7 +7,7 @@ import styles from "./kubeconfig-dialog.module.scss";
|
||||
import React from "react";
|
||||
import type { IObservableValue } from "mobx";
|
||||
import { observer } from "mobx-react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { Button } from "@k8slens/button";
|
||||
import type { DialogProps } from "../dialog";
|
||||
@ -23,7 +23,7 @@ import kubeconfigDialogStateInjectable from "./state.injectable";
|
||||
import { saveFileDialog } from "../../utils/saveFile";
|
||||
|
||||
export interface KubeconfigDialogData {
|
||||
title?: SafeReactNode;
|
||||
title?: StrictReactNode;
|
||||
config: string;
|
||||
}
|
||||
|
||||
|
@ -6,10 +6,10 @@ import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import showCheckedErrorNotificationInjectable from "../notifications/show-checked-error.injectable";
|
||||
import kubeconfigDialogStateInjectable from "./state.injectable";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
export interface OpenKubeconfigDialogArgs {
|
||||
title?: SafeReactNode;
|
||||
title?: StrictReactNode;
|
||||
loader: () => Promise<string>;
|
||||
}
|
||||
|
||||
|
@ -7,13 +7,13 @@ import type { IconProps } from "../icon";
|
||||
import type React from "react";
|
||||
import type { PageTarget } from "../../routes/page-registration";
|
||||
import type { IComputedValue } from "mobx";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
export interface ClusterPageMenuRegistration {
|
||||
id?: string;
|
||||
parentId?: string;
|
||||
target?: PageTarget;
|
||||
title: SafeReactNode;
|
||||
title: StrictReactNode;
|
||||
components: ClusterPageMenuComponents;
|
||||
visible?: IComputedValue<boolean>;
|
||||
orderNumber?: number;
|
||||
|
@ -7,7 +7,7 @@ import styles from "./main-layout.module.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { ErrorBoundary } from "@k8slens/error-boundary";
|
||||
import { ResizeDirection, ResizeGrowthDirection, ResizeSide, ResizingAnchor } from "@k8slens/resizing-anchor";
|
||||
@ -17,10 +17,10 @@ import sidebarStorageInjectable, { defaultSidebarWidth } from "./sidebar-storage
|
||||
import type { StorageLayer } from "../../utils/storage-helper";
|
||||
|
||||
export interface MainLayoutProps {
|
||||
sidebar: SafeReactNode;
|
||||
sidebar: StrictReactNode;
|
||||
className?: string;
|
||||
footer?: SafeReactNode;
|
||||
children?: SafeReactNode;
|
||||
footer?: StrictReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,7 +7,7 @@ import "./setting-layout.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { IClassName, SafeReactNode } from "@k8slens/utilities";
|
||||
import type { IClassName, StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { CloseButton } from "./close-button";
|
||||
import { getLegacyGlobalDiForExtensionApi } from "@k8slens/legacy-global-di";
|
||||
@ -19,7 +19,7 @@ export interface SettingLayoutProps extends React.DOMAttributes<any> {
|
||||
contentClass?: IClassName;
|
||||
provideBackButtonNavigation?: boolean;
|
||||
contentGaps?: boolean;
|
||||
navigation?: SafeReactNode;
|
||||
navigation?: StrictReactNode;
|
||||
back?: (evt: React.MouseEvent | KeyboardEvent) => void;
|
||||
closeButtonProps?: { "data-testid"?: string };
|
||||
}
|
||||
|
@ -9,10 +9,10 @@ import React from "react";
|
||||
import siblingTabsInjectable from "../../routes/sibling-tabs.injectable";
|
||||
import { TabLayout } from "./tab-layout-2";
|
||||
import type { HierarchicalSidebarItem } from "./sidebar-items.injectable";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
interface SiblingTabLayoutProps {
|
||||
children: SafeReactNode;
|
||||
children: StrictReactNode;
|
||||
scrollable?: boolean;
|
||||
}
|
||||
|
||||
|
@ -8,14 +8,14 @@ import { computed } from "mobx";
|
||||
import { computedInjectManyInjectable } from "@ogre-tools/injectable-extension-for-mobx";
|
||||
import { byOrderNumber } from "../../../common/utils/composable-responsibilities/orderable/orderable";
|
||||
import type { SetRequired } from "type-fest";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
export interface SidebarItemRegistration {
|
||||
id: string;
|
||||
parentId: string | null;
|
||||
title: SafeReactNode;
|
||||
title: StrictReactNode;
|
||||
onClick: () => void;
|
||||
getIcon?: () => SafeReactNode;
|
||||
getIcon?: () => StrictReactNode;
|
||||
isActive?: IComputedValue<boolean>;
|
||||
isVisible?: IComputedValue<boolean>;
|
||||
orderNumber: number;
|
||||
|
@ -5,14 +5,14 @@
|
||||
|
||||
import "./sub-header.scss";
|
||||
import React from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface SubHeaderProps {
|
||||
className?: string;
|
||||
withLine?: boolean; // add bottom line
|
||||
compact?: boolean; // no extra padding around content
|
||||
children: SafeReactNode;
|
||||
children: StrictReactNode;
|
||||
}
|
||||
|
||||
export class SubHeader extends React.Component<SubHeaderProps> {
|
||||
|
@ -5,15 +5,15 @@
|
||||
|
||||
import "./sub-title.scss";
|
||||
import React from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface SubTitleProps {
|
||||
className?: string;
|
||||
title: SafeReactNode;
|
||||
title: StrictReactNode;
|
||||
compact?: boolean; // no bottom padding
|
||||
id?: string;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
export class SubTitle extends React.Component<SubTitleProps> {
|
||||
|
@ -7,7 +7,7 @@ import "./tab-layout.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { Tab, Tabs } from "../tabs";
|
||||
import { ErrorBoundary } from "@k8slens/error-boundary";
|
||||
@ -15,7 +15,7 @@ import type { HierarchicalSidebarItem } from "./sidebar-items.injectable";
|
||||
|
||||
export interface TabLayoutProps {
|
||||
tabs?: HierarchicalSidebarItem[];
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
scrollable?: boolean;
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@ import "./tab-layout.scss";
|
||||
import React from "react";
|
||||
import { matchPath, Redirect, Route, Switch } from "react-router";
|
||||
import { observer } from "mobx-react";
|
||||
import type { IClassName, SafeReactNode } from "@k8slens/utilities";
|
||||
import type { IClassName, StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { Tab, Tabs } from "../tabs";
|
||||
import { ErrorBoundary } from "@k8slens/error-boundary";
|
||||
@ -22,13 +22,13 @@ export interface TabLayoutProps {
|
||||
className?: IClassName;
|
||||
contentClass?: IClassName;
|
||||
tabs?: TabLayoutRoute[];
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
scrollable?: boolean;
|
||||
}
|
||||
|
||||
export interface TabLayoutRoute {
|
||||
routePath: string;
|
||||
title: SafeReactNode;
|
||||
title: StrictReactNode;
|
||||
component: React.ComponentType<any>;
|
||||
url?: string; // page-url, if not provided `routePath` is used (doesn't work when path has some :placeholder(s))
|
||||
exact?: boolean; // route-path matching rule
|
||||
|
@ -6,16 +6,16 @@
|
||||
import "./wizard-layout.scss";
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { IClassName, SafeReactNode } from "@k8slens/utilities";
|
||||
import type { IClassName, StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface WizardLayoutProps extends React.DOMAttributes<any> {
|
||||
className?: IClassName;
|
||||
header?: SafeReactNode;
|
||||
header?: StrictReactNode;
|
||||
headerClass?: IClassName;
|
||||
contentClass?: IClassName;
|
||||
infoPanelClass?: IClassName;
|
||||
infoPanel?: SafeReactNode;
|
||||
infoPanel?: StrictReactNode;
|
||||
centered?: boolean; // Centering content horizontally
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import "./line-progress.scss";
|
||||
import React from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { withTooltip } from "@k8slens/tooltip";
|
||||
|
||||
@ -15,7 +15,7 @@ export interface LineProgressProps extends React.HTMLProps<HTMLDivElement> {
|
||||
max?: number;
|
||||
className?: any;
|
||||
precise?: number;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
function valuePercent({ value, min, max, precise }: Required<Pick<LineProgressProps, "value" | "min" | "max" | "precise">>) {
|
||||
|
@ -9,14 +9,14 @@ import { SearchInput } from "../input";
|
||||
|
||||
import type { UseTableOptions } from "react-table";
|
||||
import { ReactTable } from "../table/react-table";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
export type SearchFilter<T> = (item: T) => string | number;
|
||||
|
||||
export interface ListProps<T> extends UseTableOptions<any> {
|
||||
items: T[];
|
||||
filters: SearchFilter<T>[];
|
||||
title?: SafeReactNode;
|
||||
title?: StrictReactNode;
|
||||
}
|
||||
|
||||
export function List<T>({ columns, data, title, items, filters }: ListProps<T>) {
|
||||
|
@ -8,7 +8,7 @@ import "./menu-actions.scss";
|
||||
import React, { isValidElement } from "react";
|
||||
import { observable, makeObservable, reaction } from "mobx";
|
||||
import { disposeOnUnmount, observer } from "mobx-react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import type { IconProps } from "../icon";
|
||||
import { Icon } from "../icon";
|
||||
@ -26,11 +26,11 @@ export interface MenuActionsProps extends Partial<MenuProps> {
|
||||
className?: string;
|
||||
toolbar?: boolean; // display menu as toolbar with icons
|
||||
autoCloseOnSelect?: boolean;
|
||||
triggerIcon?: string | (IconProps & TooltipDecoratorProps) | SafeReactNode;
|
||||
triggerIcon?: string | (IconProps & TooltipDecoratorProps) | StrictReactNode;
|
||||
/**
|
||||
* @deprecated Provide your own remove `<MenuItem>` as part of the `children` passed to this component
|
||||
*/
|
||||
removeConfirmationMessage?: SafeReactNode | (() => SafeReactNode);
|
||||
removeConfirmationMessage?: StrictReactNode | (() => StrictReactNode);
|
||||
/**
|
||||
* @deprecated Provide your own update `<MenuItem>` as part of the `children` passed to this component
|
||||
*/
|
||||
|
@ -8,7 +8,7 @@ import "./menu.scss";
|
||||
import type { ReactElement } from "react";
|
||||
import React, { Fragment } from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, noop } from "@k8slens/utilities";
|
||||
import { Animate } from "../animate";
|
||||
import type { IconProps } from "../icon";
|
||||
@ -49,7 +49,7 @@ export interface MenuProps {
|
||||
closeOnClickOutside?: boolean; // use false value for sub-menus
|
||||
closeOnScroll?: boolean; // applicable when usePortal={true}
|
||||
position?: MenuPosition; // applicable when usePortal={false}
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
animated?: boolean;
|
||||
toggleEvent?: "click" | "contextmenu";
|
||||
"data-testid"?: string;
|
||||
|
@ -12,10 +12,10 @@ import { renderFor } from "../test-utils/renderFor";
|
||||
import hierarchicalNamespacesInjectable from "./hierarchical-namespaces.injectable";
|
||||
import { NamespaceTreeView } from "./namespace-tree-view";
|
||||
import type { NamespaceTree } from "./store";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
jest.mock("react-router-dom", () => ({
|
||||
Link: ({ children }: { children: SafeReactNode }) => children,
|
||||
Link: ({ children }: { children: StrictReactNode }) => children,
|
||||
}));
|
||||
|
||||
function createNamespace(name: string, labels?: Record<string, string>, annotations?: Record<string, string>): Namespace {
|
||||
|
@ -6,12 +6,12 @@
|
||||
import "./no-items.scss";
|
||||
|
||||
import React from "react";
|
||||
import type { IClassName, SafeReactNode } from "@k8slens/utilities";
|
||||
import type { IClassName, StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
|
||||
export interface NoItemsProps {
|
||||
className?: IClassName;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
export function NoItems(props: NoItemsProps) {
|
||||
|
@ -15,7 +15,7 @@ import { Table, TableCell, TableHead, TableRow } from "../table";
|
||||
import type { Logger } from "@k8slens/logger";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import { loggerInjectionToken } from "@k8slens/logger";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
|
||||
export interface PodSecurityPolicyDetailsProps extends KubeObjectDetailsProps<PodSecurityPolicy> {
|
||||
}
|
||||
@ -34,7 +34,7 @@ interface Dependencies {
|
||||
|
||||
@observer
|
||||
class NonInjectedPodSecurityPolicyDetails extends React.Component<PodSecurityPolicyDetailsProps & Dependencies> {
|
||||
renderRuleGroup(title: SafeReactNode, group: RuleGroup | undefined) {
|
||||
renderRuleGroup(title: StrictReactNode, group: RuleGroup | undefined) {
|
||||
if (!group) return null;
|
||||
const { rule, ranges } = group;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import "./radio.scss";
|
||||
import React, { useContext, useRef } from "react";
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { StrictReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import { cssNames, noop } from "@k8slens/utilities";
|
||||
|
||||
export interface RadioGroupProps<T> {
|
||||
@ -50,7 +50,7 @@ export function RadioGroup<T>({
|
||||
|
||||
export interface RadioProps<T> {
|
||||
className?: string;
|
||||
label: SafeReactNode;
|
||||
label: StrictReactNode;
|
||||
value: T;
|
||||
disabled?: boolean;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import React, { useEffect, useState } from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import type { RequestIdleCallback } from "./request-idle-callback.injectable";
|
||||
import type { CancelIdleCallback } from "./cancel-idle-callback.injectable";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
@ -13,8 +13,8 @@ import requestIdleCallbackInjectable from "./request-idle-callback.injectable";
|
||||
import idleCallbackTimeoutInjectable from "./idle-callback-timeout.injectable";
|
||||
|
||||
export interface RenderDelayProps {
|
||||
placeholder?: SafeReactNode;
|
||||
children: SafeReactNode;
|
||||
placeholder?: StrictReactNode;
|
||||
children: StrictReactNode;
|
||||
}
|
||||
|
||||
interface Dependencies {
|
||||
|
@ -14,7 +14,7 @@ import { observer } from "mobx-react";
|
||||
import ReactSelect, { components, createFilter } from "react-select";
|
||||
import type { Props as ReactSelectProps, GroupBase, MultiValue, OptionsOrGroups, PropsValue, SingleValue } from "react-select";
|
||||
import type { LensTheme } from "../../themes/lens-theme";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import activeThemeInjectable from "../../themes/active.injectable";
|
||||
@ -24,7 +24,7 @@ const { Menu } = components;
|
||||
|
||||
export interface SelectOption<Value> {
|
||||
value: Value;
|
||||
label: SafeReactNode;
|
||||
label: StrictReactNode;
|
||||
isDisabled?: boolean;
|
||||
isSelected?: boolean;
|
||||
id?: string;
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import type { IComputedValue } from "mobx";
|
||||
|
||||
/**
|
||||
@ -35,10 +35,10 @@ export interface StatusBarRegistration {
|
||||
/**
|
||||
* @deprecated use {@link StatusBarRegistration.components} instead
|
||||
*/
|
||||
item?: SafeReactNode | (() => SafeReactNode);
|
||||
item?: StrictReactNode | (() => StrictReactNode);
|
||||
|
||||
/**
|
||||
* The newer API, allows for registering a component instead of a SafeReactNode
|
||||
* The newer API, allows for registering a component instead of a StrictReactNode
|
||||
*/
|
||||
components?: StatusBarComponents;
|
||||
|
||||
|
@ -6,12 +6,12 @@
|
||||
import "./status-brick.scss";
|
||||
|
||||
import React from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { withTooltip } from "@k8slens/tooltip";
|
||||
|
||||
export interface StatusBrickProps extends React.HTMLAttributes<HTMLDivElement> {
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
export const StatusBrick = withTooltip(({ className, ...elemProps }: StatusBrickProps) => (
|
||||
|
@ -3,18 +3,18 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import React from "react";
|
||||
|
||||
interface FormControlLabelProps {
|
||||
control: React.ReactElement<any, any>;
|
||||
label: SafeReactNode;
|
||||
label: StrictReactNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use <Switch/> instead from "../switch.tsx".
|
||||
*/
|
||||
export function FormSwitch(props: FormControlLabelProps & { children?: SafeReactNode }) {
|
||||
export function FormSwitch(props: FormControlLabelProps & { children?: StrictReactNode }) {
|
||||
const ClonedElement = React.cloneElement(props.control, {
|
||||
children: <span>{props.label}</span>,
|
||||
});
|
||||
|
@ -3,13 +3,13 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import React from "react";
|
||||
import { Switch } from "./switch";
|
||||
|
||||
export interface SwitcherProps {
|
||||
disabled?: boolean;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
checked?: boolean;
|
||||
onChange?: (event: React.ChangeEvent<HTMLInputElement>, checked: boolean) => void;
|
||||
name?: string;
|
||||
|
@ -7,7 +7,7 @@ import "./table-cell.scss";
|
||||
import type { TableSortBy, TableSortParams } from "./table";
|
||||
|
||||
import React from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { Icon } from "../icon";
|
||||
import { Checkbox } from "../checkbox";
|
||||
@ -29,7 +29,7 @@ export interface TableCellProps extends React.DOMAttributes<HTMLDivElement> {
|
||||
/**
|
||||
* The actual value of the cell
|
||||
*/
|
||||
title?: SafeReactNode;
|
||||
title?: StrictReactNode;
|
||||
|
||||
/**
|
||||
* content inside could be scrolled
|
||||
|
@ -7,7 +7,7 @@ import "./table.scss";
|
||||
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, isDefined } from "@k8slens/utilities";
|
||||
import type { TableRowElem, TableRowProps } from "./table-row";
|
||||
import { TableRow } from "./table-row";
|
||||
@ -87,7 +87,7 @@ export interface TableProps<Item> extends React.DOMAttributes<HTMLDivElement> {
|
||||
/**
|
||||
* This is shown when {@link TableProps.items} is empty
|
||||
*/
|
||||
noItems?: SafeReactNode;
|
||||
noItems?: StrictReactNode;
|
||||
/**
|
||||
* Allows to scroll list to selected item
|
||||
*/
|
||||
|
@ -6,7 +6,7 @@
|
||||
import "./tabs.scss";
|
||||
import type { DOMAttributes } from "react";
|
||||
import React from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { Icon } from "../icon";
|
||||
import autoBindReact from "auto-bind/react";
|
||||
@ -56,8 +56,8 @@ export interface TabProps<D> extends DOMAttributes<HTMLElement> {
|
||||
className?: string;
|
||||
active?: boolean;
|
||||
disabled?: boolean;
|
||||
icon?: SafeReactNode | string; // material-io name or custom icon
|
||||
label?: SafeReactNode;
|
||||
icon?: StrictReactNode | string; // material-io name or custom icon
|
||||
label?: StrictReactNode;
|
||||
value: D;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
import styles from "./tree-view.module.scss";
|
||||
import type { MouseEventHandler } from "react";
|
||||
import React, { useState } from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { Icon } from "../icon";
|
||||
|
||||
@ -16,7 +16,7 @@ export interface TreeViewClasses {
|
||||
|
||||
export interface TreeViewProps {
|
||||
classes?: TreeViewClasses;
|
||||
children: SafeReactNode;
|
||||
children: StrictReactNode;
|
||||
}
|
||||
|
||||
export function TreeView(props: TreeViewProps) {
|
||||
|
@ -9,7 +9,7 @@ import moment from "moment";
|
||||
import React from "react";
|
||||
|
||||
import type { Secret } from "@k8slens/kube-object";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { prevDefault } from "@k8slens/utilities";
|
||||
import { Icon } from "../../icon";
|
||||
|
||||
@ -23,7 +23,7 @@ interface State {
|
||||
|
||||
interface RenderRowArgs {
|
||||
name: string;
|
||||
value: SafeReactNode;
|
||||
value: StrictReactNode;
|
||||
}
|
||||
|
||||
export class ServiceAccountsSecret extends React.Component<ServiceAccountsSecretProps, State> {
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
import "./wizard.scss";
|
||||
import React from "react";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, prevDefault } from "@k8slens/utilities";
|
||||
import { Button } from "@k8slens/button";
|
||||
import { Stepper } from "../stepper";
|
||||
@ -25,7 +25,7 @@ export interface WizardProps<D> extends WizardCommonProps<D> {
|
||||
className?: string;
|
||||
step?: number;
|
||||
title?: string;
|
||||
header?: SafeReactNode;
|
||||
header?: StrictReactNode;
|
||||
onChange?: (step: number) => void;
|
||||
children?: React.ReactElement<WizardStepProps<D>>[] | React.ReactElement<WizardStepProps<D>>;
|
||||
}
|
||||
@ -108,28 +108,28 @@ export interface WizardStepProps<D> extends WizardCommonProps<D> {
|
||||
title?: string;
|
||||
className?: string | object;
|
||||
contentClass?: string | object;
|
||||
customButtons?: SafeReactNode; // render custom buttons block in footer
|
||||
moreButtons?: SafeReactNode; // add more buttons to section in the footer
|
||||
customButtons?: StrictReactNode; // render custom buttons block in footer
|
||||
moreButtons?: StrictReactNode; // add more buttons to section in the footer
|
||||
loading?: boolean; // indicator of loading content for the step
|
||||
waiting?: boolean; // indicator of waiting response before going to next step
|
||||
disabledNext?: boolean; // disable next button flag, e.g when filling step is not finished
|
||||
hideNextBtn?: boolean;
|
||||
hideBackBtn?: boolean;
|
||||
step?: number;
|
||||
prevLabel?: SafeReactNode; // custom label for prev button
|
||||
nextLabel?: SafeReactNode; // custom label for next button
|
||||
prevLabel?: StrictReactNode; // custom label for prev button
|
||||
nextLabel?: StrictReactNode; // custom label for next button
|
||||
next?: () => void | boolean | Promise<any>; // custom action for next button
|
||||
prev?: () => void; // custom action for prev button
|
||||
first?: () => void;
|
||||
last?: () => void;
|
||||
isFirst?: () => boolean;
|
||||
isLast?: () => boolean;
|
||||
beforeContent?: SafeReactNode;
|
||||
afterContent?: SafeReactNode;
|
||||
beforeContent?: StrictReactNode;
|
||||
afterContent?: StrictReactNode;
|
||||
noValidate?: boolean; // no validate form attribute
|
||||
skip?: boolean; // don't render the step
|
||||
scrollable?: boolean;
|
||||
children?: SafeReactNode | SafeReactNode[];
|
||||
children?: StrictReactNode | StrictReactNode[];
|
||||
testIdForNext?: string;
|
||||
testIdForPrev?: string;
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import type { KubeObject } from "@k8slens/kube-object";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import type { TableSortCallback, SearchFilter, TableCellProps } from "./list-layout-column";
|
||||
|
||||
export interface BaseKubeObjectListLayoutColumn<K extends KubeObject> {
|
||||
@ -13,7 +13,7 @@ export interface BaseKubeObjectListLayoutColumn<K extends KubeObject> {
|
||||
sortingCallBack?: TableSortCallback<K>;
|
||||
searchFilter?: SearchFilter<K>;
|
||||
header: TableCellProps | undefined | null;
|
||||
content: (item: K) => SafeReactNode | TableCellProps;
|
||||
content: (item: K) => StrictReactNode | TableCellProps;
|
||||
}
|
||||
|
||||
export interface GeneralKubeObjectListLayoutColumn extends BaseKubeObjectListLayoutColumn<KubeObject> {
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { SafeReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
import type { StrictReactNode, SingleOrMany } from "@k8slens/utilities";
|
||||
|
||||
export interface ItemObject {
|
||||
getId: () => string;
|
||||
@ -36,7 +36,7 @@ export interface TableCellProps extends React.DOMAttributes<HTMLDivElement> {
|
||||
/**
|
||||
* The actual value of the cell
|
||||
*/
|
||||
title?: SafeReactNode;
|
||||
title?: StrictReactNode;
|
||||
|
||||
/**
|
||||
* content inside could be scrolled
|
||||
|
@ -1,9 +1,9 @@
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { getInjectionToken } from "@ogre-tools/injectable";
|
||||
import type React from "react";
|
||||
|
||||
export type ReactApplicationHigherOrderComponent = React.ComponentType<{
|
||||
children: SafeReactNode;
|
||||
children: StrictReactNode;
|
||||
}>;
|
||||
|
||||
export const reactApplicationHigherOrderComponentInjectionToken =
|
||||
|
@ -6,11 +6,11 @@
|
||||
import "./button.scss";
|
||||
import type { ButtonHTMLAttributes } from "react";
|
||||
import React from "react";
|
||||
import { cssNames, SafeReactNode } from "@k8slens/utilities";
|
||||
import { cssNames, StrictReactNode } from "@k8slens/utilities";
|
||||
import { withTooltip } from "@k8slens/tooltip";
|
||||
|
||||
export interface ButtonProps extends ButtonHTMLAttributes<any> {
|
||||
label?: SafeReactNode;
|
||||
label?: StrictReactNode;
|
||||
waiting?: boolean;
|
||||
primary?: boolean;
|
||||
accent?: boolean;
|
||||
@ -23,7 +23,7 @@ export interface ButtonProps extends ButtonHTMLAttributes<any> {
|
||||
round?: boolean;
|
||||
href?: string; // render as hyperlink
|
||||
target?: "_blank"; // in case of using @href
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
export const Button = withTooltip((props: ButtonProps) => {
|
||||
|
@ -9,7 +9,7 @@ import type { ErrorInfo } from "react";
|
||||
import React from "react";
|
||||
import { observer } from "mobx-react";
|
||||
import { Button } from "@k8slens/button";
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import type { ObservableHistory } from "mobx-observable-history";
|
||||
import { withInjectables } from "@ogre-tools/injectable-react";
|
||||
import { observableHistoryInjectionToken } from "@k8slens/routing";
|
||||
@ -18,7 +18,7 @@ const issuesTrackerUrl = "https://github.com/lensapp/lens/issues";
|
||||
const forumsUrl = "https://forums.k8slens.dev";
|
||||
|
||||
export interface ErrorBoundaryProps {
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
@ -8,7 +8,7 @@ import "./tooltip.scss";
|
||||
import React from "react";
|
||||
import { createPortal } from "react-dom";
|
||||
import { observer } from "mobx-react";
|
||||
import type { IClassName, SafeReactNode } from "@k8slens/utilities";
|
||||
import type { IClassName, StrictReactNode } from "@k8slens/utilities";
|
||||
import { cssNames } from "@k8slens/utilities";
|
||||
import { observable, makeObservable, action, runInAction } from "mobx";
|
||||
import autoBindReact from "auto-bind/react";
|
||||
@ -35,7 +35,7 @@ export interface TooltipProps {
|
||||
className?: IClassName;
|
||||
formatters?: TooltipContentFormatters;
|
||||
style?: React.CSSProperties;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
"data-testid"?: string;
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
|
||||
import type { SafeReactNode } from "@k8slens/utilities";
|
||||
import type { StrictReactNode } from "@k8slens/utilities";
|
||||
import { render, RenderResult } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import React from "react";
|
||||
@ -12,7 +12,7 @@ import { withTooltip } from "./withTooltip";
|
||||
type MyComponentProps = {
|
||||
text: string;
|
||||
id?: string;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
"data-testid"?: string;
|
||||
};
|
||||
|
||||
|
@ -6,19 +6,18 @@
|
||||
import React, { useState } from "react";
|
||||
import type { TooltipProps } from "./tooltip";
|
||||
import { Tooltip } from "./tooltip";
|
||||
import { isReactNode, SafeReactNode } from "@k8slens/utilities";
|
||||
import { isReactNode, StrictReactNode } from "@k8slens/utilities";
|
||||
import uniqueId from "lodash/uniqueId";
|
||||
import type { SingleOrMany } from "@k8slens/utilities";
|
||||
|
||||
export interface TooltipDecoratorProps {
|
||||
tooltip?: SafeReactNode | Omit<TooltipProps, "targetId">;
|
||||
tooltip?: StrictReactNode | Omit<TooltipProps, "targetId">;
|
||||
/**
|
||||
* forces tooltip to detect the target's parent for mouse events. This is
|
||||
* useful for displaying tooltips even when the target is "disabled"
|
||||
*/
|
||||
tooltipOverrideDisabled?: boolean;
|
||||
id?: string;
|
||||
children?: SafeReactNode;
|
||||
children?: StrictReactNode;
|
||||
}
|
||||
|
||||
export function withTooltip<TargetProps>(
|
||||
|
@ -5,15 +5,25 @@
|
||||
|
||||
import React from "react";
|
||||
import { isObject } from "./type-narrowing";
|
||||
import type { SingleOrMany } from "./types";
|
||||
|
||||
export type SafeReactNode = React.ReactElement | React.ReactText | boolean | null | undefined | Iterable<SafeReactNode>;
|
||||
export type StrictReactFragment =
|
||||
| {
|
||||
key?: string | number | null;
|
||||
ref?: null;
|
||||
props?: {
|
||||
children?: StrictReactNode;
|
||||
};
|
||||
};
|
||||
|
||||
export function toSafeReactChildrenArray(children: SafeReactNode) {
|
||||
return React.Children.toArray(children) as (Exclude<SafeReactNode, boolean | null | undefined>)[];
|
||||
}
|
||||
export type StrictReactNode =
|
||||
| React.ReactChild
|
||||
| StrictReactFragment
|
||||
| React.ReactPortal
|
||||
| boolean
|
||||
| null
|
||||
| undefined;
|
||||
|
||||
export function isReactNode(node: unknown): node is SafeReactNode {
|
||||
export function isReactNode(node: unknown): node is StrictReactNode {
|
||||
return (isObject(node) && React.isValidElement(node))
|
||||
|| Array.isArray(node) && node.every(isReactNode)
|
||||
|| node == null
|
||||
|
Loading…
Reference in New Issue
Block a user