scrollbar-hide-plugin 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 reslear
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,114 @@
1
+ # scrollbar-hide-plugin
2
+
3
+ [![npm](https://img.shields.io/npm/v/tailwind-scrollbar-hide)](https://www.npmjs.com/package/tailwind-scrollbar-hide)
4
+ ![npm](https://img.shields.io/npm/dt/tailwind-scrollbar-hide)
5
+ ![npm](https://img.shields.io/npm/dw/tailwind-scrollbar-hide)
6
+ [![install size](https://packagephobia.com/badge?p=tailwind-scrollbar-hide)](https://packagephobia.com/result?p=tailwind-scrollbar-hide)
7
+
8
+ Tailwind plugin for hide scrollbars, although the element can still be scrolled if the element's content overflows.
9
+
10
+ <img src="https://user-images.githubusercontent.com/12596485/142972957-272010d3-29f6-4be7-99e1-dd03e7a8b92b.gif" alt="tailwind-scrollbar-hide animation demo" width="400" />
11
+
12
+ [🕹 Live Playground](https://reslear.github.io/tailwind-scrollbar-hide/)
13
+
14
+ ## Features
15
+
16
+ 🎨 Tailwind v4.x, v3.x, v2.x.
17
+
18
+ 📦 Zero dependencies
19
+
20
+ 🛠️ Port for [unocss-preset-scrollbar-hide](https://github.com/reslear/unocss-preset-scrollbar-hide)
21
+
22
+ 🎯 Pure CSS implementation for v4.x
23
+
24
+ ## Installation
25
+
26
+ Install the plugin from npm:
27
+
28
+ ```sh
29
+ # Using npm
30
+ npm install scrollbar-hide-plugin
31
+
32
+ # Using pnpm
33
+ pnpm add scrollbar-hide-plugin
34
+
35
+ # Using Yarn
36
+ yarn add scrollbar-hide-plugin
37
+ ```
38
+
39
+ ### Tailwind v4 support
40
+
41
+ ![Firefox >=64 Chrome >= 2 Safari >= 4](https://badges.herokuapp.com/browsers?googlechrome=2&firefox=64&safari=4)
42
+
43
+
44
+ For Tailwind v4, you can use the following approach in your CSS configuration file:
45
+
46
+ ```css
47
+ /* index.css */
48
+ @import 'tailwindcss';
49
+ @import 'scrollbar-hide-plugin/v4';
50
+ ```
51
+
52
+ This will automatically import and configure the plugin for Tailwind v4.
53
+
54
+ > Note: Internet Explorer functionality has been dropped in Tailwind v4
55
+
56
+ ### Tailwind v2.x, v3.x support
57
+
58
+ ![Firefox >=64 Chrome >= 2 Safari >= 4 Internet Explorer >= 10](https://badges.herokuapp.com/browsers?googlechrome=2&firefox=64&safari=4&iexplore=10)
59
+
60
+
61
+ For Tailwind v2.x and v3.x, add the plugin to your config file:
62
+
63
+ ```js
64
+ // tailwind.config.js
65
+ module.exports = {
66
+ theme: {
67
+ // ...
68
+ },
69
+ plugins: [
70
+ require('scrollbar-hide-plugin')
71
+ // ...
72
+ ]
73
+ }
74
+ ```
75
+
76
+ or [using TypeScript](https://tailwindcss.com/docs/configuration#using-esm-or-type-script):
77
+
78
+ ```ts
79
+ // tailwind.config.ts
80
+ import type { Config } from 'tailwindcss'
81
+ import scrollbarHide from 'scrollbar-hide-plugin'
82
+
83
+ export default {
84
+ theme: {
85
+ // ...
86
+ },
87
+ plugins: [scrollbarHide]
88
+ } satisfies Config
89
+ ```
90
+
91
+ ## Usage
92
+
93
+ Use in you template `scrollbar-hide` for visual hiding scrollbar
94
+
95
+ ```html
96
+ <div class="w-4 scrollbar-hide">...</div>
97
+ ```
98
+
99
+ or restore default value use `scrollbar-default`
100
+
101
+ > ⚠️ webkit overriding not working https://github.com/reslear/tailwind-scrollbar-hide/issues/19#issuecomment-1086949110 need switch breakpoint system
102
+
103
+ ```html
104
+ <div class="w-4 scrollbar-hide md:scrollbar-default">...</div>
105
+ ```
106
+
107
+ ## Plugin Inspiration
108
+
109
+ - https://github.com/tailwindlabs/tailwindcss-forms/tree/main
110
+ - https://github.com/tailwindlabs/tailwindcss/discussions/2310#discussioncomment-8592440
111
+
112
+ ## License
113
+
114
+ [MIT](./LICENSE)
@@ -0,0 +1,2 @@
1
+ declare const _default: () => void;
2
+ export default _default;
package/dist/index.js ADDED
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Tailwind plugin for hide scrollbars, although the element can still be scrolled if the element's content overflows.
3
+ */
4
+ const scrollbarHide = ({ addUtilities }) => addUtilities({
5
+ '.scrollbar-hide': {
6
+ // TODO: remove IE and Edge support
7
+ /* IE and Edge */
8
+ '-ms-overflow-style': 'none',
9
+ /* Firefox */
10
+ 'scrollbar-width': 'none',
11
+ /* Safari and Chrome */
12
+ '&::-webkit-scrollbar': {
13
+ display: 'none'
14
+ }
15
+ },
16
+ '.scrollbar-default': {
17
+ // TODO: remove IE and Edge support
18
+ /* IE and Edge */
19
+ '-ms-overflow-style': 'auto',
20
+ /* Firefox */
21
+ 'scrollbar-width': 'auto',
22
+ /* Safari and Chrome */
23
+ '&::-webkit-scrollbar': {
24
+ display: 'block'
25
+ }
26
+ }
27
+ });
28
+ // override type for v3/4 compatibility
29
+ export default scrollbarHide;
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "scrollbar-hide-plugin",
3
+ "version": "1.0.0",
4
+ "description": "tailwindcss plugin for hide scrollbar",
5
+ "keywords": [
6
+ "tailwindcss",
7
+ "scrollbar",
8
+ "scrollbar-hide"
9
+ ],
10
+ "homepage": "https://github.com/reslear/tailwind-scrollbar-hide#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/reslear/tailwind-scrollbar-hide/issues"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/reslear/tailwind-scrollbar-hide.git"
17
+ },
18
+ "license": "MIT",
19
+ "author": "reslear",
20
+ "sideEffects": false,
21
+ "type": "module",
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "default": "./dist/index.js"
26
+ },
27
+ "./v4": "./src/styles.css"
28
+ },
29
+ "main": "dist/index.js",
30
+ "types": "dist/index.d.ts",
31
+ "files": [
32
+ "dist",
33
+ "src/styles.css"
34
+ ],
35
+ "scripts": {
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^22.15.28",
39
+ "tailwindcss": "4.1.8",
40
+ "typescript": "5.8.3"
41
+ },
42
+ "peerDependencies": {
43
+ "tailwindcss": ">=3.0.0 || >= 4.0.0 || >= 4.0.0-beta.8 || >= 4.0.0-alpha.20"
44
+ },
45
+ "publishConfig": {
46
+ "access": "public"
47
+ }
48
+ }
package/src/styles.css ADDED
@@ -0,0 +1,19 @@
1
+ @utility scrollbar-hide {
2
+ /* Firefox */
3
+ scrollbar-width: none;
4
+
5
+ /* Safari and Chrome */
6
+ &::-webkit-scrollbar {
7
+ display: none;
8
+ }
9
+ }
10
+
11
+ @utility scrollbar-default {
12
+ /* Firefox */
13
+ scrollbar-width: auto;
14
+
15
+ /* Safari and Chrome */
16
+ &::-webkit-scrollbar {
17
+ display: block;
18
+ }
19
+ }