zurb-foundation-5 5.2.2

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.
Files changed (123) hide show
  1. checksums.yaml +7 -0
  2. data/.bowerrc +3 -0
  3. data/.editorconfig +9 -0
  4. data/.gitignore +46 -0
  5. data/.travis.yml +34 -0
  6. data/CONTRIBUTING.md +55 -0
  7. data/Gemfile +3 -0
  8. data/Gemfile.lock +16 -0
  9. data/Gruntfile.js +222 -0
  10. data/LICENSE +22 -0
  11. data/README.md +44 -0
  12. data/bower.json +20 -0
  13. data/composer.json +9 -0
  14. data/foundation.gemspec +21 -0
  15. data/humans.txt +8 -0
  16. data/js/foundation/foundation.abide.js +299 -0
  17. data/js/foundation/foundation.accordion.js +54 -0
  18. data/js/foundation/foundation.alert.js +43 -0
  19. data/js/foundation/foundation.clearing.js +531 -0
  20. data/js/foundation/foundation.dropdown.js +306 -0
  21. data/js/foundation/foundation.equalizer.js +68 -0
  22. data/js/foundation/foundation.interchange.js +331 -0
  23. data/js/foundation/foundation.joyride.js +849 -0
  24. data/js/foundation/foundation.js +609 -0
  25. data/js/foundation/foundation.magellan.js +173 -0
  26. data/js/foundation/foundation.offcanvas.js +50 -0
  27. data/js/foundation/foundation.orbit.js +606 -0
  28. data/js/foundation/foundation.reveal.js +427 -0
  29. data/js/foundation/foundation.slider.js +200 -0
  30. data/js/foundation/foundation.tab.js +168 -0
  31. data/js/foundation/foundation.tooltip.js +272 -0
  32. data/js/foundation/foundation.topbar.js +422 -0
  33. data/karma.conf.js +114 -0
  34. data/lib/foundation/engine.rb +20 -0
  35. data/lib/foundation/generators/USAGE +15 -0
  36. data/lib/foundation/generators/install_generator.rb +54 -0
  37. data/lib/foundation/generators/templates/application.html.erb +47 -0
  38. data/lib/foundation/generators/templates/application.html.haml +31 -0
  39. data/lib/foundation/generators/templates/application.html.slim +35 -0
  40. data/lib/foundation/sprockets.rb +4 -0
  41. data/lib/foundation/version.rb +3 -0
  42. data/lib/scss.js +114 -0
  43. data/lib/zurb-foundation.rb +33 -0
  44. data/package.json +48 -0
  45. data/robots.txt +4 -0
  46. data/run-tests.sh +83 -0
  47. data/sache.json +5 -0
  48. data/scss/foundation.scss +45 -0
  49. data/scss/foundation/_functions.scss +101 -0
  50. data/scss/foundation/_settings.scss +1279 -0
  51. data/scss/foundation/components/_accordion.scss +52 -0
  52. data/scss/foundation/components/_alert-boxes.scss +126 -0
  53. data/scss/foundation/components/_block-grid.scss +132 -0
  54. data/scss/foundation/components/_breadcrumbs.scss +127 -0
  55. data/scss/foundation/components/_button-groups.scss +108 -0
  56. data/scss/foundation/components/_buttons.scss +222 -0
  57. data/scss/foundation/components/_clearing.scss +247 -0
  58. data/scss/foundation/components/_dropdown-buttons.scss +129 -0
  59. data/scss/foundation/components/_dropdown.scss +248 -0
  60. data/scss/foundation/components/_flex-video.scss +51 -0
  61. data/scss/foundation/components/_forms.scss +496 -0
  62. data/scss/foundation/components/_global.scss +365 -0
  63. data/scss/foundation/components/_grid.scss +261 -0
  64. data/scss/foundation/components/_inline-lists.scss +56 -0
  65. data/scss/foundation/components/_joyride.scss +220 -0
  66. data/scss/foundation/components/_keystrokes.scss +61 -0
  67. data/scss/foundation/components/_labels.scss +104 -0
  68. data/scss/foundation/components/_magellan.scss +34 -0
  69. data/scss/foundation/components/_offcanvas.scss +381 -0
  70. data/scss/foundation/components/_orbit.scss +415 -0
  71. data/scss/foundation/components/_pagination.scss +150 -0
  72. data/scss/foundation/components/_panels.scss +91 -0
  73. data/scss/foundation/components/_pricing-tables.scss +150 -0
  74. data/scss/foundation/components/_progress-bars.scss +79 -0
  75. data/scss/foundation/components/_range-slider.scss +148 -0
  76. data/scss/foundation/components/_reveal-new.scss +0 -0
  77. data/scss/foundation/components/_reveal.scss +216 -0
  78. data/scss/foundation/components/_side-nav.scss +93 -0
  79. data/scss/foundation/components/_split-buttons.scss +191 -0
  80. data/scss/foundation/components/_sub-nav.scss +125 -0
  81. data/scss/foundation/components/_switch.scss +294 -0
  82. data/scss/foundation/components/_tables.scss +97 -0
  83. data/scss/foundation/components/_tabs.scss +105 -0
  84. data/scss/foundation/components/_thumbs.scss +68 -0
  85. data/scss/foundation/components/_tooltips.scss +140 -0
  86. data/scss/foundation/components/_top-bar.scss +640 -0
  87. data/scss/foundation/components/_type.scss +493 -0
  88. data/scss/foundation/components/_visibility.scss +345 -0
  89. data/scss/foundation/test.html +0 -0
  90. data/scss/normalize.scss +423 -0
  91. data/spec/abide/abide.js +173 -0
  92. data/spec/abide/advanced.html +22 -0
  93. data/spec/abide/basic.html +13 -0
  94. data/spec/accordion/accordion.js +94 -0
  95. data/spec/accordion/basic.html +39 -0
  96. data/spec/accordion/grid.html +44 -0
  97. data/spec/accordion/multiexpand.html +20 -0
  98. data/spec/alert/alert.js +35 -0
  99. data/spec/alert/basic.html +4 -0
  100. data/spec/clearing/222.gif +0 -0
  101. data/spec/clearing/777.gif +0 -0
  102. data/spec/clearing/basic.html +5 -0
  103. data/spec/clearing/ccc.gif +0 -0
  104. data/spec/clearing/clearing.js +55 -0
  105. data/spec/dropdown/basic.html +10 -0
  106. data/spec/dropdown/dropdown.js +65 -0
  107. data/spec/equalizer/basic.html +24 -0
  108. data/spec/equalizer/equalizer.js +30 -0
  109. data/spec/framework/framework.js +14 -0
  110. data/spec/helpers.js +37 -0
  111. data/spec/interchange/basic.html +3 -0
  112. data/spec/interchange/interchange.js +60 -0
  113. data/spec/joyride/joyride.js +14 -0
  114. data/spec/magellan/magellan.js +14 -0
  115. data/spec/offcanvas/offcanvas.js +14 -0
  116. data/spec/orbit/orbit.js +14 -0
  117. data/spec/reveal/reveal.js +14 -0
  118. data/spec/tab/tab.js +14 -0
  119. data/spec/tooltip/tooltip.js +14 -0
  120. data/spec/topbar/multidropdown.html +60 -0
  121. data/spec/topbar/sticky.html +31 -0
  122. data/spec/topbar/topbar.js +96 -0
  123. metadata +238 -0
@@ -0,0 +1,191 @@
1
+ // Foundation by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ @import "global";
6
+ @import "buttons";
7
+ @import "dropdown-buttons";
8
+
9
+ //
10
+ // @name _split-buttons.scss
11
+ // @dependencies _buttons.scss, _global.scss
12
+ //
13
+
14
+ //
15
+ // @variables
16
+ //
17
+
18
+ $include-html-button-classes: $include-html-classes !default;
19
+
20
+ // We use these to control different shared styles for Split Buttons
21
+ $split-button-function-factor: 10% !default;
22
+ $split-button-pip-color: #fff !default;
23
+ $split-button-pip-color-alt: #333 !default;
24
+ $split-button-active-bg-tint: rgba(0,0,0,0.1) !default;
25
+
26
+ // We use these to control tiny split buttons
27
+ $split-button-padding-tny: $button-pip-tny * 10 !default;
28
+ $split-button-span-width-tny: $button-pip-tny * 6 !default;
29
+ $split-button-pip-size-tny: $button-pip-tny !default;
30
+ $split-button-pip-top-tny: $button-pip-tny * 2 !default;
31
+ $split-button-pip-default-float-tny: rem-calc(-6) !default;
32
+
33
+ // We use these to control small split buttons
34
+ $split-button-padding-sml: $button-pip-sml * 10 !default;
35
+ $split-button-span-width-sml: $button-pip-sml * 6 !default;
36
+ $split-button-pip-size-sml: $button-pip-sml !default;
37
+ $split-button-pip-top-sml: $button-pip-sml * 1.5 !default;
38
+ $split-button-pip-default-float-sml: rem-calc(-6) !default;
39
+
40
+ // We use these to control medium split buttons
41
+ $split-button-padding-med: $button-pip-med * 9 !default;
42
+ $split-button-span-width-med: $button-pip-med * 5.5 !default;
43
+ $split-button-pip-size-med: $button-pip-med - rem-calc(3) !default;
44
+ $split-button-pip-top-med: $button-pip-med * 1.5 !default;
45
+ $split-button-pip-default-float-med: rem-calc(-6) !default;
46
+
47
+ // We use these to control large split buttons
48
+ $split-button-padding-lrg: $button-pip-lrg * 8 !default;
49
+ $split-button-span-width-lrg: $button-pip-lrg * 5 !default;
50
+ $split-button-pip-size-lrg: $button-pip-lrg - rem-calc(6) !default;
51
+ $split-button-pip-top-lrg: $button-pip-lrg + rem-calc(5) !default;
52
+ $split-button-pip-default-float-lrg: rem-calc(-6) !default;
53
+
54
+
55
+ //
56
+ // @mixins
57
+ //
58
+
59
+ // We use this mixin to create split buttons that build upon the button mixins
60
+ //
61
+ // $padding - Type of padding to apply. Default: medium. Options: tiny, small, medium, large.
62
+ // $pip-color - Color of the triangle. Default: $split-button-pip-color.
63
+ // $span-border - Border color of button divider. Default: $primary-color.
64
+ // $base-style - Apply base style to split button. Default: true.
65
+ @mixin split-button(
66
+ $padding:medium,
67
+ $pip-color:$split-button-pip-color,
68
+ $span-border:$primary-color,
69
+ $base-style:true) {
70
+
71
+ // With this, we can control whether or not the base styles come through.
72
+ @if $base-style {
73
+ position: relative;
74
+
75
+ // Styling for the split arrow clickable area
76
+ span {
77
+ display: block;
78
+ height: 100%;
79
+ position: absolute;
80
+ #{$opposite-direction}: 0;
81
+ top: 0;
82
+ border-#{$default-float}: solid 1px;
83
+
84
+ // Building the triangle pip indicator
85
+ &:before {
86
+ position: absolute;
87
+ content: "";
88
+ width: 0;
89
+ height: 0;
90
+ display: block;
91
+ border-style: inset;
92
+ top: 50%;
93
+
94
+ #{$default-float}: 50%;
95
+ }
96
+
97
+ &:active { background-color: $split-button-active-bg-tint; }
98
+ }
99
+ }
100
+
101
+ // Control the border color for the span area of the split button
102
+ @if $span-border {
103
+ span {
104
+ border-#{$default-float}-color: rgba(255,255,255,0.5);
105
+ }
106
+ }
107
+
108
+ // Style of the button and clickable area for tiny sizes
109
+ @if $padding == tiny {
110
+ padding-#{$opposite-direction}: $split-button-padding-tny;
111
+
112
+ span { width: $split-button-span-width-tny;
113
+ &:before {
114
+ border-top-style: solid;
115
+ border-width: $split-button-pip-size-tny;
116
+ top: 48%;
117
+ margin-#{$default-float}: $split-button-pip-default-float-tny;
118
+ }
119
+ }
120
+ }
121
+
122
+ // Style of the button and clickable area for small sizes
123
+ @else if $padding == small {
124
+ padding-#{$opposite-direction}: $split-button-padding-sml;
125
+
126
+ span { width: $split-button-span-width-sml;
127
+ &:before {
128
+ border-top-style: solid;
129
+ border-width: $split-button-pip-size-sml;
130
+ top: 48%;
131
+ margin-#{$default-float}: $split-button-pip-default-float-sml;
132
+ }
133
+ }
134
+ }
135
+
136
+ // Style of the button and clickable area for default (medium) sizes
137
+ @else if $padding == medium {
138
+ padding-#{$opposite-direction}: $split-button-padding-med;
139
+
140
+ span { width: $split-button-span-width-med;
141
+ &:before {
142
+ border-top-style: solid;
143
+ border-width: $split-button-pip-size-med;
144
+ top: 48%;
145
+ margin-#{$default-float}: $split-button-pip-default-float-med;
146
+ }
147
+ }
148
+ }
149
+
150
+ // Style of the button and clickable area for large sizes
151
+ @else if $padding == large {
152
+ padding-#{$opposite-direction}: $split-button-padding-lrg;
153
+
154
+ span { width: $split-button-span-width-lrg;
155
+ &:before {
156
+ border-top-style: solid;
157
+ border-width: $split-button-pip-size-lrg;
158
+ top: 48%;
159
+ margin-#{$default-float}: $split-button-pip-default-float-lrg;
160
+ }
161
+ }
162
+ }
163
+
164
+ // Control the color of the triangle pip
165
+ @if $pip-color {
166
+ span:before { border-color: $pip-color transparent transparent transparent; }
167
+ }
168
+ }
169
+
170
+ @include exports("split-button") {
171
+ @if $include-html-button-classes {
172
+
173
+ .split.button { @include split-button;
174
+
175
+ &.secondary { @include split-button(false, $split-button-pip-color, $secondary-color, false); }
176
+ &.alert { @include split-button(false, false, $alert-color, false); }
177
+ &.success { @include split-button(false, false, $success-color, false); }
178
+
179
+ &.tiny { @include split-button(tiny, false, false, false); }
180
+ &.small { @include split-button(small, false, false, false); }
181
+ &.large { @include split-button(large, false, false, false); }
182
+ &.expand { padding-left: 2rem; }
183
+
184
+ &.secondary { @include split-button(false, $split-button-pip-color-alt, false, false); }
185
+
186
+ &.radius span { @include side-radius($opposite-direction, $global-radius); }
187
+ &.round span { @include side-radius($opposite-direction, 1000px); }
188
+ }
189
+
190
+ }
191
+ }
@@ -0,0 +1,125 @@
1
+ // Foundation by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ @import "global";
6
+
7
+ //
8
+ // @name _sub-nav.scss
9
+ // @dependencies _global.scss
10
+ //
11
+
12
+ //
13
+ // @variables
14
+ //
15
+
16
+ $include-html-nav-classes: $include-html-classes !default;
17
+
18
+ // We use these to control margin and padding
19
+ $sub-nav-list-margin: rem-calc(-4 0 18) !default;
20
+ $sub-nav-list-padding-top: rem-calc(4) !default;
21
+
22
+ // We use this to control the definition
23
+ $sub-nav-font-family: $body-font-family !default;
24
+ $sub-nav-font-size: rem-calc(14) !default;
25
+ $sub-nav-font-color: #999 !default;
26
+ $sub-nav-font-weight: normal !default;
27
+ $sub-nav-text-decoration: none !default;
28
+ $sub-nav-padding: rem-calc(3 16) !default;
29
+ $sub-nav-border-radius: 3px !default;
30
+ $sub-nav-font-color-hover: scale-color($sub-nav-font-color, $lightness: -25%) !default;
31
+
32
+
33
+ // We use these to control the active item styles
34
+
35
+ $sub-nav-active-font-weight: normal !default;
36
+ $sub-nav-active-bg: $primary-color !default;
37
+ $sub-nav-active-bg-hover: scale-color($sub-nav-active-bg, $lightness: -14%) !default;
38
+ $sub-nav-active-color: #fff !default;
39
+ $sub-nav-active-padding: $sub-nav-padding !default;
40
+ $sub-nav-active-cursor: default !default;
41
+
42
+ $sub-nav-item-divider: "" !default;
43
+ $sub-nav-item-divider-margin: rem-calc(12) !default;
44
+
45
+ //
46
+ // @mixins
47
+ //
48
+
49
+
50
+ // Create a sub-nav item
51
+ //
52
+ // $font-color - Font color. Default: $sub-nav-font-color.
53
+ // $font-size - Font size. Default: $sub-nav-font-size.
54
+ // $active-bg - Background of active nav item. Default: $sub-nav-active-bg.
55
+ // $active-bg-hover - Background of active nav item, when hovered. Default: $sub-nav-active-bg-hover.
56
+ @mixin sub-nav(
57
+ $font-color: $sub-nav-font-color,
58
+ $font-size: $sub-nav-font-size,
59
+ $active-bg: $sub-nav-active-bg,
60
+ $active-bg-hover: $sub-nav-active-bg-hover) {
61
+ display: block;
62
+ width: auto;
63
+ overflow: hidden;
64
+ margin: $sub-nav-list-margin;
65
+ padding-top: $sub-nav-list-padding-top;
66
+ margin-#{$opposite-direction}: 0;
67
+ margin-#{$default-float}: rem-calc(-12);
68
+
69
+ dt {
70
+ text-transform: uppercase;
71
+ }
72
+
73
+ dt,
74
+ dd,
75
+ li {
76
+ float: $default-float;
77
+ display: inline;
78
+ margin-#{$default-float}: rem-calc(16);
79
+ margin-bottom: rem-calc(10);
80
+ font-family: $sub-nav-font-family;
81
+ font-weight: $sub-nav-font-weight;
82
+ font-size: $font-size;
83
+ color: $font-color;
84
+
85
+ a {
86
+ text-decoration: $sub-nav-text-decoration;
87
+ color: $sub-nav-font-color;
88
+ padding: $sub-nav-padding;
89
+ &:hover {
90
+ color: $sub-nav-font-color-hover;
91
+ }
92
+ }
93
+
94
+ &.active a {
95
+ @include radius($sub-nav-border-radius);
96
+ font-weight: $sub-nav-active-font-weight;
97
+ background: $active-bg;
98
+ padding: $sub-nav-active-padding;
99
+ cursor: $sub-nav-active-cursor;
100
+ color: $sub-nav-active-color;
101
+ &:hover {
102
+ background: $active-bg-hover;
103
+ }
104
+ }
105
+ @if $sub-nav-item-divider != "" {
106
+ margin-#{$default-float}: 0;
107
+
108
+ &:before {
109
+ content: "#{$sub-nav-item-divider}";
110
+ margin: 0 $sub-nav-item-divider-margin;
111
+ }
112
+
113
+ &:first-child:before {
114
+ content: "";
115
+ margin: 0;
116
+ }
117
+ }
118
+ }
119
+ }
120
+
121
+ @include exports("sub-nav") {
122
+ @if $include-html-nav-classes {
123
+ .sub-nav { @include sub-nav; }
124
+ }
125
+ }
@@ -0,0 +1,294 @@
1
+ // Foundation by ZURB
2
+ // foundation.zurb.com
3
+ // Licensed under MIT Open Source
4
+
5
+ @import "global";
6
+
7
+ //
8
+ // @name
9
+ // @dependencies _global.scss
10
+ //
11
+
12
+ //
13
+ // @variables
14
+ //
15
+
16
+ // NOTE: Switches have been deprecated in Foundation 5 and will be removed in the future.
17
+
18
+ $include-html-form-classes: $include-html-classes !default;
19
+
20
+ // Controlling border styles and background colors for the switch container
21
+ $switch-border-color: scale-color(#fff, $lightness: -20%) !default;
22
+ $switch-border-style: solid !default;
23
+ $switch-border-width: 1px !default;
24
+ $switch-bg: #fff !default;
25
+
26
+ // We use these to control the switch heights for our default classes
27
+ $switch-height-tny: 22px !default;
28
+ $switch-height-sml: 28px !default;
29
+ $switch-height-med: 36px !default;
30
+ $switch-height-lrg: 44px !default;
31
+ $switch-bottom-margin: rem-calc(20) !default;
32
+
33
+ // We use these to control default font sizes for our classes.
34
+ $switch-font-size-tny: 11px !default;
35
+ $switch-font-size-sml: 12px !default;
36
+ $switch-font-size-med: 14px !default;
37
+ $switch-font-size-lrg: 17px !default;
38
+ $switch-label-side-padding: 6px !default;
39
+
40
+ // We use these to style the switch-paddle
41
+ $switch-paddle-bg: #fff !default;
42
+ $switch-paddle-fade-to-color: scale-color($switch-paddle-bg, $lightness: -10%) !default;
43
+ $switch-paddle-border-color: scale-color($switch-paddle-bg, $lightness: -35%) !default;
44
+ $switch-paddle-border-width: 1px !default;
45
+ $switch-paddle-border-style: solid !default;
46
+ $switch-paddle-transition-speed: .1s !default;
47
+ $switch-paddle-transition-ease: ease-out !default;
48
+ $switch-positive-color: scale-color($success-color, $lightness: 94%) !default;
49
+ $switch-negative-color: #f5f5f5 !default;
50
+
51
+ // Outline Style for tabbing through switches
52
+ $switch-label-outline: 1px dotted #888 !default;
53
+
54
+
55
+ //
56
+ // @mixins
57
+ //
58
+
59
+ // We use this mixin to create the base styles for our switch element.
60
+ //
61
+ // $transition-speed - Time in ms for switch to toggle. Default: $switch-paddle-transition-speed.
62
+ // $transition-ease - Easing function to use for animation (i.e. ease-out). Default: $switch-paddle-transition-ease.
63
+ @mixin switch-base(
64
+ $transition-speed:$switch-paddle-transition-speed,
65
+ $transition-ease:$switch-paddle-transition-ease) {
66
+
67
+ // Default position and structure for switch container.
68
+ position: relative;
69
+ padding: 0;
70
+ display: block;
71
+ overflow: hidden;
72
+ border-style: $switch-border-style;
73
+ border-width: $switch-border-width;
74
+ margin-bottom: $switch-bottom-margin;
75
+
76
+ // Default label styles for type and transition
77
+ label {
78
+ position: relative;
79
+ #{$default-float}: 0;
80
+ z-index: 2;
81
+ float: $default-float;
82
+ width: 50%;
83
+ height: 100%;
84
+ margin: 0;
85
+ font-weight: bold;
86
+ text-align: $default-float;
87
+
88
+ // Transition for the switch label to follow paddle
89
+ @include single-transition(all, $transition-speed, $transition-ease);
90
+ }
91
+
92
+ // So that we don't need to recreate the form with any JS, we use the
93
+ // existing radio button, but we cleverly position and hide it.
94
+ input {
95
+ position: absolute;
96
+ z-index: 3;
97
+ opacity: 0;
98
+ width: 100%;
99
+ height: 100%;
100
+ -moz-appearance: none;
101
+
102
+ // Hover and focus styles for the paddle
103
+ &:hover,
104
+ &:focus {
105
+ cursor: $cursor-pointer-value;
106
+ }
107
+ }
108
+
109
+ // The toggle area for radio switches. We call is a paddle.
110
+ span:last-child {
111
+ position: absolute;
112
+ top: -1px;
113
+ #{$default-float}: -1px;
114
+ z-index: 1;
115
+ display: block;
116
+ padding: 0;
117
+ border-width: $switch-paddle-border-width;
118
+ border-style: $switch-paddle-border-style;
119
+
120
+ // Transition for the switch paddle
121
+ @include single-transition(all, $transition-speed, $transition-ease);
122
+ }
123
+
124
+ // When a label isn't :checked, we hide it as it slides away.
125
+ input:not(:checked) + label { opacity: 0; }
126
+
127
+ // Controlling the position of the labels as they are toggled.
128
+ input:checked { display: none !important; }
129
+ input { #{$default-float}: 0; display: block !important; }
130
+
131
+ // Left Label alignment and position changes, including fixes for while inside a custom form
132
+ input:first-of-type + label,
133
+ input:first-of-type + span + label { #{$default-float}: -50%; }
134
+ input:first-of-type:checked + label,
135
+ input:first-of-type:checked + span + label { #{$default-float}: 0%; }
136
+
137
+ // Right Label alignment and position changes, including fixes for while inside a custom form
138
+ input:last-of-type + label,
139
+ input:last-of-type + span + label {#{$opposite-direction}: -50%; #{$default-float}: auto; text-align: $opposite-direction; }
140
+ input:last-of-type:checked + label,
141
+ input:last-of-type:checked + span + label { #{$opposite-direction}: 0%; #{$default-float}: auto; }
142
+
143
+ // Hiding custom form spans since we auto-create them
144
+ span.custom { display: none !important; }
145
+
146
+ form.custom & .hidden-field {
147
+ margin-left: auto;
148
+ position: absolute;
149
+ visibility: visible;
150
+ }
151
+ }
152
+
153
+ // We use this mixin to create the size styles for switches.
154
+ //
155
+ // $height - Height (in px) of the switch. Default: $switch-height-med.
156
+ // $font-size - Font size of text in switch. Default: $switch-font-size-med.
157
+ // $line-height - Line height of switch. Default: 2.3rem.
158
+ @mixin switch-size(
159
+ $height: $switch-height-med,
160
+ $font-size: $switch-font-size-med,
161
+ $line-height: 2.3rem) {
162
+
163
+ height: rem-calc($height);
164
+
165
+ label {
166
+ padding: rem-calc(0, $switch-label-side-padding);
167
+ line-height: $line-height;
168
+ font-size: rem-calc($font-size);
169
+ }
170
+
171
+ input {
172
+ // Move the paddle to the right position
173
+ &:first-of-type:checked ~ span:last-child {
174
+ #{$default-float}: 100%;
175
+ margin-#{$default-float}: rem-calc(-$height + 1px);
176
+ }
177
+ }
178
+
179
+ span:last-child {
180
+ width: rem-calc($height);
181
+ height: rem-calc($height);
182
+ }
183
+
184
+ }
185
+
186
+ // We use this mixin to add color and other fanciness to the switches.
187
+ //
188
+ // $paddle-bg - Background of switch paddle. Default: $switch-paddle-bg.
189
+ // $positive-color - Background color of positive side of switch. Default: $switch-positive-color.
190
+ // $negative-color - Background color of negative side of switch. Default: $switch-negative-color.
191
+ // $radius - Radius to apply to switch. Default: false.
192
+ // $base-style - Apply base styles? Default: true.
193
+ @mixin switch-style(
194
+ $paddle-bg:$switch-paddle-bg,
195
+ $positive-color:$switch-positive-color,
196
+ $negative-color:$switch-negative-color,
197
+ $radius:false,
198
+ $base-style:true) {
199
+
200
+ @if $base-style {
201
+ background: $switch-bg;
202
+ border-color: $switch-border-color;
203
+
204
+ span:last-child {
205
+ border-color: scale-color($paddle-bg, $lightness: -30%);
206
+ background: $paddle-bg;
207
+ background: linear-gradient(to bottom, $paddle-bg 0%, scale-color($paddle-bg, $lightness: -5%) 100%);
208
+
209
+ // Building the alternating colored sides of the switch
210
+ box-shadow: 2px 0 10px 0 rgba(0,0,0,0.07),
211
+ 1000px 0 0 980px $positive-color,
212
+ -2px 0 10px 0 rgba(0,0,0,0.07),
213
+ -1000px 0 0 1000px $negative-color;
214
+ }
215
+
216
+ &:hover,
217
+ &:focus {
218
+ span:last-child {
219
+ background: $paddle-bg;
220
+ background: linear-gradient(to bottom, $paddle-bg 0%, scale-color($paddle-bg, $lightness: -10%) 100%);
221
+ }
222
+ }
223
+
224
+ &:active { background: transparent; }
225
+ }
226
+
227
+ // Setting up the radius for switches
228
+ @if $radius == true {
229
+ @include radius(4px);
230
+ span:last-child { @include radius(3px); }
231
+ }
232
+ @else if $radius {
233
+ @include radius($radius);
234
+ span:last-child { @include radius($radius - 1px); }
235
+ }
236
+
237
+ }
238
+
239
+ // We use this to quickly create switches with a single mixin
240
+ //
241
+ // $transition-speed - Time in ms for switch to toggle. Default: $switch-paddle-transition-speed.
242
+ // $transition-ease - Easing function to use for animation (i.e. ease-out). Default: $switch-paddle-transition-ease.
243
+ // $height - Height (in px) of the switch. Default: $switch-height-med.
244
+ // $font-size - Font size of text in switch. Default: $switch-font-size-med.
245
+ // $line-height - Line height of switch. Default: 2.3rem.
246
+ // $paddle-bg - Background of switch paddle. Default: $switch-paddle-bg.
247
+ // $positive-color - Background color of positive side of switch. Default: $switch-positive-color.
248
+ // $negative-color - Background color of negative side of switch. Default: $switch-negative-color.
249
+ // $radius - Radius to apply to switch. Default: false.
250
+ // $base-style - Apply base styles? Default: true.
251
+ @mixin switch(
252
+ $transition-speed: $switch-paddle-transition-speed,
253
+ $transition-ease: $switch-paddle-transition-ease,
254
+ $height: $switch-height-med,
255
+ $font-size: $switch-font-size-med,
256
+ $line-height: 2.3rem,
257
+ $paddle-bg: $switch-paddle-bg,
258
+ $positive-color: $switch-positive-color,
259
+ $negative-color: $switch-negative-color,
260
+ $radius:false,
261
+ $base-style:true) {
262
+ @include switch-base($transition-speed, $transition-ease);
263
+ @include switch-size($height, $font-size, $line-height);
264
+ @include switch-style($paddle-bg, $positive-color, $negative-color, $radius, $base-style);
265
+ }
266
+
267
+ @include exports("switch") {
268
+ @if $include-html-form-classes {
269
+ div.switch {
270
+ @include switch;
271
+
272
+ // Large radio switches
273
+ &.large { @include switch-size($switch-height-lrg, $switch-font-size-lrg); }
274
+
275
+ // Small radio switches
276
+ &.small { @include switch-size($switch-height-sml, $switch-font-size-sml, 2.1rem); }
277
+
278
+ // Tiny radio switches
279
+ &.tiny { @include switch-size($switch-height-tny, $switch-font-size-tny, 1.9rem); }
280
+
281
+ // Add a radius to the switch
282
+ &.radius { @include radius(4px);
283
+ span:last-child{ @include radius(3px); }
284
+ }
285
+
286
+ // Make the switch completely round, like a pill
287
+ &.round { @include radius(1000px);
288
+ span:last-child { @include radius(999px); }
289
+ label { padding: rem-calc(0 $switch-label-side-padding + 3); }
290
+ }
291
+
292
+ }
293
+ }
294
+ }