Skip to content

Commit

Permalink
feat: new Tooltip component
Browse files Browse the repository at this point in the history
  • Loading branch information
hperrin committed Apr 16, 2021
1 parent 27f5a16 commit 6293aef
Show file tree
Hide file tree
Showing 28 changed files with 1,642 additions and 229 deletions.
3 changes: 2 additions & 1 deletion README.md
Expand Up @@ -265,6 +265,7 @@ Click a component below to go to its documentation. (Note that this documentatio
- [Tab](packages/tab/README.md)
- [Tab Bar](packages/tab-bar/README.md)
- [Theme](https://sveltematerialui.com/demo/theme/)
- [Tooltip](packages/tooltip/README.md)
- [Top App Bar](packages/top-app-bar/README.md)
- [Touch Target](packages/touch-target/README.md)
- [Typography](https://sveltematerialui.com/demo/typography/)
Expand All @@ -275,7 +276,7 @@ New components from the upstream library to build for SMUI v3:
- [x] Circular Progress
- [x] Layout Grids (Not new to MDC, but I haven't made a component for it.)
- [ ] Segmented Buttons (This is different than SMUI's button groups.)
- [ ] Tooltips
- [x] Tooltips
- [x] Touch Target Wrappers
- [ ] Data Table Pagination
- [ ] Data Table Progress Indicator
Expand Down
1 change: 1 addition & 0 deletions packages/button/Button.svelte
Expand Up @@ -33,6 +33,7 @@
'mdc-snackbar__action': context === 'snackbar:actions',
'mdc-banner__secondary-action': context === 'banner' && secondary,
'mdc-banner__primary-action': context === 'banner' && !secondary,
'mdc-tooltip__action': context === 'tooltip:rich-actions',
...internalClasses,
})}
style={Object.entries(internalStyles)
Expand Down
1 change: 0 additions & 1 deletion packages/chips/Text.svelte
Expand Up @@ -83,7 +83,6 @@
}
export function focus() {
console.log('focus primary action');
// Let the tabindex change propagate.
waitForTabindex(() => {
primaryAction && primaryAction.focus();
Expand Down
1 change: 0 additions & 1 deletion packages/chips/TrailingAction.svelte
Expand Up @@ -74,7 +74,6 @@
onMount(() => {
instance = new MDCChipTrailingActionFoundation({
focus: () => {
console.log('focus trailing action');
const element = getElement();
// Let the tabindex change propagate.
waitForTabindex(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/data-table/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/tooltip/Content.js
@@ -0,0 +1,7 @@
import { classAdderBuilder } from '@smui/common/internal.js';
import Div from '@smui/common/Div.svelte';

export default classAdderBuilder({
class: 'mdc-tooltip__content',
component: Div,
});
7 changes: 7 additions & 0 deletions packages/tooltip/Link.js
@@ -0,0 +1,7 @@
import { classAdderBuilder } from '@smui/common/internal.js';
import A from '@smui/common/A.svelte';

export default classAdderBuilder({
class: 'mdc-tooltip__content-link',
component: A,
});
29 changes: 29 additions & 0 deletions packages/tooltip/README.md
@@ -0,0 +1,29 @@
# Svelte Material UI - Tooltip

Tooltips display informative content when a user hovers over or interacts with an element.

# Installation

```sh
npm install --save-dev @smui/tooltip
```

# Demo

[See it in action.](https://sveltematerialui.com/demo/tooltip)

[See the demo code.](/site/src/routes/demo/tooltip/)

# Basic Usage

todo...

# Exports

todo...

# More Information

See [Tooltips](https://material.io/components/tooltips) in the Material design spec.

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.
10 changes: 10 additions & 0 deletions packages/tooltip/RichActions.js
@@ -0,0 +1,10 @@
import { classAdderBuilder } from '@smui/common/internal.js';
import Div from '@smui/common/Div.svelte';

export default classAdderBuilder({
class: 'mdc-tooltip--rich-actions',
component: Div,
contexts: {
'SMUI:button:context': 'tooltip:rich-actions',
},
});
7 changes: 7 additions & 0 deletions packages/tooltip/Title.js
@@ -0,0 +1,7 @@
import { classAdderBuilder } from '@smui/common/internal.js';
import H2 from '@smui/common/H2.svelte';

export default classAdderBuilder({
class: 'mdc-tooltip__title',
component: H2,
});

0 comments on commit 6293aef

Please sign in to comment.