Skip to content

Commit 6293aef

Browse files
committed
feat: new Tooltip component
1 parent 27f5a16 commit 6293aef

28 files changed

+1642
-229
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ Click a component below to go to its documentation. (Note that this documentatio
265265
- [Tab](packages/tab/README.md)
266266
- [Tab Bar](packages/tab-bar/README.md)
267267
- [Theme](https://sveltematerialui.com/demo/theme/)
268+
- [Tooltip](packages/tooltip/README.md)
268269
- [Top App Bar](packages/top-app-bar/README.md)
269270
- [Touch Target](packages/touch-target/README.md)
270271
- [Typography](https://sveltematerialui.com/demo/typography/)
@@ -275,7 +276,7 @@ New components from the upstream library to build for SMUI v3:
275276
- [x] Circular Progress
276277
- [x] Layout Grids (Not new to MDC, but I haven't made a component for it.)
277278
- [ ] Segmented Buttons (This is different than SMUI's button groups.)
278-
- [ ] Tooltips
279+
- [x] Tooltips
279280
- [x] Touch Target Wrappers
280281
- [ ] Data Table Pagination
281282
- [ ] Data Table Progress Indicator

packages/button/Button.svelte

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
'mdc-snackbar__action': context === 'snackbar:actions',
3434
'mdc-banner__secondary-action': context === 'banner' && secondary,
3535
'mdc-banner__primary-action': context === 'banner' && !secondary,
36+
'mdc-tooltip__action': context === 'tooltip:rich-actions',
3637
...internalClasses,
3738
})}
3839
style={Object.entries(internalStyles)

packages/chips/Text.svelte

-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@
8383
}
8484
8585
export function focus() {
86-
console.log('focus primary action');
8786
// Let the tabindex change propagate.
8887
waitForTabindex(() => {
8988
primaryAction && primaryAction.focus();

packages/chips/TrailingAction.svelte

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@
7474
onMount(() => {
7575
instance = new MDCChipTrailingActionFoundation({
7676
focus: () => {
77-
console.log('focus trailing action');
7877
const element = getElement();
7978
// Let the tabindex change propagate.
8079
waitForTabindex(() => {

packages/data-table/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/tooltip/Content.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { classAdderBuilder } from '@smui/common/internal.js';
2+
import Div from '@smui/common/Div.svelte';
3+
4+
export default classAdderBuilder({
5+
class: 'mdc-tooltip__content',
6+
component: Div,
7+
});

packages/tooltip/Link.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { classAdderBuilder } from '@smui/common/internal.js';
2+
import A from '@smui/common/A.svelte';
3+
4+
export default classAdderBuilder({
5+
class: 'mdc-tooltip__content-link',
6+
component: A,
7+
});

packages/tooltip/README.md

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Svelte Material UI - Tooltip
2+
3+
Tooltips display informative content when a user hovers over or interacts with an element.
4+
5+
# Installation
6+
7+
```sh
8+
npm install --save-dev @smui/tooltip
9+
```
10+
11+
# Demo
12+
13+
[See it in action.](https://sveltematerialui.com/demo/tooltip)
14+
15+
[See the demo code.](/site/src/routes/demo/tooltip/)
16+
17+
# Basic Usage
18+
19+
todo...
20+
21+
# Exports
22+
23+
todo...
24+
25+
# More Information
26+
27+
See [Tooltips](https://material.io/components/tooltips) in the Material design spec.
28+
29+
See [Tooltip](https://github.com/material-components/material-components-web/tree/v10.0.0/packages/mdc-tooltip) in MDC-Web for information about the upstream library's architecture.

packages/tooltip/RichActions.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { classAdderBuilder } from '@smui/common/internal.js';
2+
import Div from '@smui/common/Div.svelte';
3+
4+
export default classAdderBuilder({
5+
class: 'mdc-tooltip--rich-actions',
6+
component: Div,
7+
contexts: {
8+
'SMUI:button:context': 'tooltip:rich-actions',
9+
},
10+
});

packages/tooltip/Title.js

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { classAdderBuilder } from '@smui/common/internal.js';
2+
import H2 from '@smui/common/H2.svelte';
3+
4+
export default classAdderBuilder({
5+
class: 'mdc-tooltip__title',
6+
component: H2,
7+
});

0 commit comments

Comments
 (0)