Skip to content

Commit

Permalink
Updated spectrum imports to use dh components (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmingles committed Apr 18, 2024
1 parent 5ed66a7 commit bdc542d
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 42 deletions.
2 changes: 1 addition & 1 deletion plugins/ui/src/js/src/elements/ElementUtils.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Text } from '@adobe/react-spectrum';
import { Text } from '@deephaven/components';
import type { dh } from '@deephaven/jsapi-types';
import { TestUtils } from '@deephaven/utils';
import {
Expand Down
6 changes: 3 additions & 3 deletions plugins/ui/src/js/src/elements/ElementUtils.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Text } from '@adobe/react-spectrum';
import { Text } from '@deephaven/components';
import type { dh } from '@deephaven/jsapi-types';
import { ITEM_ELEMENT_NAME } from './ElementConstants';
import ObjectView from './ObjectView';
Expand All @@ -25,7 +25,7 @@ export type ObjectNode = {
*/
export type ElementNode<
K extends string = string,
P extends Record<string, unknown> = Record<string, unknown>,
P extends Record<string, unknown> = Record<string, unknown>

Check failure on line 28 in plugins/ui/src/js/src/elements/ElementUtils.tsx

View workflow job for this annotation

GitHub Actions / test-js / unit

Insert `,`

Check failure on line 28 in plugins/ui/src/js/src/elements/ElementUtils.tsx

View workflow job for this annotation

GitHub Actions / test-js / unit

Insert `,`
> = {
/**
* The type of this element. Can be something like `deephaven.ui.components.Panel`, or
Expand All @@ -37,7 +37,7 @@ export type ElementNode<

export type ElementNodeWithChildren<
K extends string = string,
P extends Record<string, unknown> = Record<string, unknown>,
P extends Record<string, unknown> = Record<string, unknown>

Check failure on line 40 in plugins/ui/src/js/src/elements/ElementUtils.tsx

View workflow job for this annotation

GitHub Actions / test-js / unit

Insert `,`

Check failure on line 40 in plugins/ui/src/js/src/elements/ElementUtils.tsx

View workflow job for this annotation

GitHub Actions / test-js / unit

Insert `,`
> = ElementNode<K, P> & {
props: React.PropsWithChildren<P>;
};
Expand Down
11 changes: 5 additions & 6 deletions plugins/ui/src/js/src/elements/SpectrumElementUtils.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { ButtonGroup, Checkbox, Icon } from '@adobe/react-spectrum';
import { ValueOf } from '@deephaven/utils';
import {
ButtonGroup,
Checkbox,
Content,
ContextualHelp,
Grid,
Heading,
Icon,
Item,
IllustratedMessage,
NumberField,
Expand All @@ -14,9 +13,9 @@ import {
TabList,
Text,
ToggleButton,
} from '@adobe/react-spectrum';
import { ValueOf } from '@deephaven/utils';
import { Flex, View } from '@deephaven/components';
Flex,
View,
} from '@deephaven/components';
import {
ActionButton,
Button,
Expand Down
10 changes: 5 additions & 5 deletions plugins/ui/src/js/src/elements/spectrum/ActionButton.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import React from 'react';
import {
ActionButton as SpectrumActionButton,
SpectrumActionButtonProps,
} from '@adobe/react-spectrum';
ActionButton as DHCActionButton,
ActionButtonProps as DHCActionButtonProps,
} from '@deephaven/components';
import { SerializedButtonEventProps, useButtonProps } from './useButtonProps';

function ActionButton(
props: SpectrumActionButtonProps & SerializedButtonEventProps
props: DHCActionButtonProps & SerializedButtonEventProps
): JSX.Element {
const buttonProps = useButtonProps(props);

// eslint-disable-next-line react/jsx-props-no-spreading
return <SpectrumActionButton {...buttonProps} />;
return <DHCActionButton {...buttonProps} />;
}

export default ActionButton;
9 changes: 6 additions & 3 deletions plugins/ui/src/js/src/elements/spectrum/Form.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import React, { useCallback } from 'react';
import { Form as SpectrumForm, SpectrumFormProps } from '@adobe/react-spectrum';
import {
Form as DHCForm,
FormProps as DHCFormProps,
} from '@deephaven/components';

function Form(
props: SpectrumFormProps & {
props: DHCFormProps & {
onSubmit?: (data: { [key: string]: FormDataEntryValue }) => void;
}
): JSX.Element {
Expand All @@ -22,7 +25,7 @@ function Form(

return (
// eslint-disable-next-line react/jsx-props-no-spreading
<SpectrumForm onSubmit={onSubmit} {...otherProps} />
<DHCForm onSubmit={onSubmit} {...otherProps} />
);
}

Expand Down
10 changes: 5 additions & 5 deletions plugins/ui/src/js/src/elements/spectrum/RangeSlider.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useCallback, useState } from 'react';
import {
RangeSlider as SpectrumRangeSlider,
SpectrumRangeSliderProps,
} from '@adobe/react-spectrum';
RangeSlider as DHCRangeSlider,
RangeSliderProps as DHCRangeSliderProps,
} from '@deephaven/components';
import { useDebouncedCallback } from '@deephaven/react-hooks';

const VALUE_CHANGE_DEBOUNCE = 250;

const EMPTY_FUNCTION = () => undefined;

function RangeSlider(props: SpectrumRangeSliderProps): JSX.Element {
function RangeSlider(props: DHCRangeSliderProps): JSX.Element {
const {
defaultValue = { start: 0, end: 0 },
value: propValue,
Expand All @@ -34,7 +34,7 @@ function RangeSlider(props: SpectrumRangeSliderProps): JSX.Element {

return (
// eslint-disable-next-line react/jsx-props-no-spreading
<SpectrumRangeSlider value={value} onChange={onChange} {...otherProps} />
<DHCRangeSlider value={value} onChange={onChange} {...otherProps} />
);
}

Expand Down
10 changes: 5 additions & 5 deletions plugins/ui/src/js/src/elements/spectrum/Slider.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useCallback, useState } from 'react';
import {
Slider as SpectrumSlider,
SpectrumSliderProps,
} from '@adobe/react-spectrum';
Slider as DHCSlider,
SliderProps as DHCSliderProps,
} from '@deephaven/components';
import { useDebouncedCallback } from '@deephaven/react-hooks';

const VALUE_CHANGE_DEBOUNCE = 250;

const EMPTY_FUNCTION = () => undefined;

function Slider(props: SpectrumSliderProps): JSX.Element {
function Slider(props: DHCSliderProps): JSX.Element {
const {
defaultValue = 0,
value: propValue,
Expand All @@ -34,7 +34,7 @@ function Slider(props: SpectrumSliderProps): JSX.Element {

return (
// eslint-disable-next-line react/jsx-props-no-spreading
<SpectrumSlider value={value} onChange={onChange} {...otherProps} />
<DHCSlider value={value} onChange={onChange} {...otherProps} />
);
}

Expand Down
12 changes: 5 additions & 7 deletions plugins/ui/src/js/src/elements/spectrum/TabPanels.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import React from 'react';
import {
TabPanels as SpectrumTabPanels,
SpectrumTabPanelsProps,
} from '@adobe/react-spectrum';
TabPanels as DHCTabPanels,
TabPanelsProps as DHCTabPanelsProps,
} from '@deephaven/components';

function TabPanels(
props: SpectrumTabPanelsProps<React.ReactNode>
): JSX.Element {
function TabPanels(props: DHCTabPanelsProps<React.ReactNode>): JSX.Element {
const { UNSAFE_style: unsafeStyle, ...otherProps } = props;

return (
<SpectrumTabPanels
<DHCTabPanels
// eslint-disable-next-line react/jsx-props-no-spreading
{...otherProps}
UNSAFE_style={{ display: 'flex', ...unsafeStyle }}
Expand Down
10 changes: 5 additions & 5 deletions plugins/ui/src/js/src/elements/spectrum/TextField.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useCallback, useState } from 'react';
import {
SpectrumTextFieldProps,
TextField as SpectrumTextField,
} from '@adobe/react-spectrum';
TextField as DHCTextField,
TextFieldProps as DHCTextFieldProps,
} from '@deephaven/components';
import { useDebouncedCallback } from '@deephaven/react-hooks';

const VALUE_CHANGE_DEBOUNCE = 250;

const EMPTY_FUNCTION = () => undefined;

function TextField(props: SpectrumTextFieldProps): JSX.Element {
function TextField(props: DHCTextFieldProps): JSX.Element {
const {
defaultValue = '',
value: propValue,
Expand All @@ -34,7 +34,7 @@ function TextField(props: SpectrumTextFieldProps): JSX.Element {

return (
// eslint-disable-next-line react/jsx-props-no-spreading
<SpectrumTextField value={value} onChange={onChange} {...otherProps} />
<DHCTextField value={value} onChange={onChange} {...otherProps} />
);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Text } from '@adobe/react-spectrum';
import React from 'react';
import { Text } from '@deephaven/components';

/**
* Map the children of an element to Spectrum children, automatically wrapping strings and numbers in `Text` elements.
Expand Down
2 changes: 1 addition & 1 deletion plugins/ui/src/js/src/widget/WidgetUtils.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { Text } from '@adobe/react-spectrum';
import { Text } from '@deephaven/components';
import {
FRAGMENT_ELEMENT_NAME,
ITEM_ELEMENT_NAME,
Expand Down

0 comments on commit bdc542d

Please sign in to comment.