semantic-ui-sass 2.3.1.2 → 2.4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.travis.yml +4 -2
- data/CHANGELOG.md +124 -100
- data/README.md +87 -16
- data/app/assets/javascripts/semantic-ui/dimmer.js +27 -4
- data/app/assets/javascripts/semantic-ui/dropdown.js +41 -9
- data/app/assets/javascripts/semantic-ui/embed.js +11 -1
- data/app/assets/javascripts/semantic-ui/modal.js +85 -10
- data/app/assets/javascripts/semantic-ui/popup.js +14 -5
- data/app/assets/javascripts/semantic-ui/search.js +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +5 -5
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +28 -28
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +11 -11
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +5 -5
- data/app/assets/stylesheets/semantic-ui/elements/_all.scss +2 -0
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +153 -3
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +30 -31
- data/app/assets/stylesheets/semantic-ui/elements/_container_variables.scss +48 -0
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +3 -3
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +2 -1
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +36 -17
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +22 -22
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +3 -1
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +239 -0
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +65 -3
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +6 -6
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +39 -37
- data/app/assets/stylesheets/semantic-ui/globals/_variables.scss +46 -2
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +27 -13
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +38 -29
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +60 -35
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +2 -2
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +4 -2
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +2 -2
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +4 -4
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +4 -4
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +23 -26
- data/lib/semantic-ui-sass.rb +2 -2
- data/lib/semantic/ui/sass/version.rb +2 -2
- data/package.json +29 -0
- data/script.js +56 -0
- data/semantic-ui-sass.gemspec +2 -2
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- data/tasks/converter.rb +29 -2
- data/yarn.lock +4 -0
- metadata +19 -13
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Semantic UI for Sass
|
2
2
|
|
3
|
-
`semantic-ui-sass` is an Sass-powered version of
|
3
|
+
`semantic-ui-sass` is an Sass-powered version of
|
4
|
+
[Semantic UI](https://github.com/Semantic-Org/Semantic-UI) and ready to drop
|
5
|
+
into Rails, Compass, or Sprockets.
|
4
6
|
|
5
7
|
[![Build Status](https://travis-ci.org/doabit/semantic-ui-sass.svg?branch=master)](https://travis-ci.org/doabit/semantic-ui-sass)
|
6
8
|
|
@@ -14,22 +16,24 @@ The gem only has default theme.
|
|
14
16
|
gem 'semantic-ui-sass'
|
15
17
|
```
|
16
18
|
|
17
|
-
`bundle install` and restart your server to make the files available through the
|
19
|
+
`bundle install` and restart your server to make the files available through the
|
20
|
+
pipeline.
|
18
21
|
|
19
22
|
# semantic-ui-sass with Rails or Sprockets
|
20
23
|
|
21
24
|
## CSS
|
22
25
|
|
23
|
-
Import Semantic in an SCSS file (for example, `application.css.scss`) to get all
|
26
|
+
Import Semantic in an SCSS file (for example, `application.css.scss`) to get all
|
27
|
+
of Semantic's styles
|
24
28
|
|
25
29
|
```css
|
26
|
-
@import
|
30
|
+
@import 'semantic-ui';
|
27
31
|
```
|
28
32
|
|
29
33
|
You can also include modules
|
30
34
|
|
31
35
|
```css
|
32
|
-
@import
|
36
|
+
@import 'semantic-ui/collections/menu';
|
33
37
|
```
|
34
38
|
|
35
39
|
## Custom font
|
@@ -40,41 +44,103 @@ $font-url: 'http://fonts.useso.com/css?family=Lato:400,700,400italic,700italic&s
|
|
40
44
|
```
|
41
45
|
|
42
46
|
## Skip font loading
|
47
|
+
|
43
48
|
```css
|
44
49
|
$import-google-fonts: false;
|
45
50
|
@import 'semantic-ui';
|
46
51
|
```
|
47
52
|
|
48
53
|
## Custom font family
|
54
|
+
|
49
55
|
```css
|
50
56
|
$font-family: 'custom-font-family';
|
51
57
|
@import 'semantic-ui';
|
52
58
|
```
|
53
59
|
|
60
|
+
### Skip use of custom scrollbars
|
61
|
+
|
62
|
+
```css
|
63
|
+
$use-custom-scrollbars: false;
|
64
|
+
@import 'semantic-ui';
|
65
|
+
```
|
66
|
+
|
54
67
|
## All variables, you can custom any of that
|
68
|
+
|
69
|
+
Fonts:
|
70
|
+
|
55
71
|
```css
|
56
|
-
$import-google-fonts: true !default;
|
57
|
-
$font-url: 'https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin,latin-ext' !default;
|
58
72
|
$font-name: 'Lato' !default;
|
59
73
|
$font-family: $font-name, 'Helvetica Neue', Arial, Helvetica, sans-serif !default;
|
74
|
+
$font-url: 'https://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic&subset=latin,latin-ext' !default;
|
75
|
+
$import-google-fonts: true !default;
|
76
|
+
```
|
77
|
+
|
78
|
+
Scrollbars:
|
79
|
+
|
80
|
+
```css
|
81
|
+
$use-custom-scrollbars: true !default;
|
82
|
+
```
|
83
|
+
|
84
|
+
Breakpoints:
|
85
|
+
|
86
|
+
```css
|
87
|
+
$mobile-breakpoint: 320px !default;
|
88
|
+
$tablet-breakpoint: 768px !default;
|
89
|
+
$computer-breakpoint: 992px !default;
|
90
|
+
$large-monitor-breakpoint: 1200px !default;
|
91
|
+
$widescreen-monitor-breakpoint: 1920px !default;
|
60
92
|
```
|
61
93
|
|
62
94
|
## Javascripts
|
63
95
|
|
64
|
-
|
96
|
+
### Ruby on Rails Version 5
|
97
|
+
|
98
|
+
We have a helper that includes all Semantic javascripts. Put this in your
|
99
|
+
Javascript manifest (usually in `application.js`) to
|
65
100
|
|
66
101
|
```js
|
67
102
|
// Loads all Semantic javascripts
|
68
103
|
//= require semantic-ui
|
69
104
|
```
|
70
105
|
|
71
|
-
You can also load individual modules, provided you also require any
|
106
|
+
You can also load individual modules, provided you also require any
|
107
|
+
dependencies.
|
72
108
|
|
73
109
|
```js
|
74
110
|
//= require semantic-ui/modal
|
75
111
|
//= require semantic-ui/dropdown
|
76
112
|
```
|
77
113
|
|
114
|
+
### Ruby on Rails Version 6+
|
115
|
+
|
116
|
+
Add packages with yarn:
|
117
|
+
|
118
|
+
```console
|
119
|
+
yarn add jquery popper.js @doabit/semantic-ui-sass
|
120
|
+
```
|
121
|
+
|
122
|
+
In config/webpack/environment.js add the following:
|
123
|
+
|
124
|
+
```js
|
125
|
+
const webpack = require('webpack')
|
126
|
+
|
127
|
+
environment.plugins.append(
|
128
|
+
'Provide',
|
129
|
+
new webpack.ProvidePlugin({
|
130
|
+
$: 'jquery',
|
131
|
+
jQuery: 'jquery',
|
132
|
+
Popper: ['popper.js', 'default']
|
133
|
+
})
|
134
|
+
)
|
135
|
+
```
|
136
|
+
|
137
|
+
In app/javascript/packs/application.js add the following:
|
138
|
+
|
139
|
+
```js
|
140
|
+
import '@doabit/semantic-ui-sass'
|
141
|
+
import '@doabit/semantic-ui-sass/src/scss/semantic-ui.scss'
|
142
|
+
```
|
143
|
+
|
78
144
|
# semantic-ui-sass with Compass
|
79
145
|
|
80
146
|
## New project
|
@@ -88,13 +154,16 @@ compass create compass-project -r semantic-ui-sass --using semantic-ui
|
|
88
154
|
|
89
155
|
This will sort a few things out:
|
90
156
|
|
91
|
-
|
92
|
-
|
93
|
-
|
157
|
+
- You'll get a starting `styles.scss`
|
158
|
+
- You'll get a compiled stylesheet compiled & ready to drop into your
|
159
|
+
application
|
160
|
+
- We'll also copy the Semantic javascripts & images & fonts into their
|
161
|
+
respective folders for you
|
94
162
|
|
95
163
|
## Existing project
|
96
164
|
|
97
|
-
Install the gem, add the require statement to the top of your configuration
|
165
|
+
Install the gem, add the require statement to the top of your configuration
|
166
|
+
file, and install the extension.
|
98
167
|
|
99
168
|
```console
|
100
169
|
gem install semantic-ui-sass
|
@@ -111,7 +180,9 @@ compass install semantic-ui
|
|
111
180
|
|
112
181
|
### NOTE
|
113
182
|
|
114
|
-
When using compass, you should visit file in local server, eg
|
183
|
+
When using compass, you should visit file in local server, eg
|
184
|
+
`http://localhost:3000/index.html`, rather than
|
185
|
+
`file:///Users/doabit/demo/index.html`
|
115
186
|
|
116
187
|
# Rails Helpers
|
117
188
|
|
@@ -163,8 +234,8 @@ semantic_icon('add', id: 'id')
|
|
163
234
|
|
164
235
|
## TODO
|
165
236
|
|
166
|
-
|
167
|
-
|
237
|
+
- Add global variables
|
238
|
+
- Add rails helpers like `render_flash`?
|
168
239
|
|
169
240
|
## Contributing
|
170
241
|
|
@@ -83,7 +83,6 @@ $.fn.dimmer = function(parameters) {
|
|
83
83
|
else {
|
84
84
|
$dimmer = module.create();
|
85
85
|
}
|
86
|
-
module.set.variation();
|
87
86
|
}
|
88
87
|
},
|
89
88
|
|
@@ -157,7 +156,7 @@ $.fn.dimmer = function(parameters) {
|
|
157
156
|
module.hide();
|
158
157
|
event.stopImmediatePropagation();
|
159
158
|
}
|
160
|
-
}
|
159
|
+
},
|
161
160
|
},
|
162
161
|
|
163
162
|
addContent: function(element) {
|
@@ -190,6 +189,7 @@ $.fn.dimmer = function(parameters) {
|
|
190
189
|
: function(){}
|
191
190
|
;
|
192
191
|
module.debug('Showing dimmer', $dimmer, settings);
|
192
|
+
module.set.variation();
|
193
193
|
if( (!module.is.dimmed() || module.is.animating()) && module.is.enabled() ) {
|
194
194
|
module.animate.show(callback);
|
195
195
|
settings.onShow.call(element);
|
@@ -233,12 +233,22 @@ $.fn.dimmer = function(parameters) {
|
|
233
233
|
: function(){}
|
234
234
|
;
|
235
235
|
if(settings.useCSS && $.fn.transition !== undefined && $dimmer.transition('is supported')) {
|
236
|
+
if(settings.useFlex) {
|
237
|
+
module.debug('Using flex dimmer');
|
238
|
+
module.remove.legacy();
|
239
|
+
}
|
240
|
+
else {
|
241
|
+
module.debug('Using legacy non-flex dimmer');
|
242
|
+
module.set.legacy();
|
243
|
+
}
|
236
244
|
if(settings.opacity !== 'auto') {
|
237
245
|
module.set.opacity();
|
238
246
|
}
|
239
247
|
$dimmer
|
240
248
|
.transition({
|
241
|
-
displayType :
|
249
|
+
displayType : settings.useFlex
|
250
|
+
? 'flex'
|
251
|
+
: 'block',
|
242
252
|
animation : settings.transition + ' in',
|
243
253
|
queue : false,
|
244
254
|
duration : module.get.duration(),
|
@@ -283,7 +293,9 @@ $.fn.dimmer = function(parameters) {
|
|
283
293
|
module.verbose('Hiding dimmer with css');
|
284
294
|
$dimmer
|
285
295
|
.transition({
|
286
|
-
displayType :
|
296
|
+
displayType : settings.useFlex
|
297
|
+
? 'flex'
|
298
|
+
: 'block',
|
287
299
|
animation : settings.transition + ' out',
|
288
300
|
queue : false,
|
289
301
|
duration : module.get.duration(),
|
@@ -292,6 +304,7 @@ $.fn.dimmer = function(parameters) {
|
|
292
304
|
module.remove.dimmed();
|
293
305
|
},
|
294
306
|
onComplete : function() {
|
307
|
+
module.remove.variation();
|
295
308
|
module.remove.active();
|
296
309
|
callback();
|
297
310
|
}
|
@@ -405,6 +418,9 @@ $.fn.dimmer = function(parameters) {
|
|
405
418
|
module.debug('Setting opacity to', opacity);
|
406
419
|
$dimmer.css('background-color', color);
|
407
420
|
},
|
421
|
+
legacy: function() {
|
422
|
+
$dimmer.addClass(className.legacy);
|
423
|
+
},
|
408
424
|
active: function() {
|
409
425
|
$dimmer.addClass(className.active);
|
410
426
|
},
|
@@ -434,6 +450,9 @@ $.fn.dimmer = function(parameters) {
|
|
434
450
|
.removeClass(className.active)
|
435
451
|
;
|
436
452
|
},
|
453
|
+
legacy: function() {
|
454
|
+
$dimmer.removeClass(className.legacy);
|
455
|
+
},
|
437
456
|
dimmed: function() {
|
438
457
|
$dimmable.removeClass(className.dimmed);
|
439
458
|
},
|
@@ -647,6 +666,9 @@ $.fn.dimmer.settings = {
|
|
647
666
|
verbose : false,
|
648
667
|
performance : true,
|
649
668
|
|
669
|
+
// whether should use flex layout
|
670
|
+
useFlex : true,
|
671
|
+
|
650
672
|
// name to distinguish between multiple dimmers in context
|
651
673
|
dimmerName : false,
|
652
674
|
|
@@ -690,6 +712,7 @@ $.fn.dimmer.settings = {
|
|
690
712
|
dimmer : 'dimmer',
|
691
713
|
disabled : 'disabled',
|
692
714
|
hide : 'hide',
|
715
|
+
legacy : 'legacy',
|
693
716
|
pageDimmer : 'page',
|
694
717
|
show : 'show'
|
695
718
|
},
|
@@ -605,7 +605,6 @@ $.fn.dropdown = function(parameters) {
|
|
605
605
|
else {
|
606
606
|
if(settings.on == 'click') {
|
607
607
|
$module
|
608
|
-
.on('click' + eventNamespace, selector.icon, module.event.icon.click)
|
609
608
|
.on('click' + eventNamespace, module.event.test.toggle)
|
610
609
|
;
|
611
610
|
}
|
@@ -621,6 +620,7 @@ $.fn.dropdown = function(parameters) {
|
|
621
620
|
;
|
622
621
|
}
|
623
622
|
$module
|
623
|
+
.on('click' + eventNamespace, selector.icon, module.event.icon.click)
|
624
624
|
.on('mousedown' + eventNamespace, module.event.mousedown)
|
625
625
|
.on('mouseup' + eventNamespace, module.event.mouseup)
|
626
626
|
.on('focus' + eventNamespace, module.event.focus)
|
@@ -754,10 +754,19 @@ $.fn.dropdown = function(parameters) {
|
|
754
754
|
callback();
|
755
755
|
},
|
756
756
|
onSuccess : function(response) {
|
757
|
-
|
758
|
-
|
759
|
-
values
|
760
|
-
|
757
|
+
var
|
758
|
+
values = response[fields.remoteValues],
|
759
|
+
hasRemoteValues = ($.isArray(values) && values.length > 0)
|
760
|
+
;
|
761
|
+
if(hasRemoteValues) {
|
762
|
+
module.remove.message();
|
763
|
+
module.setup.menu({
|
764
|
+
values: response[fields.remoteValues]
|
765
|
+
});
|
766
|
+
}
|
767
|
+
else {
|
768
|
+
module.add.message(message.noResults);
|
769
|
+
}
|
761
770
|
callback();
|
762
771
|
}
|
763
772
|
}
|
@@ -1010,7 +1019,12 @@ $.fn.dropdown = function(parameters) {
|
|
1010
1019
|
},
|
1011
1020
|
icon: {
|
1012
1021
|
click: function(event) {
|
1013
|
-
|
1022
|
+
if($icon.hasClass(className.clear)) {
|
1023
|
+
module.clear();
|
1024
|
+
}
|
1025
|
+
else if (module.can.click()) {
|
1026
|
+
module.toggle();
|
1027
|
+
}
|
1014
1028
|
}
|
1015
1029
|
},
|
1016
1030
|
text: {
|
@@ -1637,7 +1651,7 @@ $.fn.dropdown = function(parameters) {
|
|
1637
1651
|
},
|
1638
1652
|
|
1639
1653
|
hide: function(text, value, element) {
|
1640
|
-
module.set.value(value, text);
|
1654
|
+
module.set.value(value, text, $(element));
|
1641
1655
|
module.hideAndClear();
|
1642
1656
|
}
|
1643
1657
|
|
@@ -2472,6 +2486,15 @@ $.fn.dropdown = function(parameters) {
|
|
2472
2486
|
$module.data(metadata.value, stringValue);
|
2473
2487
|
}
|
2474
2488
|
}
|
2489
|
+
if(module.is.single() && settings.clearable) {
|
2490
|
+
// treat undefined or '' as empty
|
2491
|
+
if(!escapedValue) {
|
2492
|
+
module.remove.clearable();
|
2493
|
+
}
|
2494
|
+
else {
|
2495
|
+
module.set.clearable();
|
2496
|
+
}
|
2497
|
+
}
|
2475
2498
|
if(settings.fireOnInit === false && module.is.initialLoad()) {
|
2476
2499
|
module.verbose('No callback on initial load', settings.onChange);
|
2477
2500
|
}
|
@@ -2567,7 +2590,10 @@ $.fn.dropdown = function(parameters) {
|
|
2567
2590
|
}
|
2568
2591
|
})
|
2569
2592
|
;
|
2570
|
-
}
|
2593
|
+
},
|
2594
|
+
clearable: function() {
|
2595
|
+
$icon.addClass(className.clear);
|
2596
|
+
},
|
2571
2597
|
},
|
2572
2598
|
|
2573
2599
|
add: {
|
@@ -2765,7 +2791,7 @@ $.fn.dropdown = function(parameters) {
|
|
2765
2791
|
}
|
2766
2792
|
module.set.value(newValue, addedValue, addedText, $selectedItem);
|
2767
2793
|
module.check.maxSelections();
|
2768
|
-
}
|
2794
|
+
},
|
2769
2795
|
},
|
2770
2796
|
|
2771
2797
|
remove: {
|
@@ -2990,6 +3016,9 @@ $.fn.dropdown = function(parameters) {
|
|
2990
3016
|
.removeAttr('tabindex')
|
2991
3017
|
;
|
2992
3018
|
}
|
3019
|
+
},
|
3020
|
+
clearable: function() {
|
3021
|
+
$icon.removeClass(className.clear);
|
2993
3022
|
}
|
2994
3023
|
},
|
2995
3024
|
|
@@ -3677,6 +3706,8 @@ $.fn.dropdown.settings = {
|
|
3677
3706
|
|
3678
3707
|
values : false, // specify values to use for dropdown
|
3679
3708
|
|
3709
|
+
clearable : false, // whether the value of the dropdown can be cleared
|
3710
|
+
|
3680
3711
|
apiSettings : false,
|
3681
3712
|
selectOnKeydown : true, // Whether selection should occur automatically when keyboard shortcuts used
|
3682
3713
|
minCharacters : 0, // Minimum characters required to trigger API call
|
@@ -3829,6 +3860,7 @@ $.fn.dropdown.settings = {
|
|
3829
3860
|
active : 'active',
|
3830
3861
|
addition : 'addition',
|
3831
3862
|
animating : 'animating',
|
3863
|
+
clear : 'clear',
|
3832
3864
|
disabled : 'disabled',
|
3833
3865
|
empty : 'empty',
|
3834
3866
|
dropdown : 'ui dropdown',
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
;(function ($, window, document, undefined) {
|
12
12
|
|
13
|
-
|
13
|
+
"use strict";
|
14
14
|
|
15
15
|
window = (typeof window != 'undefined' && window.Math == Math)
|
16
16
|
? window
|
@@ -181,6 +181,7 @@ $.fn.embed = function(parameters) {
|
|
181
181
|
// clears embed
|
182
182
|
reset: function() {
|
183
183
|
module.debug('Clearing embed and showing placeholder');
|
184
|
+
module.remove.data();
|
184
185
|
module.remove.active();
|
185
186
|
module.remove.embed();
|
186
187
|
module.showPlaceholder();
|
@@ -300,6 +301,15 @@ $.fn.embed = function(parameters) {
|
|
300
301
|
},
|
301
302
|
|
302
303
|
remove: {
|
304
|
+
data: function() {
|
305
|
+
$module
|
306
|
+
.removeData(metadata.id)
|
307
|
+
.removeData(metadata.icon)
|
308
|
+
.removeData(metadata.placeholder)
|
309
|
+
.removeData(metadata.source)
|
310
|
+
.removeData(metadata.url)
|
311
|
+
;
|
312
|
+
},
|
303
313
|
active: function() {
|
304
314
|
$module.removeClass(className.active);
|
305
315
|
},
|
@@ -110,8 +110,7 @@ $.fn.modal = function(parameters) {
|
|
110
110
|
debug : settings.debug,
|
111
111
|
variation : settings.centered
|
112
112
|
? false
|
113
|
-
: 'top aligned'
|
114
|
-
,
|
113
|
+
: 'top aligned',
|
115
114
|
dimmerName : 'modals'
|
116
115
|
},
|
117
116
|
dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
|
@@ -132,7 +131,7 @@ $.fn.modal = function(parameters) {
|
|
132
131
|
$dimmer = $dimmable.dimmer('get dimmer');
|
133
132
|
},
|
134
133
|
id: function() {
|
135
|
-
id = (Math.random().toString(16) + '000000000').substr(2,8);
|
134
|
+
id = (Math.random().toString(16) + '000000000').substr(2, 8);
|
136
135
|
elementEventNamespace = '.' + id;
|
137
136
|
module.verbose('Creating unique id for element', id);
|
138
137
|
}
|
@@ -167,6 +166,9 @@ $.fn.modal = function(parameters) {
|
|
167
166
|
refresh: function() {
|
168
167
|
module.remove.scrolling();
|
169
168
|
module.cacheSizes();
|
169
|
+
if(!module.can.useFlex()) {
|
170
|
+
module.set.modalOffset();
|
171
|
+
}
|
170
172
|
module.set.screenHeight();
|
171
173
|
module.set.type();
|
172
174
|
},
|
@@ -207,12 +209,22 @@ $.fn.modal = function(parameters) {
|
|
207
209
|
$window
|
208
210
|
.on('resize' + elementEventNamespace, module.event.resize)
|
209
211
|
;
|
212
|
+
},
|
213
|
+
scrollLock: function() {
|
214
|
+
// touch events default to passive, due to changes in chrome to optimize mobile perf
|
215
|
+
$dimmable.get(0).addEventListener('touchmove', module.event.preventScroll, { passive: false });
|
216
|
+
}
|
217
|
+
},
|
218
|
+
|
219
|
+
unbind: {
|
220
|
+
scrollLock: function() {
|
221
|
+
$dimmable.get(0).removeEventListener('touchmove', module.event.preventScroll, { passive: false });
|
210
222
|
}
|
211
223
|
},
|
212
224
|
|
213
225
|
get: {
|
214
226
|
id: function() {
|
215
|
-
return (Math.random().toString(16) + '000000000').substr(2,8);
|
227
|
+
return (Math.random().toString(16) + '000000000').substr(2, 8);
|
216
228
|
}
|
217
229
|
},
|
218
230
|
|
@@ -227,6 +239,9 @@ $.fn.modal = function(parameters) {
|
|
227
239
|
ignoreRepeatedEvents = false;
|
228
240
|
});
|
229
241
|
},
|
242
|
+
preventScroll: function(event) {
|
243
|
+
event.preventDefault();
|
244
|
+
},
|
230
245
|
deny: function() {
|
231
246
|
if(ignoreRepeatedEvents || settings.onDeny.call(element, $(this)) === false) {
|
232
247
|
module.verbose('Deny callback returned false cancelling hide');
|
@@ -304,6 +319,8 @@ $.fn.modal = function(parameters) {
|
|
304
319
|
;
|
305
320
|
module.refreshModals();
|
306
321
|
module.set.dimmerSettings();
|
322
|
+
module.set.dimmerStyles();
|
323
|
+
|
307
324
|
module.showModal(callback);
|
308
325
|
},
|
309
326
|
|
@@ -322,9 +339,16 @@ $.fn.modal = function(parameters) {
|
|
322
339
|
: function(){}
|
323
340
|
;
|
324
341
|
if( module.is.animating() || !module.is.active() ) {
|
325
|
-
|
326
342
|
module.showDimmer();
|
327
343
|
module.cacheSizes();
|
344
|
+
if(module.can.useFlex()) {
|
345
|
+
module.remove.legacy();
|
346
|
+
}
|
347
|
+
else {
|
348
|
+
module.set.legacy();
|
349
|
+
module.set.modalOffset();
|
350
|
+
module.debug('Using non-flex legacy modal positioning.');
|
351
|
+
}
|
328
352
|
module.set.screenHeight();
|
329
353
|
module.set.type();
|
330
354
|
module.set.clickaway();
|
@@ -402,6 +426,7 @@ $.fn.modal = function(parameters) {
|
|
402
426
|
},
|
403
427
|
onComplete : function() {
|
404
428
|
settings.onHidden.call(element);
|
429
|
+
module.remove.dimmerStyles();
|
405
430
|
module.restore.focus();
|
406
431
|
callback();
|
407
432
|
}
|
@@ -426,6 +451,7 @@ $.fn.modal = function(parameters) {
|
|
426
451
|
|
427
452
|
hideDimmer: function() {
|
428
453
|
if( $dimmable.dimmer('is animating') || ($dimmable.dimmer('is active')) ) {
|
454
|
+
module.unbind.scrollLock();
|
429
455
|
$dimmable.dimmer('hide', function() {
|
430
456
|
module.remove.clickaway();
|
431
457
|
module.remove.screenHeight();
|
@@ -513,11 +539,18 @@ $.fn.modal = function(parameters) {
|
|
513
539
|
active: function() {
|
514
540
|
$module.removeClass(className.active);
|
515
541
|
},
|
542
|
+
legacy: function() {
|
543
|
+
$module.removeClass(className.legacy);
|
544
|
+
},
|
516
545
|
clickaway: function() {
|
517
546
|
$dimmer
|
518
547
|
.off('click' + elementEventNamespace)
|
519
548
|
;
|
520
549
|
},
|
550
|
+
dimmerStyles: function() {
|
551
|
+
$dimmer.removeClass(className.inverted);
|
552
|
+
$dimmable.removeClass(className.blurring);
|
553
|
+
},
|
521
554
|
bodyStyle: function() {
|
522
555
|
if($body.attr('style') === '') {
|
523
556
|
module.verbose('Removing style attribute');
|
@@ -546,11 +579,13 @@ $.fn.modal = function(parameters) {
|
|
546
579
|
$module.addClass(className.loading);
|
547
580
|
var
|
548
581
|
scrollHeight = $module.prop('scrollHeight'),
|
582
|
+
modalWidth = $module.outerWidth(),
|
549
583
|
modalHeight = $module.outerHeight()
|
550
584
|
;
|
551
585
|
if(module.cache === undefined || modalHeight !== 0) {
|
552
586
|
module.cache = {
|
553
587
|
pageHeight : $(document).outerHeight(),
|
588
|
+
width : modalWidth,
|
554
589
|
height : modalHeight + settings.offset,
|
555
590
|
scrollHeight : scrollHeight + settings.offset,
|
556
591
|
contextHeight : (settings.context == 'body')
|
@@ -564,6 +599,12 @@ $.fn.modal = function(parameters) {
|
|
564
599
|
},
|
565
600
|
|
566
601
|
can: {
|
602
|
+
useFlex: function() {
|
603
|
+
return (settings.useFlex == 'auto')
|
604
|
+
? settings.detachable && !module.is.ie()
|
605
|
+
: settings.useFlex
|
606
|
+
;
|
607
|
+
},
|
567
608
|
fit: function() {
|
568
609
|
var
|
569
610
|
contextHeight = module.cache.contextHeight,
|
@@ -585,6 +626,13 @@ $.fn.modal = function(parameters) {
|
|
585
626
|
active: function() {
|
586
627
|
return $module.hasClass(className.active);
|
587
628
|
},
|
629
|
+
ie: function() {
|
630
|
+
var
|
631
|
+
isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
|
632
|
+
isIE = ('ActiveXObject' in window)
|
633
|
+
;
|
634
|
+
return (isIE11 || isIE);
|
635
|
+
},
|
588
636
|
animating: function() {
|
589
637
|
return $module.transition('is supported')
|
590
638
|
? $module.transition('is animating')
|
@@ -596,7 +644,7 @@ $.fn.modal = function(parameters) {
|
|
596
644
|
},
|
597
645
|
modernBrowser: function() {
|
598
646
|
// appName for IE11 reports 'Netscape' can no longer use
|
599
|
-
return !(window.ActiveXObject ||
|
647
|
+
return !(window.ActiveXObject || 'ActiveXObject' in window);
|
600
648
|
}
|
601
649
|
},
|
602
650
|
|
@@ -628,10 +676,10 @@ $.fn.modal = function(parameters) {
|
|
628
676
|
debug : settings.debug,
|
629
677
|
dimmerName : 'modals',
|
630
678
|
closable : 'auto',
|
679
|
+
useFlex : module.can.useFlex(),
|
631
680
|
variation : settings.centered
|
632
681
|
? false
|
633
|
-
: 'top aligned'
|
634
|
-
,
|
682
|
+
: 'top aligned',
|
635
683
|
duration : {
|
636
684
|
show : settings.duration,
|
637
685
|
hide : settings.duration
|
@@ -644,6 +692,11 @@ $.fn.modal = function(parameters) {
|
|
644
692
|
? dimmerSettings.variation + ' inverted'
|
645
693
|
: 'inverted'
|
646
694
|
;
|
695
|
+
}
|
696
|
+
$context.dimmer('setting', dimmerSettings);
|
697
|
+
},
|
698
|
+
dimmerStyles: function() {
|
699
|
+
if(settings.inverted) {
|
647
700
|
$dimmer.addClass(className.inverted);
|
648
701
|
}
|
649
702
|
else {
|
@@ -655,7 +708,21 @@ $.fn.modal = function(parameters) {
|
|
655
708
|
else {
|
656
709
|
$dimmable.removeClass(className.blurring);
|
657
710
|
}
|
658
|
-
|
711
|
+
},
|
712
|
+
modalOffset: function() {
|
713
|
+
var
|
714
|
+
width = module.cache.width,
|
715
|
+
height = module.cache.height
|
716
|
+
;
|
717
|
+
$module
|
718
|
+
.css({
|
719
|
+
marginTop: (settings.centered && module.can.fit())
|
720
|
+
? -(height / 2)
|
721
|
+
: 0,
|
722
|
+
marginLeft: -(width / 2)
|
723
|
+
})
|
724
|
+
;
|
725
|
+
module.verbose('Setting modal offset for legacy mode');
|
659
726
|
},
|
660
727
|
screenHeight: function() {
|
661
728
|
if( module.can.fit() ) {
|
@@ -674,12 +741,17 @@ $.fn.modal = function(parameters) {
|
|
674
741
|
scrolling: function() {
|
675
742
|
$dimmable.addClass(className.scrolling);
|
676
743
|
$module.addClass(className.scrolling);
|
744
|
+
module.unbind.scrollLock();
|
745
|
+
},
|
746
|
+
legacy: function() {
|
747
|
+
$module.addClass(className.legacy);
|
677
748
|
},
|
678
749
|
type: function() {
|
679
750
|
if(module.can.fit()) {
|
680
751
|
module.verbose('Modal fits on screen');
|
681
752
|
if(!module.others.active() && !module.others.animating()) {
|
682
753
|
module.remove.scrolling();
|
754
|
+
module.bind.scrollLock();
|
683
755
|
}
|
684
756
|
}
|
685
757
|
else {
|
@@ -880,6 +952,9 @@ $.fn.modal.settings = {
|
|
880
952
|
name : 'Modal',
|
881
953
|
namespace : 'modal',
|
882
954
|
|
955
|
+
useFlex : 'auto',
|
956
|
+
offset : 0,
|
957
|
+
|
883
958
|
silent : false,
|
884
959
|
debug : false,
|
885
960
|
verbose : false,
|
@@ -909,7 +984,6 @@ $.fn.modal.settings = {
|
|
909
984
|
|
910
985
|
queue : false,
|
911
986
|
duration : 500,
|
912
|
-
offset : 0,
|
913
987
|
transition : 'scale',
|
914
988
|
|
915
989
|
// padding with edge of page
|
@@ -949,6 +1023,7 @@ $.fn.modal.settings = {
|
|
949
1023
|
animating : 'animating',
|
950
1024
|
blurring : 'blurring',
|
951
1025
|
inverted : 'inverted',
|
1026
|
+
legacy : 'legacy',
|
952
1027
|
loading : 'loading',
|
953
1028
|
scrolling : 'scrolling',
|
954
1029
|
undetached : 'undetached'
|