stacked_menu 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,88 @@
1
+ /* Behavior */
2
+ .#{$stacked-menu-class-prefix}-has-collapsible {
3
+ /** caret angle, Only show on collapsible mode */
4
+ .has-child {
5
+ > .menu-link::after {
6
+ display: inline-block;
7
+ content: '+';
8
+ position: absolute;
9
+ right: ($stacked-menu-padder*1.5);
10
+ top: 50%;
11
+ transform: translateY(-.5em);
12
+ height: 1em;
13
+ width: 1em;
14
+ line-height: 1em;
15
+ text-align: center;
16
+ }
17
+
18
+ &.has-active > .menu-link::after,
19
+ &.has-open > .menu-link::after {
20
+ content: '-'
21
+ }
22
+ }
23
+
24
+ .has-child > .menu {
25
+ visibility: visible;
26
+ opacity: 1;
27
+ overflow: hidden;
28
+ }
29
+ .has-child.has-open:not(.has-active) {
30
+ > .menu {
31
+ height: auto;
32
+ }
33
+ }
34
+ }
35
+
36
+ /** collapsible on compact mode */
37
+ .#{$stacked-menu-class-prefix}-has-collapsible.#{$stacked-menu-class-prefix}-has-compact {
38
+ /** hide caret on level 1 */
39
+ > .menu > .has-child {
40
+ > .menu {
41
+ transform-origin: 0 0;
42
+ transform: scale(.6);
43
+ transition: opacity 150ms linear, transform 150ms linear;
44
+ }
45
+
46
+ &.has-open > .menu {
47
+ transform: scale(1);
48
+ }
49
+
50
+ > .menu-link:after {
51
+ display: none;
52
+ }
53
+ }
54
+ .has-child {
55
+ &.has-open > .menu {
56
+ position: absolute;
57
+ width: 200px;
58
+ top: 0;
59
+ left: 100%;
60
+ height: auto;
61
+ visibility: visible;
62
+ opacity: 1;
63
+ border-radius: 0 $stacked-menu-border-radius $stacked-menu-border-radius 0;
64
+ }
65
+ > .menu .menu-link {
66
+ padding-left: ($stacked-menu-padder * 2);
67
+ }
68
+ }
69
+ /** child level 2 up */
70
+ .menu .menu .has-child {
71
+ &.has-open > .menu {
72
+ position: static;
73
+ width: auto;
74
+ top: auto;
75
+ left: auto;
76
+ }
77
+ > .menu {
78
+ .menu-link {
79
+ padding-left: ($stacked-menu-padder * 4);
80
+ }
81
+ .menu {
82
+ .menu-link {
83
+ padding-left: ($stacked-menu-padder * 6);
84
+ }
85
+ }
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,292 @@
1
+ /** The root StackedMenu */
2
+ .#{$stacked-menu-class-prefix} {
3
+ position: relative;
4
+ padding: .25rem 0;
5
+ background-color: $stacked-menu-bg;
6
+
7
+ ul.menu {
8
+ display: block;
9
+ padding-left: 0;
10
+ margin-bottom: 0;
11
+ list-style: none;
12
+
13
+ + .menu {
14
+ margin-top: 1em;
15
+ }
16
+ }
17
+
18
+ .menu-header {
19
+ margin: .5em 0 0;
20
+ padding: $stacked-menu-padding;
21
+ color: $stacked-menu-color-disabled;
22
+ font-size: $stacked-menu-header-font-size;
23
+ font-weight: bold;
24
+ text-transform: uppercase;
25
+ letter-spacing: 1px;
26
+
27
+ > .badge,
28
+ > .label {
29
+ position: absolute;
30
+ right: $stacked-menu-padder + ($stacked-menu-padder/2);
31
+ z-index: 2;
32
+ }
33
+ }
34
+
35
+ .menu-subhead {
36
+ display: none;
37
+ padding: $stacked-menu-padding;
38
+ font-size: $stacked-menu-font-size;
39
+ color: $stacked-menu-child-active-color;
40
+ line-height: 1.75em;
41
+ overflow: hidden;
42
+ }
43
+
44
+ .menu-link {
45
+ position: relative;
46
+ display: block;
47
+ padding: $stacked-menu-padding;
48
+ font-size: $stacked-menu-font-size;
49
+ color: $stacked-menu-child-color;
50
+ text-decoration: none;
51
+ line-height: 1.75em;
52
+ overflow: hidden;
53
+ outline: 0;
54
+
55
+ > .menu-icon {
56
+ width: 1.25em;
57
+ margin-right: .5em;
58
+ text-align: center;
59
+ font-size: $stacked-menu-icon-size;
60
+ color: $stacked-menu-icon-color;
61
+ }
62
+
63
+ > .badge,
64
+ > .label {
65
+ position: absolute;
66
+ right: $stacked-menu-padder + ($stacked-menu-padder/2);
67
+ margin-top: .25em;
68
+ z-index: 2;
69
+ }
70
+
71
+ @include hover-focus {
72
+ color: $stacked-menu-child-hover-color;
73
+ background-color: $stacked-menu-child-hover-bg;
74
+ text-decoration: none;
75
+ overflow: visible;
76
+
77
+ .menu-icon {
78
+ color: $stacked-menu-icon-hover-color;
79
+ }
80
+ }
81
+ }
82
+
83
+ /* global state */
84
+ .menu-item {
85
+
86
+ + .menu-item {
87
+ margin-top: 0;
88
+ }
89
+
90
+ &.has-open:not(.has-active) {
91
+ > .menu-link {
92
+ background-color: $stacked-menu-child-hover-bg;
93
+ color: $stacked-menu-child-hover-color;
94
+ .menu-icon {
95
+ color: $stacked-menu-icon-hover-color;
96
+ }
97
+ }
98
+ }
99
+
100
+ &.has-active {
101
+ > .menu-link {
102
+ background-color: $stacked-menu-child-active-bg;
103
+ color: $stacked-menu-child-active-color;
104
+ .menu-icon {
105
+ color: $stacked-menu-icon-active-color;
106
+ }
107
+ }
108
+ }
109
+ }
110
+
111
+ /* nav child */
112
+ .has-child {
113
+ position: relative;
114
+ > .menu {
115
+ height: 0;
116
+ visibility: hidden;
117
+ opacity: 0;
118
+ background-color: $stacked-menu-child-bg;
119
+ }
120
+ &.has-active:hover > .menu,
121
+ &.has-open > .menu {
122
+ overflow: visible;
123
+ }
124
+ &.has-active > .menu {
125
+ height: auto;
126
+ visibility: visible;
127
+ opacity: 1;
128
+ }
129
+ }
130
+
131
+ /* nav level 1 */
132
+ > .menu > .menu-item {
133
+ > .menu-link {
134
+ color: $stacked-menu-color;
135
+ @include hover-focus {
136
+ color: $stacked-menu-hover-color;
137
+ background-color: $stacked-menu-hover-bg;
138
+ }
139
+ }
140
+ &.has-open > .menu-link {
141
+ color: $stacked-menu-hover-color;
142
+ background-color: $stacked-menu-hover-bg;
143
+ }
144
+
145
+ &.has-active > .menu-link {
146
+ background-color: $stacked-menu-active-bg;
147
+ color: $stacked-menu-active-color;
148
+ @include box-shadow(inset 3px 0 0 $stacked-menu-accent-color);
149
+ }
150
+
151
+ /* level 1 */
152
+ > .menu {
153
+ .menu-link {
154
+ padding-left: ($stacked-menu-padder * 6);
155
+ }
156
+
157
+ /* level 2 */
158
+ .menu {
159
+ .menu-link {
160
+ padding-left: ($stacked-menu-padder * 8);
161
+ }
162
+
163
+ /* level 3 */
164
+ .menu {
165
+ .menu-link {
166
+ padding-left: ($stacked-menu-padder * 10);
167
+ }
168
+ }
169
+ }
170
+ }
171
+ }
172
+
173
+ /* disabled state */
174
+ .menu-item.disabled > .menu-link,
175
+ .menu-item > .menu-link.disabled {
176
+ color: $stacked-menu-color-disabled;
177
+
178
+ .menu-icon {
179
+ color: $stacked-menu-color-disabled;
180
+ }
181
+
182
+ @include hover-focus {
183
+ &,
184
+ .menu-icon {
185
+ background-color: transparent;
186
+ color: $stacked-menu-color-disabled;
187
+ }
188
+ }
189
+ }
190
+ }
191
+
192
+
193
+ /* Compact */
194
+ .#{$stacked-menu-class-prefix}-has-compact {
195
+ .has-child.has-active > .menu {
196
+ visibility: hidden;
197
+ height: 0;
198
+ opacity: 0;
199
+ }
200
+
201
+ .has-child {
202
+ &.has-active {
203
+ .menu-subhead {
204
+ background-color: $stacked-menu-active-bg;
205
+ }
206
+ }
207
+ .menu-subhead {
208
+ display: block;
209
+ }
210
+ }
211
+
212
+ > .menu {
213
+ > .menu-item > .menu-link {
214
+ text-align: center;
215
+ padding-right: 0;
216
+ padding-left: 0;
217
+ max-height: 40px;
218
+
219
+ > .badge,
220
+ > .label {
221
+ top: 0;
222
+ right: ($stacked-menu-padder/2);
223
+ }
224
+
225
+ .menu-icon {
226
+ margin: 0;
227
+ font-size: 1.25em;
228
+ line-height: 1.5em;
229
+ }
230
+ }
231
+ > .menu-item.has-child > .menu-link .menu-text {
232
+ display: none;
233
+ }
234
+ > .menu-header {
235
+ // transform to empty space
236
+ margin: 0;
237
+ height: 0;
238
+ overflow: hidden;
239
+ visibility: hidden;
240
+ opacity: 0;
241
+ user-select: none;
242
+ }
243
+ > .menu-item:not(.has-child) > .menu-link {
244
+ .menu-text {
245
+ position: absolute;
246
+ display: block;
247
+ top: 0;
248
+ left: 100%;
249
+ padding: $stacked-menu-padder ($stacked-menu-padder*1.5) $stacked-menu-padder 0;
250
+ border-radius: 0 $stacked-menu-border-radius $stacked-menu-border-radius 0;
251
+ width: 0;
252
+ height: 0;
253
+ visibility: hidden;
254
+ opacity: 0;
255
+ background-color: $stacked-menu-hover-bg;
256
+ line-height: 1.75em;
257
+ white-space: nowrap;
258
+ @include transition(opacity 150ms linear);
259
+ }
260
+
261
+ @include hover {
262
+ .menu-text {
263
+ width: auto;
264
+ height: auto;
265
+ visibility: visible;
266
+ opacity: 1;
267
+ }
268
+ }
269
+ }
270
+ > .menu-item.has-active > .menu-link .menu-text {
271
+ background-color: $stacked-menu-active-bg;
272
+ }
273
+ > .menu-item.disabled > .menu-link,
274
+ > .menu-item > .menu-link.disabled {
275
+ .menu-text {
276
+ background-color: $stacked-menu-bg;
277
+ }
278
+ }
279
+ > .menu-item.has-child {
280
+ > .menu-link {
281
+ &:before {
282
+ content: none;
283
+ }
284
+ .menu-text {
285
+ padding: $stacked-menu-padding;
286
+ text-align: left;
287
+ width: 200px;
288
+ }
289
+ }
290
+ }
291
+ }
292
+ }
@@ -0,0 +1,70 @@
1
+ /** open menu to left direction */
2
+ /** Core */
3
+ .#{$stacked-menu-class-prefix}-has-left {
4
+ > .menu > .menu-item {
5
+ &.has-active > .menu-link {
6
+ @include box-shadow(inset -3px 0 0 $stacked-menu-accent-color);
7
+ }
8
+ }
9
+ /** compact */
10
+ &.#{$stacked-menu-class-prefix}-has-compact {
11
+ > .menu {
12
+ > .menu-item > .menu-link > .badge {
13
+ right: auto;
14
+ left: ($stacked-menu-padder/2);
15
+ }
16
+ > .menu-item:not(.has-child) > .menu-link {
17
+ .menu-text {
18
+ right: 100%;
19
+ left: auto;
20
+ padding: $stacked-menu-padder 0 $stacked-menu-padder ($stacked-menu-padder*1.5);
21
+ border-radius: $stacked-menu-border-radius 0 0 $stacked-menu-border-radius;
22
+ }
23
+ }
24
+ }
25
+ }
26
+ }
27
+
28
+ /** Behavior */
29
+ .#{$stacked-menu-class-prefix}-has-left {
30
+ &.#{$stacked-menu-class-prefix}-has-hoverable {
31
+ .has-child > .menu {
32
+ transform-origin: 100% 0;
33
+ }
34
+ }
35
+ &.#{$stacked-menu-class-prefix}-has-collapsible.#{$stacked-menu-class-prefix}-has-compact {
36
+ > .menu > .has-child > .menu {
37
+ transform-origin: 100% 0;
38
+ }
39
+ }
40
+
41
+ &.#{$stacked-menu-class-prefix}-has-hoverable,
42
+ &.#{$stacked-menu-class-prefix}-has-compact {
43
+ .has-child.has-open:not(.has-active) {
44
+ > .menu {
45
+ left: auto;
46
+ right: 100%;
47
+ }
48
+ // caret
49
+ > .menu-link {
50
+ &:before {
51
+ right: auto;
52
+ left: 0;
53
+ // the caret
54
+ border-right: 0 solid transparent;
55
+ border-left: 8px solid $stacked-menu-child-bg;
56
+ }
57
+ }
58
+ }
59
+ }
60
+ /** both hoverable & collapsible on compact mode */
61
+ &.#{$stacked-menu-class-prefix}-has-hoverable.#{$stacked-menu-class-prefix}-has-compact,
62
+ &.#{$stacked-menu-class-prefix}-has-collapsible.#{$stacked-menu-class-prefix}-has-compact {
63
+ .has-child.has-open {
64
+ > .menu {
65
+ left: auto;
66
+ right: 100%;
67
+ }
68
+ }
69
+ }
70
+ }
@@ -0,0 +1,83 @@
1
+ /* Give a transition */
2
+ .#{$stacked-menu-class-prefix}-has-hoverable {
3
+ .has-child > .menu {
4
+ transform-origin: 0 0;
5
+ @include transition(opacity 150ms linear, transform 150ms linear);
6
+ }
7
+ /** except level 1 .has-active */
8
+ .has-child:not(.has-active) > .menu {
9
+ transform: scale(.6);
10
+ }
11
+ }
12
+ .#{$stacked-menu-class-prefix}-has-hoverable.#{$stacked-menu-class-prefix}-has-compact {
13
+ /** level 1 */
14
+ > .menu > .has-child > .menu {
15
+ @include transition(opacity 150ms linear, transform 150ms linear);
16
+ }
17
+ /** overwrite for all */
18
+ .has-child > .menu {
19
+ transform: scale(.6);
20
+ }
21
+ }
22
+
23
+ /* Behavior */
24
+ .#{$stacked-menu-class-prefix}-has-hoverable,
25
+ .#{$stacked-menu-class-prefix}-has-compact {
26
+ /** except level 1 .has-active */
27
+ .has-child {
28
+ &.has-open:not(.has-active) > .menu {
29
+ position: absolute;
30
+ width: 200px;
31
+ top: 0;
32
+ left: 100%;
33
+ height: auto;
34
+ visibility: visible;
35
+ opacity: 1;
36
+ transform: scale(1);
37
+ }
38
+ > .menu {
39
+ .menu-item > .menu .menu-link,
40
+ .menu-item > .menu .menu .menu-link {
41
+ padding-left: ($stacked-menu-padder * 2);
42
+ }
43
+ }
44
+ /** caret */
45
+ > .menu-link {
46
+ &:before {
47
+ content: '';
48
+ position: absolute;
49
+ right: 0;
50
+ top: 50%;
51
+ width: 0;
52
+ height: 0;
53
+ border-top: 8px solid transparent;
54
+ border-bottom: 8px solid transparent;
55
+ /** the caret */
56
+ border-right:8px solid $stacked-menu-child-bg;
57
+ transform: translateY(-8px);
58
+ }
59
+ }
60
+ }
61
+ }
62
+
63
+ /** hoverable on compact mode */
64
+ .#{$stacked-menu-class-prefix}-has-hoverable.#{$stacked-menu-class-prefix}-has-compact {
65
+ /** overwrite for all */
66
+ .has-child.has-open {
67
+ > .menu {
68
+ position: absolute;
69
+ width: 200px;
70
+ top: 0;
71
+ left: 100%;
72
+ height: auto;
73
+ visibility: visible;
74
+ opacity: 1;
75
+ border-radius: 0 $stacked-menu-border-radius $stacked-menu-border-radius 0;
76
+ transform: scale(1);
77
+
78
+ .menu-item > .menu-link {
79
+ padding-left: ($stacked-menu-padder * 2);
80
+ }
81
+ }
82
+ }
83
+ }
@@ -0,0 +1,50 @@
1
+ @mixin breakpoint-up($breakpoint) {
2
+ @media (min-width: ($breakpoint + 1px)) {
3
+ @content;
4
+ }
5
+ }
6
+
7
+ @mixin breakpoint-down($breakpoint) {
8
+ @media (max-width: ($breakpoint - 1px)) {
9
+ @content;
10
+ }
11
+ }
12
+
13
+ @mixin box-shadow($shadow...) {
14
+ @if $enable-shadows {
15
+ box-shadow: $shadow;
16
+ }
17
+ }
18
+
19
+ @mixin transition($transition...) {
20
+ @if $enable-transitions {
21
+ @if length($transition) == 0 {
22
+ transition: $transition-base;
23
+ } @else {
24
+ transition: $transition;
25
+ }
26
+ }
27
+ }
28
+
29
+ @mixin hover {
30
+ &:hover { @content }
31
+ }
32
+
33
+ @mixin hover-focus {
34
+ &:focus { @content }
35
+ @include hover { @content }
36
+ }
37
+
38
+ @mixin active {
39
+ &:active,
40
+ &.active { @content }
41
+ }
42
+
43
+ @mixin hover-focus-active {
44
+ &:focus,
45
+ &:active,
46
+ &.active {
47
+ @content
48
+ }
49
+ @include hover { @content }
50
+ }
@@ -0,0 +1,35 @@
1
+ $enable-shadows: true !default;
2
+ $enable-transitions: true !default;
3
+ $transition-base: all 150ms linear !default;
4
+
5
+ $stacked-menu-class-prefix: 'stacked-menu' !default;
6
+ $stacked-menu-breakpoint: 992px !default;
7
+ $stacked-menu-padder: .5rem !default;
8
+ $stacked-menu-border-radius: 0 !default;
9
+ $stacked-menu-bg: #15191d !default;
10
+ $stacked-menu-child-bg: lighten($stacked-menu-bg, 3) !default;
11
+ $stacked-menu-accent-color: #5d67ad !default;
12
+ // nav menu
13
+ $stacked-menu-font-size: .875rem !default;
14
+ $stacked-menu-header-font-size: .8125rem !default;
15
+ $stacked-menu-padding: $stacked-menu-padder ($stacked-menu-padder * 2) !default;
16
+
17
+ $stacked-menu-icon-size: 1rem !default;
18
+
19
+ // theme
20
+ $stacked-menu-hover-bg: darken($stacked-menu-bg, 3) !default;
21
+ $stacked-menu-active-bg: lighten($stacked-menu-bg, 5) !default;
22
+ $stacked-menu-color: #ccc !default;
23
+ $stacked-menu-hover-color: #eee !default;
24
+ $stacked-menu-active-color: #eee !default;
25
+ $stacked-menu-color-disabled: #555 !default;
26
+ // icon
27
+ $stacked-menu-icon-color: #999 !default;
28
+ $stacked-menu-icon-hover-color: $stacked-menu-hover-color !default;
29
+ $stacked-menu-icon-active-color: $stacked-menu-active-color !default;
30
+ // child
31
+ $stacked-menu-child-hover-bg: transparent !default;
32
+ $stacked-menu-child-active-bg: transparent !default;
33
+ $stacked-menu-child-color: #999 !default;
34
+ $stacked-menu-child-hover-color: $stacked-menu-accent-color !default;
35
+ $stacked-menu-child-active-color: #fff !default;
@@ -0,0 +1,6 @@
1
+ @import 'variables';
2
+ @import 'mixins';
3
+ @import 'core';
4
+ @import 'collapsible';
5
+ @import 'hoverable';
6
+ @import 'direction';
metadata ADDED
@@ -0,0 +1,93 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: stacked_menu
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Sikandar Tariq
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-02-17 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.17'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.17'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Easiest way to use stacked-menu JavaScript library in your rails application.
42
+ email:
43
+ - sikandar.tariq@thedevden.co
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - Gemfile
50
+ - LICENSE.txt
51
+ - README.md
52
+ - Rakefile
53
+ - bin/console
54
+ - bin/setup
55
+ - lib/stacked_menu.rb
56
+ - lib/stacked_menu/version.rb
57
+ - stacked_menu.gemspec
58
+ - vendor/assets/javascripts/stacked-menu.jquery.js
59
+ - vendor/assets/javascripts/stacked-menu.js
60
+ - vendor/assets/stylesheets/scss/_collapsible.scss
61
+ - vendor/assets/stylesheets/scss/_core.scss
62
+ - vendor/assets/stylesheets/scss/_direction.scss
63
+ - vendor/assets/stylesheets/scss/_hoverable.scss
64
+ - vendor/assets/stylesheets/scss/_mixins.scss
65
+ - vendor/assets/stylesheets/scss/_variables.scss
66
+ - vendor/assets/stylesheets/scss/stacked-menu.scss
67
+ homepage: http://docs.stilearning.com/drawerjs/latest/StackedMenu.html
68
+ licenses:
69
+ - MIT
70
+ metadata:
71
+ allowed_push_host: https://rubygems.org
72
+ homepage_uri: http://docs.stilearning.com/drawerjs/latest/StackedMenu.html
73
+ source_code_uri: https://github.com/sikandartariq1/stacked-menu
74
+ post_install_message:
75
+ rdoc_options: []
76
+ require_paths:
77
+ - lib
78
+ required_ruby_version: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubygems_version: 3.0.1
90
+ signing_key:
91
+ specification_version: 4
92
+ summary: A flexible stacked navigation menu writing on JavaScript vanilla and modules.
93
+ test_files: []