Skip to content

Commit c156545

Browse files
committed
Added stylelint
1 parent 20e226b commit c156545

File tree

5 files changed

+105
-14
lines changed

5 files changed

+105
-14
lines changed

.stylelintrc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"rules": {
3+
"color-hex-case": "lower",
4+
"color-hex-length": "long",
5+
"color-no-invalid-hex": true,
6+
"function-calc-no-unspaced-operator": true,
7+
"function-name-case": "lower",
8+
"function-parentheses-space-inside": "never",
9+
"function-url-quotes": "always",
10+
"number-leading-zero": "never",
11+
"number-no-trailing-zeros": true,
12+
"string-quotes": "double",
13+
"length-zero-no-unit": true,
14+
"unit-case": "lower",
15+
"unit-no-unknown": true,
16+
"value-keyword-case": "lower",
17+
"value-list-comma-space-after": "always",
18+
"shorthand-property-no-redundant-values": true,
19+
"property-case": "lower",
20+
"declaration-block-no-redundant-longhand-properties": true,
21+
"declaration-block-no-duplicate-properties": true,
22+
"block-closing-brace-empty-line-before": "never",
23+
"block-no-empty": true,
24+
"indentation": 2,
25+
"no-extra-semicolons": true
26+
}
27+
}

README.md

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,54 @@
22

33
A modern, ultra lightweight css tooptip library. Just `1kb` minified and gzipped.
44

5+
## Table of Contents
6+
- [Installation](#installation)
7+
- [Setup](#setup)
8+
- [Usage](#usage)
9+
- [Customization](#customization)
10+
511
## Installation
612

7-
- **via npm**
13+
**via npm**
814
Install the package using npm:-
915
```
1016
npm install microtip
1117
```
1218

13-
- **via yarn**
19+
**via yarn**
1420
Install the package via yarn:-
1521
```
1622
yarn add microtip
1723
```
1824

19-
- **via CDN**
25+
**via CDN**
2026
Directly include the link to the css into your project:-
2127
```
2228
https://unpkg.com/microtip/microtip.css
2329
```
2430

25-
- **direct download**
31+
**direct download**
2632
Download the file directly from github
2733

34+
## Setup
35+
36+
**in PostCSS**
37+
```scss
38+
@import 'microtip';
39+
```
40+
41+
**in Webpack**
42+
```javascript
43+
import microtip from 'microtip/microtip.min.css'
44+
```
45+
46+
**in SCSS**
47+
```scss
48+
@import 'microtip/microtip';
49+
```
50+
Make sure, `node_modules` is included in the `includePaths` setting. You can then directly import the library into your file.
51+
52+
2853
## Usage
2954

3055
Using the tooltip is incredibly simple. Simply add a custom `data-microtip` attribute to the element on which you want the tooltip to appear. The tooltip message is the attribute value. Example:-
@@ -49,6 +74,28 @@ By default, the tooltip will takeup only the size it requires to show the text.
4974
**Note** - `fit` sets the width of the tooltip to be the same as the width on the element. It only works along with the `top` and `bottom` position modifiers.
5075

5176

77+
## Customization
78+
79+
Microtip uses css variables, which allows you to customize the behavior of the tooltip as per your needs.
80+
81+
| Variable | Description | Default Value |
82+
|----------------------------------|----------------------------------------------------|---------------|
83+
| `--microtip-transition-duration` | Specifies the duration of the tootltip transition | `.18s` |
84+
| `--microtip-transition-delay` | The delay on hover before showing the tooltip | `0s` |
85+
| `--microtip-transition-easing` | The easing applied while transitioning the tooltip | `ease-in-out` |
86+
87+
Example:-
88+
```css
89+
:root {
90+
--microtip-transition-duration: 0.5s;
91+
--microtip-transition-delay: 1s;
92+
--microtip-transition-easing: ease-out;
93+
94+
}
95+
```
96+
97+
The above code will transition the tooltip over `0.5s` while applying an easing of type `ease-out` after a delay of `1s`
98+
5299
 
53100

54101
<p align="center">✌️</p>

microtip.css

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1-
/*******************************
2-
Default Tooltip styles
3-
*******************************/
1+
@charset "UTF-8";
2+
3+
/*
4+
* microtip.css
5+
* Licensed under the MIT license
6+
* Copyright (c) 2017 Indrashish Ghosh
7+
*/
8+
49
[data-microtip] {
510
position: relative;
611
}
@@ -13,7 +18,7 @@
1318
will-change: transform;
1419
opacity: 0;
1520
pointer-events: none;
16-
transition: all var(--microtip-transition-duration, 0.18s) var(--microtip-transition-easing, ease-in-out) var(--microtip-transition-delay, 0s);
21+
transition: all var(--microtip-transition-duration, .18s) var(--microtip-transition-easing, ease-in-out) var(--microtip-transition-delay, 0s);
1722
position: absolute;
1823
box-sizing: border-box;
1924
z-index: 10;
@@ -26,9 +31,9 @@
2631
}
2732

2833
[data-microtip]:after {
29-
background: rgba(17, 17, 17, 0.9);
34+
background: rgba(17, 17, 17, .9);
3035
border-radius: 4px;
31-
color: #fff;
36+
color: #ffffff;
3237
content: attr(data-microtip);
3338
font-size: 12px;
3439
padding: .5em 1em;

microtip.min.css

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
{
22
"name": "microtip",
3-
"version": "0.0.3",
4-
"description": "A modern, ultra light css tooltip library",
3+
"version": "0.0.4",
4+
"description": "A modern, ultra light css tooltip library. Just 1kb minified and gzipped",
55
"style": "microtip.css",
66
"keywords": [
77
"tooltip",
88
"css",
9-
"tooltip"
9+
"css variables",
10+
"1kb"
1011
],
12+
"scripts": {
13+
"minify": "minify microtip.css",
14+
"test": "stylelint microtip.css"
15+
},
1116
"author": "Indrashish Ghosh",
1217
"license": "MIT",
1318
"repository": {
@@ -16,5 +21,9 @@
1621
},
1722
"bugs": {
1823
"url": "https://github.com/ghosh/microtip/issues"
24+
},
25+
"devDependencies": {
26+
"minifier": "^0.8.1",
27+
"stylelint": "^7.10.1"
1928
}
2029
}

0 commit comments

Comments
 (0)