Skip to content

Commit a0961ad

Browse files
authored
feat: Export Spectrum Toast from Components Package (#2294)
Closes #2293 This is needed to implement the deephaven.ui toast component.
1 parent cb1f11f commit a0961ad

11 files changed

Lines changed: 3156 additions & 1488 deletions

File tree

package-lock.json

Lines changed: 3092 additions & 1487 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/code-studio/src/main/App.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import React, { type ReactElement } from 'react';
2-
import { ContextMenuRoot } from '@deephaven/components';
2+
import { ContextMenuRoot, ToastContainer } from '@deephaven/components';
33
import AppMainContainer from './AppMainContainer';
44

55
function App(): ReactElement {
66
return (
77
<div className="app">
88
<AppMainContainer />
99
<ContextMenuRoot />
10+
<ToastContainer />
1011
</div>
1112
);
1213
}

packages/code-studio/src/styleguide/StyleGuide.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
ThemePicker,
88
useTheme,
99
Flex,
10+
ToastContainer,
1011
} from '@deephaven/components';
1112

1213
import Buttons from './Buttons';
@@ -24,6 +25,7 @@ import Modals from './Modals';
2425
import Progress from './Progress';
2526
import TimeSliderInputs from './TimeSliderInputs';
2627
import Tooltips from './Tooltips';
28+
import Toast from './Toast';
2729
import Typograpy from './Typography';
2830
import './StyleGuide.scss';
2931
import DraggableLists from './DraggableLists';
@@ -125,6 +127,7 @@ function StyleGuide(): React.ReactElement {
125127
<ContextMenus />
126128
<DropdownMenus />
127129
<Navigations />
130+
<Toast />
128131
<Tooltips />
129132
<Icons />
130133
<Editors />
@@ -140,6 +143,7 @@ function StyleGuide(): React.ReactElement {
140143

141144
<SampleMenuCategory data-menu-category="Spectrum Comparison" />
142145
<SpectrumComparison />
146+
<ToastContainer />
143147
</div>
144148
</div>
145149
);
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React from 'react';
2+
import { Button, ButtonGroup, ToastQueue } from '@deephaven/components';
3+
import SampleSection from './SampleSection';
4+
5+
function Toast(): React.ReactElement {
6+
return (
7+
<SampleSection name="toast">
8+
<h2 className="ui-title">Toast</h2>
9+
<div>
10+
<ButtonGroup>
11+
<Button
12+
kind="tertiary"
13+
onClick={() =>
14+
ToastQueue.neutral('Neutral toast', { timeout: 5000 })
15+
}
16+
>
17+
Show neutral toast
18+
</Button>
19+
<Button
20+
kind="success"
21+
onClick={() =>
22+
ToastQueue.positive('Positive toast', { timeout: 5000 })
23+
}
24+
>
25+
Show positive toast
26+
</Button>
27+
<Button
28+
kind="danger"
29+
onClick={() =>
30+
ToastQueue.negative('Negative toast', { timeout: 5000 })
31+
}
32+
>
33+
Show negative toast
34+
</Button>
35+
<Button
36+
kind="primary"
37+
onClick={() => ToastQueue.info('Info toast', { timeout: 5000 })}
38+
>
39+
Show info toast
40+
</Button>
41+
</ButtonGroup>
42+
</div>
43+
</SampleSection>
44+
);
45+
}
46+
47+
export default Toast;

packages/components/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@fortawesome/react-fontawesome": "^0.2.0",
3434
"@internationalized/date": "^3.5.5",
3535
"@react-spectrum/theme-default": "^3.5.1",
36+
"@react-spectrum/toast": "^3.0.0-beta.16",
3637
"@react-spectrum/utils": "^3.11.5",
3738
"@react-types/radio": "^3.8.1",
3839
"@react-types/shared": "^3.22.1",

packages/components/src/spectrum/status.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,10 @@ export {
1414
StatusLight,
1515
type SpectrumStatusLightProps as StatusLightProps,
1616
} from '@adobe/react-spectrum';
17+
18+
export {
19+
ToastContainer,
20+
type SpectrumToastContainerProps as ToastContainerProps,
21+
ToastQueue,
22+
type SpectrumToastOptions as ToastOptions,
23+
} from '@react-spectrum/toast';

packages/embed-widget/src/App.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
LoadingOverlay,
1818
Shortcut,
1919
ShortcutRegistry,
20+
ToastContainer,
2021
} from '@deephaven/components'; // Use the loading spinner from the Deephaven components package
2122
import type { dh } from '@deephaven/jsapi-types';
2223
import { fetchVariableDefinition } from '@deephaven/jsapi-utils';
@@ -241,6 +242,7 @@ function App(): JSX.Element {
241242
/>
242243
)}
243244
<ContextMenuRoot />
245+
<ToastContainer />
244246
</div>
245247
);
246248
}

tests/styleguide.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const sampleSectionIds: string[] = [
2727
'sample-section-navigations',
2828
'sample-section-list-views',
2929
'sample-section-pickers',
30+
'sample-section-toast',
3031
'sample-section-tooltips',
3132
'sample-section-icons',
3233
'sample-section-editors',
12.6 KB
Loading
17.3 KB
Loading

0 commit comments

Comments
 (0)