Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Export Spectrum Toast from Components Package #2294

Merged
merged 10 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,579 changes: 3,092 additions & 1,487 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion packages/code-studio/src/main/App.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React, { type ReactElement } from 'react';
import { ContextMenuRoot } from '@deephaven/components';
import { ContextMenuRoot, ToastContainer } from '@deephaven/components';
import AppMainContainer from './AppMainContainer';

function App(): ReactElement {
return (
<div className="app">
<AppMainContainer />
<ContextMenuRoot />
<ToastContainer />
</div>
);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/code-studio/src/styleguide/StyleGuide.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
ThemePicker,
useTheme,
Flex,
ToastContainer,
} from '@deephaven/components';

import Buttons from './Buttons';
Expand All @@ -24,6 +25,7 @@ import Modals from './Modals';
import Progress from './Progress';
import TimeSliderInputs from './TimeSliderInputs';
import Tooltips from './Tooltips';
import Toast from './Toast';
import Typograpy from './Typography';
import './StyleGuide.scss';
import DraggableLists from './DraggableLists';
Expand Down Expand Up @@ -125,6 +127,7 @@ function StyleGuide(): React.ReactElement {
<ContextMenus />
<DropdownMenus />
<Navigations />
<Toast />
<Tooltips />
<Icons />
<Editors />
Expand All @@ -140,6 +143,7 @@ function StyleGuide(): React.ReactElement {

<SampleMenuCategory data-menu-category="Spectrum Comparison" />
<SpectrumComparison />
<ToastContainer />
</div>
</div>
);
Expand Down
47 changes: 47 additions & 0 deletions packages/code-studio/src/styleguide/Toast.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from 'react';
import { Button, ButtonGroup, ToastQueue } from '@deephaven/components';
import SampleSection from './SampleSection';

function Toast(): React.ReactElement {
return (
<SampleSection name="toast">
<h2 className="ui-title">Toast</h2>
<div>
<ButtonGroup>
<Button
kind="tertiary"
onClick={() =>
ToastQueue.neutral('Neutral toast', { timeout: 5000 })
}
>
Show neutral toast
</Button>
<Button
kind="success"
onClick={() =>
ToastQueue.positive('Positive toast', { timeout: 5000 })
}
>
Show positive toast
</Button>
<Button
kind="danger"
onClick={() =>
ToastQueue.negative('Negative toast', { timeout: 5000 })
}
>
Show negative toast
</Button>
<Button
kind="primary"
onClick={() => ToastQueue.info('Info toast', { timeout: 5000 })}
>
Show info toast
</Button>
</ButtonGroup>
</div>
</SampleSection>
);
}

export default Toast;
1 change: 1 addition & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"@fortawesome/react-fontawesome": "^0.2.0",
"@internationalized/date": "^3.5.5",
"@react-spectrum/theme-default": "^3.5.1",
"@react-spectrum/toast": "^3.0.0-beta.16",
"@react-spectrum/utils": "^3.11.5",
"@react-types/radio": "^3.8.1",
"@react-types/shared": "^3.22.1",
Expand Down
7 changes: 7 additions & 0 deletions packages/components/src/spectrum/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ export {
StatusLight,
type SpectrumStatusLightProps as StatusLightProps,
} from '@adobe/react-spectrum';

export {
ToastContainer,
type SpectrumToastContainerProps as ToastContainerProps,
ToastQueue,
type SpectrumToastOptions as ToastOptions,
} from '@react-spectrum/toast';
2 changes: 2 additions & 0 deletions packages/embed-widget/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
LoadingOverlay,
Shortcut,
ShortcutRegistry,
ToastContainer,
} from '@deephaven/components'; // Use the loading spinner from the Deephaven components package
import type { dh } from '@deephaven/jsapi-types';
import { fetchVariableDefinition } from '@deephaven/jsapi-utils';
Expand Down Expand Up @@ -241,6 +242,7 @@ function App(): JSX.Element {
/>
)}
<ContextMenuRoot />
<ToastContainer />
</div>
);
}
Expand Down
1 change: 1 addition & 0 deletions tests/styleguide.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const sampleSectionIds: string[] = [
'sample-section-navigations',
'sample-section-list-views',
'sample-section-pickers',
'sample-section-toast',
'sample-section-tooltips',
'sample-section-icons',
'sample-section-editors',
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading