foundation-rails 5.0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (136) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +29 -0
  6. data/Rakefile +1 -0
  7. data/app/controllers/foundation/rails/styleguide_controller.rb +10 -0
  8. data/app/views/foundation/rails/styleguide/show.html.erb +134 -0
  9. data/config/routes.rb +3 -0
  10. data/foundation-rails.gemspec +25 -0
  11. data/lib/foundation-rails.rb +1 -0
  12. data/lib/foundation/rails.rb +3 -0
  13. data/lib/foundation/rails/engine.rb +7 -0
  14. data/lib/foundation/rails/generators/install_generator.rb +56 -0
  15. data/lib/foundation/rails/templates/application.html.erb +19 -0
  16. data/lib/foundation/rails/templates/application.html.haml +18 -0
  17. data/lib/foundation/rails/templates/application.html.slim +17 -0
  18. data/lib/foundation/rails/version.rb +5 -0
  19. data/test/dummy/.gitignore +16 -0
  20. data/test/dummy/Gemfile +47 -0
  21. data/test/dummy/README.rdoc +28 -0
  22. data/test/dummy/Rakefile +6 -0
  23. data/test/dummy/app/assets/images/.keep +0 -0
  24. data/test/dummy/app/assets/javascripts/application.js +8 -0
  25. data/test/dummy/app/assets/stylesheets/application.css +4 -0
  26. data/test/dummy/app/assets/stylesheets/foundation_and_overrides.scss +4 -0
  27. data/test/dummy/app/controllers/application_controller.rb +5 -0
  28. data/test/dummy/app/controllers/concerns/.keep +0 -0
  29. data/test/dummy/app/controllers/styleguide_controller.rb +4 -0
  30. data/test/dummy/app/helpers/application_helper.rb +2 -0
  31. data/test/dummy/app/helpers/styleguide_helper.rb +2 -0
  32. data/test/dummy/app/mailers/.keep +0 -0
  33. data/test/dummy/app/models/.keep +0 -0
  34. data/test/dummy/app/models/concerns/.keep +0 -0
  35. data/test/dummy/app/views/layouts/application.html.erb +19 -0
  36. data/test/dummy/app/views/styleguide/show.html.erb +109 -0
  37. data/test/dummy/bin/bundle +3 -0
  38. data/test/dummy/bin/rails +4 -0
  39. data/test/dummy/bin/rake +4 -0
  40. data/test/dummy/config.ru +4 -0
  41. data/test/dummy/config/application.rb +23 -0
  42. data/test/dummy/config/boot.rb +4 -0
  43. data/test/dummy/config/database.yml +25 -0
  44. data/test/dummy/config/environment.rb +5 -0
  45. data/test/dummy/config/environments/development.rb +29 -0
  46. data/test/dummy/config/environments/production.rb +80 -0
  47. data/test/dummy/config/environments/test.rb +36 -0
  48. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  49. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/test/dummy/config/initializers/inflections.rb +16 -0
  51. data/test/dummy/config/initializers/mime_types.rb +5 -0
  52. data/test/dummy/config/initializers/secret_token.rb +12 -0
  53. data/test/dummy/config/initializers/session_store.rb +3 -0
  54. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  55. data/test/dummy/config/locales/en.yml +23 -0
  56. data/test/dummy/config/routes.rb +3 -0
  57. data/test/dummy/db/seeds.rb +7 -0
  58. data/test/dummy/lib/assets/.keep +0 -0
  59. data/test/dummy/lib/tasks/.keep +0 -0
  60. data/test/dummy/log/.keep +0 -0
  61. data/test/dummy/public/404.html +58 -0
  62. data/test/dummy/public/422.html +58 -0
  63. data/test/dummy/public/500.html +57 -0
  64. data/test/dummy/public/favicon.ico +0 -0
  65. data/test/dummy/public/robots.txt +5 -0
  66. data/test/dummy/test/controllers/.keep +0 -0
  67. data/test/dummy/test/controllers/styleguide_controller_test.rb +9 -0
  68. data/test/dummy/test/fixtures/.keep +0 -0
  69. data/test/dummy/test/helpers/.keep +0 -0
  70. data/test/dummy/test/helpers/styleguide_helper_test.rb +4 -0
  71. data/test/dummy/test/integration/.keep +0 -0
  72. data/test/dummy/test/mailers/.keep +0 -0
  73. data/test/dummy/test/models/.keep +0 -0
  74. data/test/dummy/test/test_helper.rb +15 -0
  75. data/test/dummy/vendor/assets/javascripts/.keep +0 -0
  76. data/test/dummy/vendor/assets/stylesheets/.keep +0 -0
  77. data/vendor/_settings.scss +992 -0
  78. data/vendor/assets/javascripts/foundation.js +15 -0
  79. data/vendor/assets/javascripts/foundation/foundation.abide.js +201 -0
  80. data/vendor/assets/javascripts/foundation/foundation.accordion.js +41 -0
  81. data/vendor/assets/javascripts/foundation/foundation.alert.js +34 -0
  82. data/vendor/assets/javascripts/foundation/foundation.clearing.js +450 -0
  83. data/vendor/assets/javascripts/foundation/foundation.dropdown.js +184 -0
  84. data/vendor/assets/javascripts/foundation/foundation.interchange.js +304 -0
  85. data/vendor/assets/javascripts/foundation/foundation.joyride.js +839 -0
  86. data/vendor/assets/javascripts/foundation/foundation.js +416 -0
  87. data/vendor/assets/javascripts/foundation/foundation.magellan.js +118 -0
  88. data/vendor/assets/javascripts/foundation/foundation.offcanvas.js +37 -0
  89. data/vendor/assets/javascripts/foundation/foundation.orbit.js +434 -0
  90. data/vendor/assets/javascripts/foundation/foundation.reveal.js +347 -0
  91. data/vendor/assets/javascripts/foundation/foundation.tab.js +37 -0
  92. data/vendor/assets/javascripts/foundation/foundation.tooltip.js +202 -0
  93. data/vendor/assets/javascripts/foundation/foundation.topbar.js +380 -0
  94. data/vendor/assets/javascripts/vendor/modernizr.js +4 -0
  95. data/vendor/assets/stylesheets/foundation.scss +38 -0
  96. data/vendor/assets/stylesheets/foundation/_functions.scss +75 -0
  97. data/vendor/assets/stylesheets/foundation/_settings.scss +992 -0
  98. data/vendor/assets/stylesheets/foundation/components/_accordion.scss +49 -0
  99. data/vendor/assets/stylesheets/foundation/components/_alert-boxes.scss +113 -0
  100. data/vendor/assets/stylesheets/foundation/components/_block-grid.scss +83 -0
  101. data/vendor/assets/stylesheets/foundation/components/_breadcrumbs.scss +123 -0
  102. data/vendor/assets/stylesheets/foundation/components/_button-groups.scss +97 -0
  103. data/vendor/assets/stylesheets/foundation/components/_buttons.scss +234 -0
  104. data/vendor/assets/stylesheets/foundation/components/_clearing.scss +233 -0
  105. data/vendor/assets/stylesheets/foundation/components/_dropdown-buttons.scss +125 -0
  106. data/vendor/assets/stylesheets/foundation/components/_dropdown.scss +159 -0
  107. data/vendor/assets/stylesheets/foundation/components/_flex-video.scss +47 -0
  108. data/vendor/assets/stylesheets/foundation/components/_forms.scss +472 -0
  109. data/vendor/assets/stylesheets/foundation/components/_functions.scss +70 -0
  110. data/vendor/assets/stylesheets/foundation/components/_global.scss +387 -0
  111. data/vendor/assets/stylesheets/foundation/components/_grid.scss +234 -0
  112. data/vendor/assets/stylesheets/foundation/components/_inline-lists.scss +52 -0
  113. data/vendor/assets/stylesheets/foundation/components/_joyride.scss +220 -0
  114. data/vendor/assets/stylesheets/foundation/components/_keystrokes.scss +57 -0
  115. data/vendor/assets/stylesheets/foundation/components/_labels.scss +100 -0
  116. data/vendor/assets/stylesheets/foundation/components/_magellan.scss +30 -0
  117. data/vendor/assets/stylesheets/foundation/components/_offcanvas.scss +360 -0
  118. data/vendor/assets/stylesheets/foundation/components/_orbit.scss +353 -0
  119. data/vendor/assets/stylesheets/foundation/components/_pagination.scss +145 -0
  120. data/vendor/assets/stylesheets/foundation/components/_panels.scss +87 -0
  121. data/vendor/assets/stylesheets/foundation/components/_pricing-tables.scss +146 -0
  122. data/vendor/assets/stylesheets/foundation/components/_progress-bars.scss +75 -0
  123. data/vendor/assets/stylesheets/foundation/components/_reveal.scss +165 -0
  124. data/vendor/assets/stylesheets/foundation/components/_side-nav.scss +83 -0
  125. data/vendor/assets/stylesheets/foundation/components/_split-buttons.scss +187 -0
  126. data/vendor/assets/stylesheets/foundation/components/_sub-nav.scss +118 -0
  127. data/vendor/assets/stylesheets/foundation/components/_switch.scss +314 -0
  128. data/vendor/assets/stylesheets/foundation/components/_tables.scss +93 -0
  129. data/vendor/assets/stylesheets/foundation/components/_tabs.scss +95 -0
  130. data/vendor/assets/stylesheets/foundation/components/_thumbs.scss +71 -0
  131. data/vendor/assets/stylesheets/foundation/components/_tooltips.scss +121 -0
  132. data/vendor/assets/stylesheets/foundation/components/_top-bar.scss +590 -0
  133. data/vendor/assets/stylesheets/foundation/components/_type.scss +447 -0
  134. data/vendor/assets/stylesheets/foundation/components/_visibility.scss +661 -0
  135. data/vendor/assets/stylesheets/normalize.scss +410 -0
  136. metadata +292 -0
@@ -0,0 +1,83 @@
1
+ @import "global";
2
+
3
+ //
4
+ // @variables
5
+ //
6
+
7
+ $include-html-nav-classes: $include-html-classes !default;
8
+
9
+ // We use this to control padding.
10
+ $side-nav-padding: rem-calc(14 0) !default;
11
+
12
+ // We use these to control list styles.
13
+ $side-nav-list-type: none !default;
14
+ $side-nav-list-position: inside !default;
15
+ $side-nav-list-margin: rem-calc(0 0 7 0) !default;
16
+
17
+ // We use these to control link styles.
18
+ $side-nav-link-color: $primary-color !default;
19
+ $side-nav-link-color-active: lighten(#000, 30%) !default;
20
+ $side-nav-font-size: rem-calc(14) !default;
21
+ $side-nav-font-weight: normal !default;
22
+ $side-nav-font-family: $body-font-family !default;
23
+ $side-nav-active-font-family: $side-nav-font-family !default;
24
+
25
+
26
+
27
+ // We use these to control border styles
28
+ $side-nav-divider-size: 1px !default;
29
+ $side-nav-divider-style: solid !default;
30
+ $side-nav-divider-color: darken(#fff, 10%) !default;
31
+
32
+
33
+ //
34
+ // @mixins
35
+ //
36
+
37
+
38
+ // We use this to style the side-nav
39
+ //
40
+ // $divider-color - Border color of divider. Default: $side-nav-divider-color.
41
+ // $font-size - Font size of nav items. Default: $side-nav-font-size.
42
+ // $link-color - Color of navigation links. Default: $side-nav-link-color.
43
+ @mixin side-nav(
44
+ $divider-color:$side-nav-divider-color,
45
+ $font-size:$side-nav-font-size,
46
+ $link-color:$side-nav-link-color) {
47
+ display: block;
48
+ margin: 0;
49
+ padding: $side-nav-padding;
50
+ list-style-type: $side-nav-list-type;
51
+ list-style-position: $side-nav-list-position;
52
+ font-family: $side-nav-font-family;
53
+
54
+ li {
55
+ margin: $side-nav-list-margin;
56
+ font-size: $font-size;
57
+
58
+ a {
59
+ display: block;
60
+ color: $link-color;
61
+ }
62
+
63
+ &.active > a:first-child {
64
+ color: $side-nav-link-color-active;
65
+ font-weight: $side-nav-font-weight;
66
+ font-family: $side-nav-active-font-family;
67
+ }
68
+
69
+ &.divider {
70
+ border-top: $side-nav-divider-size $side-nav-divider-style;
71
+ height: 0;
72
+ padding: 0;
73
+ list-style: none;
74
+ border-top-color: $divider-color;
75
+ }
76
+ }
77
+ }
78
+
79
+ @include exports("side-nav") {
80
+ @if $include-html-nav-classes {
81
+ .side-nav { @include side-nav; }
82
+ }
83
+ }
@@ -0,0 +1,187 @@
1
+ @import "global";
2
+ @import "buttons";
3
+ @import "dropdown-buttons";
4
+
5
+ //
6
+ // @name _split-buttons.scss
7
+ // @dependencies _buttons.scss, _global.scss
8
+ //
9
+
10
+ //
11
+ // @variables
12
+ //
13
+
14
+ $include-html-button-classes: $include-html-classes !default;
15
+
16
+ // We use these to control different shared styles for Split Buttons
17
+ $split-button-function-factor: 10% !default;
18
+ $split-button-pip-color: #fff !default;
19
+ $split-button-pip-color-alt: #333 !default;
20
+ $split-button-active-bg-tint: rgba(0,0,0,0.1) !default;
21
+
22
+ // We use these to control tiny split buttons
23
+ $split-button-padding-tny: $button-pip-tny * 10 !default;
24
+ $split-button-span-width-tny: $button-pip-tny * 6 !default;
25
+ $split-button-pip-size-tny: $button-pip-tny !default;
26
+ $split-button-pip-top-tny: $button-pip-tny * 2 !default;
27
+ $split-button-pip-default-float-tny: rem-calc(-6) !default;
28
+
29
+ // We use these to control small split buttons
30
+ $split-button-padding-sml: $button-pip-sml * 10 !default;
31
+ $split-button-span-width-sml: $button-pip-sml * 6 !default;
32
+ $split-button-pip-size-sml: $button-pip-sml !default;
33
+ $split-button-pip-top-sml: $button-pip-sml * 1.5 !default;
34
+ $split-button-pip-default-float-sml: rem-calc(-6) !default;
35
+
36
+ // We use these to control medium split buttons
37
+ $split-button-padding-med: $button-pip-med * 9 !default;
38
+ $split-button-span-width-med: $button-pip-med * 5.5 !default;
39
+ $split-button-pip-size-med: $button-pip-med - rem-calc(3) !default;
40
+ $split-button-pip-top-med: $button-pip-med * 1.5 !default;
41
+ $split-button-pip-default-float-med: rem-calc(-6) !default;
42
+
43
+ // We use these to control large split buttons
44
+ $split-button-padding-lrg: $button-pip-lrg * 8 !default;
45
+ $split-button-span-width-lrg: $button-pip-lrg * 5 !default;
46
+ $split-button-pip-size-lrg: $button-pip-lrg - rem-calc(6) !default;
47
+ $split-button-pip-top-lrg: $button-pip-lrg + rem-calc(5) !default;
48
+ $split-button-pip-default-float-lrg: rem-calc(-6) !default;
49
+
50
+
51
+ //
52
+ // @mixins
53
+ //
54
+
55
+ // We use this mixin to create split buttons that build upon the button mixins
56
+ //
57
+ // $padding - Type of padding to apply. Default: medium. Options: tiny, small, medium, large.
58
+ // $pip-color - Color of the triangle. Default: $split-button-pip-color.
59
+ // $span-border - Border color of button divider. Default: $primary-color.
60
+ // $base-style - Apply base style to split button. Default: true.
61
+ @mixin split-button(
62
+ $padding:medium,
63
+ $pip-color:$split-button-pip-color,
64
+ $span-border:$primary-color,
65
+ $base-style:true) {
66
+
67
+ // With this, we can control whether or not the base styles come through.
68
+ @if $base-style {
69
+ position: relative;
70
+
71
+ // Styling for the split arrow clickable area
72
+ span {
73
+ display: block;
74
+ height: 100%;
75
+ position: absolute;
76
+ #{$opposite-direction}: 0;
77
+ top: 0;
78
+ border-#{$default-float}: solid 1px;
79
+
80
+ // Building the triangle pip indicator
81
+ &:before {
82
+ position: absolute;
83
+ content: "";
84
+ width: 0;
85
+ height: 0;
86
+ display: block;
87
+ border-style: inset;
88
+ top: 50%;
89
+
90
+ #{$default-float}: 50%;
91
+ }
92
+
93
+ &:active { background-color: $split-button-active-bg-tint; }
94
+ }
95
+ }
96
+
97
+ // Control the border color for the span area of the split button
98
+ @if $span-border {
99
+ span {
100
+ border-#{$default-float}-color: rgba(255,255,255,0.5);
101
+ }
102
+ }
103
+
104
+ // Style of the button and clickable area for tiny sizes
105
+ @if $padding == tiny {
106
+ padding-#{$opposite-direction}: $split-button-padding-tny;
107
+
108
+ span { width: $split-button-span-width-tny;
109
+ &:before {
110
+ border-top-style: solid;
111
+ border-width: $split-button-pip-size-tny;
112
+ top: 48%;
113
+ margin-#{$default-float}: $split-button-pip-default-float-tny;
114
+ }
115
+ }
116
+ }
117
+
118
+ // Style of the button and clickable area for small sizes
119
+ @else if $padding == small {
120
+ padding-#{$opposite-direction}: $split-button-padding-sml;
121
+
122
+ span { width: $split-button-span-width-sml;
123
+ &:before {
124
+ border-top-style: solid;
125
+ border-width: $split-button-pip-size-sml;
126
+ top: 48%;
127
+ margin-#{$default-float}: $split-button-pip-default-float-sml;
128
+ }
129
+ }
130
+ }
131
+
132
+ // Style of the button and clickable area for default (medium) sizes
133
+ @else if $padding == medium {
134
+ padding-#{$opposite-direction}: $split-button-padding-med;
135
+
136
+ span { width: $split-button-span-width-med;
137
+ &:before {
138
+ border-top-style: solid;
139
+ border-width: $split-button-pip-size-med;
140
+ top: 48%;
141
+ margin-#{$default-float}: $split-button-pip-default-float-med;
142
+ }
143
+ }
144
+ }
145
+
146
+ // Style of the button and clickable area for large sizes
147
+ @else if $padding == large {
148
+ padding-#{$opposite-direction}: $split-button-padding-lrg;
149
+
150
+ span { width: $split-button-span-width-lrg;
151
+ &:before {
152
+ border-top-style: solid;
153
+ border-width: $split-button-pip-size-lrg;
154
+ top: 48%;
155
+ margin-#{$default-float}: $split-button-pip-default-float-lrg;
156
+ }
157
+ }
158
+ }
159
+
160
+ // Control the color of the triangle pip
161
+ @if $pip-color {
162
+ span:before { border-color: $pip-color transparent transparent transparent; }
163
+ }
164
+ }
165
+
166
+ @include exports("split-button") {
167
+ @if $include-html-button-classes {
168
+
169
+ .split.button { @include split-button;
170
+
171
+ &.secondary { @include split-button(false, $split-button-pip-color, $secondary-color, false); }
172
+ &.alert { @include split-button(false, false, $alert-color, false); }
173
+ &.success { @include split-button(false, false, $success-color, false); }
174
+
175
+ &.tiny { @include split-button(tiny, false, false, false); }
176
+ &.small { @include split-button(small, false, false, false); }
177
+ &.large { @include split-button(large, false, false, false); }
178
+ &.expand { padding-left: 2rem; }
179
+
180
+ &.secondary { @include split-button(false, $split-button-pip-color-alt, false, false); }
181
+
182
+ &.radius span { @include side-radius($opposite-direction, $global-radius); }
183
+ &.round span { @include side-radius($opposite-direction, 1000px); }
184
+ }
185
+
186
+ }
187
+ }
@@ -0,0 +1,118 @@
1
+ @import "global";
2
+
3
+ //
4
+ // @name _sub-nav.scss
5
+ // @dependencies _global.scss
6
+ //
7
+
8
+ //
9
+ // @variables
10
+ //
11
+
12
+ $include-html-nav-classes: $include-html-classes !default;
13
+
14
+ // We use these to control margin and padding
15
+ $sub-nav-list-margin: rem-calc(-4 0 18) !default;
16
+ $sub-nav-list-padding-top: rem-calc(4) !default;
17
+
18
+ // We use this to control the definition
19
+ $sub-nav-font-family: $body-font-family !default;
20
+ $sub-nav-font-size: rem-calc(14) !default;
21
+ $sub-nav-font-color: #999 !default;
22
+ $sub-nav-font-weight: normal !default;
23
+ $sub-nav-text-decoration: none !default;
24
+ $sub-nav-border-radius: 3px !default;
25
+ $sub-nav-font-color-hover: darken($sub-nav-font-color, 15%) !default;
26
+
27
+
28
+ // We use these to control the active item styles
29
+
30
+ $sub-nav-active-font-weight: normal !default;
31
+ $sub-nav-active-bg: $primary-color !default;
32
+ $sub-nav-active-bg-hover: darken($sub-nav-active-bg, 5%) !default;
33
+ $sub-nav-active-color: #fff !default;
34
+ $sub-nav-active-padding: rem-calc(3 16) !default;
35
+ $sub-nav-active-cursor: default !default;
36
+
37
+ $sub-nav-item-divider: "" !default;
38
+ $sub-nav-item-divider-margin: rem-calc(12) !default;
39
+
40
+ //
41
+ // @mixins
42
+ //
43
+
44
+
45
+ // Create a sub-nav item
46
+ //
47
+ // $font-color - Font color. Default: $sub-nav-font-color.
48
+ // $font-size - Font size. Default: $sub-nav-font-size.
49
+ // $active-bg - Background of active nav item. Default: $sub-nav-active-bg.
50
+ @mixin sub-nav(
51
+ $font-color:$sub-nav-font-color,
52
+ $font-size:$sub-nav-font-size,
53
+ $active-bg:$sub-nav-active-bg,
54
+ $active-bg-hover:darken($active-bg, 5%)) {
55
+ display: block;
56
+ width: auto;
57
+ overflow: hidden;
58
+ margin: $sub-nav-list-margin;
59
+ padding-top: $sub-nav-list-padding-top;
60
+ margin-#{$opposite-direction}: 0;
61
+ margin-#{$default-float}: rem-calc(-12);
62
+
63
+ dt {
64
+ text-transform: uppercase;
65
+ }
66
+
67
+ dt,
68
+ dd,
69
+ li {
70
+ float: $default-float;
71
+ display: inline;
72
+ margin-#{$default-float}: rem-calc(16);
73
+ margin-bottom: rem-calc(10);
74
+ font-family: $sub-nav-font-family;
75
+ font-weight: $sub-nav-font-weight;
76
+ font-size: $font-size;
77
+ color: $font-color;
78
+
79
+ a {
80
+ text-decoration: $sub-nav-text-decoration;
81
+ color: $sub-nav-font-color;
82
+ &:hover {
83
+ color: $active-bg-hover;
84
+ }
85
+ }
86
+
87
+ &.active a {
88
+ @include radius($global-radius);
89
+ font-weight: $sub-nav-active-font-weight;
90
+ background: $active-bg;
91
+ padding: $sub-nav-active-padding;
92
+ cursor: $sub-nav-active-cursor;
93
+ color: $sub-nav-active-color;
94
+ &:hover {
95
+ background: $active-bg-hover;
96
+ }
97
+ }
98
+ @if $sub-nav-item-divider != "" {
99
+ margin-#{$default-float}: 0;
100
+
101
+ &:before {
102
+ content: "#{$sub-nav-item-divider}";
103
+ margin: 0 $sub-nav-item-divider-margin;
104
+ }
105
+
106
+ &:first-child:before {
107
+ content: "";
108
+ margin: 0;
109
+ }
110
+ }
111
+ }
112
+ }
113
+
114
+ @include exports("sub-nav") {
115
+ @if $include-html-nav-classes {
116
+ .sub-nav { @include sub-nav; }
117
+ }
118
+ }
@@ -0,0 +1,314 @@
1
+ @import "global";
2
+
3
+ //
4
+ // @name
5
+ // @dependencies _global.scss
6
+ //
7
+
8
+ //
9
+ // @variables
10
+ //
11
+
12
+ $include-html-form-classes: $include-html-classes !default;
13
+
14
+ // Controlling border styles and background colors for the switch container
15
+ $switch-border-color: darken(#fff, 20%) !default;
16
+ $switch-border-style: solid !default;
17
+ $switch-border-width: 1px !default;
18
+ $switch-bg: #fff !default;
19
+
20
+ // We use these to control the switch heights for our default classes
21
+ $switch-height-tny: 22px !default;
22
+ $switch-height-sml: 28px !default;
23
+ $switch-height-med: 36px !default;
24
+ $switch-height-lrg: 44px !default;
25
+ $switch-bottom-margin: rem-calc(20) !default;
26
+
27
+ // We use these to control default font sizes for our classes.
28
+ $switch-font-size-tny: 11px !default;
29
+ $switch-font-size-sml: 12px !default;
30
+ $switch-font-size-med: 14px !default;
31
+ $switch-font-size-lrg: 17px !default;
32
+ $switch-label-side-padding: 6px !default;
33
+
34
+ // We use these to style the switch-paddle
35
+ $switch-paddle-bg: #fff !default;
36
+ $switch-paddle-fade-to-color: darken($switch-paddle-bg, 10%) !default;
37
+ $switch-paddle-border-color: darken($switch-paddle-bg, 35%) !default;
38
+ $switch-paddle-border-width: 1px !default;
39
+ $switch-paddle-border-style: solid !default;
40
+ $switch-paddle-transition-speed: .1s !default;
41
+ $switch-paddle-transition-ease: ease-out !default;
42
+ $switch-positive-color: lighten($success-color, 50%) !default;
43
+ $switch-negative-color: #f5f5f5 !default;
44
+
45
+ // Outline Style for tabbing through switches
46
+ $switch-label-outline: 1px dotted #888 !default;
47
+
48
+
49
+ //
50
+ // @mixins
51
+ //
52
+
53
+ // We use this mixin to create the base styles for our switch element.
54
+ //
55
+ // $transition-speed - Time in ms for switch to toggle. Default: $switch-paddle-transition-speed.
56
+ // $transition-ease - Easing function to use for animation (i.e. ease-out). Default: $switch-paddle-transition-ease.
57
+ @mixin switch-base(
58
+ $transition-speed:$switch-paddle-transition-speed,
59
+ $transition-ease:$switch-paddle-transition-ease) {
60
+
61
+ // Default position and structure for switch container.
62
+ position: relative;
63
+ padding: 0;
64
+ display: block;
65
+ overflow: hidden;
66
+ border-style: $switch-border-style;
67
+ border-width: $switch-border-width;
68
+ margin-bottom: $switch-bottom-margin;
69
+
70
+ // Default label styles for type and transition
71
+ label {
72
+ position: relative;
73
+ #{$default-float}: 0;
74
+ z-index: 2;
75
+ float: $default-float;
76
+ width: 50%;
77
+ height: 100%;
78
+ margin: 0;
79
+ font-weight: bold;
80
+ text-align: $default-float;
81
+
82
+ // Transition for the switch label to follow paddle
83
+ @include single-transition(all, $transition-speed, $transition-ease);
84
+ }
85
+
86
+ // So that we don't need to recreate the form with any JS, we use the
87
+ // existing radio button, but we cleverly position and hide it.
88
+ input {
89
+ position: absolute;
90
+ z-index: 3;
91
+ opacity: 0;
92
+ width: 100%;
93
+ height: 100%;
94
+ -moz-appearance: none;
95
+
96
+ // Hover and focus styles for the paddle
97
+ &:hover,
98
+ &:focus {
99
+ cursor: $cursor-pointer-value;
100
+ }
101
+ }
102
+
103
+ // The toggle area for radio switches. We call is a paddle.
104
+ span:last-child {
105
+ position: absolute;
106
+ top: -1px;
107
+ #{$default-float}: -1px;
108
+ z-index: 1;
109
+ display: block;
110
+ padding: 0;
111
+ border-width: $switch-paddle-border-width;
112
+ border-style: $switch-paddle-border-style;
113
+
114
+ // Transition for the switch paddle
115
+ @include single-transition(all, $transition-speed, $transition-ease);
116
+ }
117
+
118
+ // When a label isn't :checked, we hide it as it slides away.
119
+ input:not(:checked) + label { opacity: 0; }
120
+
121
+ // Controlling the position of the labels as they are toggled.
122
+ input:checked { display: none !important; }
123
+ input { #{$default-float}: 0; display: block !important; }
124
+
125
+ // Left Label alignment and position changes, including fixes for while inside a custom form
126
+ input:first-of-type + label,
127
+ input:first-of-type + span + label { #{$default-float}: -50%; }
128
+ input:first-of-type:checked + label,
129
+ input:first-of-type:checked + span + label { #{$default-float}: 0%; }
130
+
131
+ // Right Label alignment and position changes, including fixes for while inside a custom form
132
+ input:last-of-type + label,
133
+ input:last-of-type + span + label {#{$opposite-direction}: -50%; #{$default-float}: auto; text-align: $opposite-direction; }
134
+ input:last-of-type:checked + label,
135
+ input:last-of-type:checked + span + label { #{$opposite-direction}: 0%; #{$default-float}: auto; }
136
+
137
+ // Hiding custom form spans since we auto-create them
138
+ span.custom { display: none !important; }
139
+
140
+ // FIXME We should be able to remove this going forward.
141
+ // Bugfix for older Webkit, including mobile Webkit. Adapted from:
142
+ // http://css-tricks.com/webkit-sibling-bug/
143
+ // @media only screen and (-webkit-min-device-pixel-ratio:0) and (max-device-width:480px) {
144
+ // @if $experimental { -webkit-animation: webkitSiblingBugfix infinite 1s; }
145
+ // }
146
+ // @media only screen and (-webkit-min-device-pixel-ratio:1.5) {
147
+ // @if $experimental { -webkit-animation: none 0; }
148
+ // }
149
+
150
+ form.custom & .hidden-field {
151
+ margin-left: auto;
152
+ position: absolute;
153
+ visibility: visible;
154
+ }
155
+ }
156
+
157
+ // We use this mixin to create the size styles for switches.
158
+ //
159
+ // $height - Height (in px) of the switch. Default: $switch-height-med.
160
+ // $font-size - Font size of text in switch. Default: $switch-font-size-med.
161
+ // $line-height - Line height of switch. Default: 2.3rem.
162
+ @mixin switch-size(
163
+ $height: $switch-height-med,
164
+ $font-size: $switch-font-size-med,
165
+ $line-height: 2.3rem) {
166
+
167
+ height: rem-calc($height);
168
+
169
+ label {
170
+ padding: rem-calc(0, $switch-label-side-padding);
171
+ line-height: $line-height;
172
+ font-size: rem-calc($font-size);
173
+ }
174
+
175
+ input {
176
+ // Move the paddle to the right position
177
+ &:first-of-type:checked ~ span:last-child {
178
+ #{$default-float}: 100%;
179
+ margin-#{$default-float}: rem-calc(-$height + 1px);
180
+ }
181
+ }
182
+
183
+ span:last-child {
184
+ width: rem-calc($height);
185
+ height: rem-calc($height);
186
+ }
187
+
188
+ }
189
+
190
+ // We use this mixin to add color and other fanciness to the switches.
191
+ //
192
+ // $paddle-bg - Background of switch paddle. Default: $switch-paddle-bg.
193
+ // $positive-color - Background color of positive side of switch. Default: $switch-positive-color.
194
+ // $negative-color - Background color of negative side of switch. Default: $switch-negative-color.
195
+ // $radius - Radius to apply to switch. Default: false.
196
+ // $base-style - Apply base styles? Default: true.
197
+ @mixin switch-style(
198
+ $paddle-bg:$switch-paddle-bg,
199
+ $positive-color:$switch-positive-color,
200
+ $negative-color:$switch-negative-color,
201
+ $radius:false,
202
+ $base-style:true) {
203
+
204
+ @if $base-style {
205
+ background: $switch-bg;
206
+ border-color: $switch-border-color;
207
+
208
+ span:last-child {
209
+ border-color: darken($paddle-bg, 30%);
210
+ background: $paddle-bg;
211
+ @if $experimental {
212
+ background: -moz-linear-gradient(top, $paddle-bg 0%, darken($paddle-bg, 5%) 100%);
213
+ background: -webkit-linear-gradient(top, $paddle-bg 0%, darken($paddle-bg, 5%) 100%);
214
+ }
215
+ background: linear-gradient(to bottom, $paddle-bg 0%, darken($paddle-bg, 5%) 100%);
216
+
217
+ // Building the alternating colored sides of the switch
218
+ @if $experimental {
219
+ -webkit-box-shadow: 2px 0 10px 0 rgba(0,0,0,0.07),
220
+ 1000px 0 0 1000px $positive-color,
221
+ -2px 0 10px 0 rgba(0,0,0,0.07),
222
+ -1000px 0 0 1000px $negative-color;
223
+ }
224
+ box-shadow: 2px 0 10px 0 rgba(0,0,0,0.07),
225
+ 1000px 0 0 980px $positive-color,
226
+ -2px 0 10px 0 rgba(0,0,0,0.07),
227
+ -1000px 0 0 1000px $negative-color;
228
+ }
229
+
230
+ &:hover,
231
+ &:focus {
232
+ span:last-child {
233
+ background: $paddle-bg;
234
+ @if $experimental {
235
+ background: -moz-linear-gradient(top, $paddle-bg 0%, darken($paddle-bg, 10%) 100%);
236
+ background: -webkit-linear-gradient(top, $paddle-bg 0%, darken($paddle-bg, 10%) 100%);
237
+ }
238
+ background: linear-gradient(to bottom, $paddle-bg 0%, darken($paddle-bg, 10%) 100%);
239
+ }
240
+ }
241
+
242
+ &:active { background: transparent; }
243
+ }
244
+
245
+ // Setting up the radius for switches
246
+ @if $radius == true {
247
+ @include radius(4px);
248
+ span:last-child { @include radius(3px); }
249
+ }
250
+ @else if $radius {
251
+ @include radius($radius);
252
+ span:last-child { @include radius($radius - 1px); }
253
+ }
254
+
255
+ }
256
+
257
+ // We use this to quickly create switches with a single mixin
258
+ //
259
+ // $transition-speed - Time in ms for switch to toggle. Default: $switch-paddle-transition-speed.
260
+ // $transition-ease - Easing function to use for animation (i.e. ease-out). Default: $switch-paddle-transition-ease.
261
+ // $height - Height (in px) of the switch. Default: $switch-height-med.
262
+ // $font-size - Font size of text in switch. Default: $switch-font-size-med.
263
+ // $line-height - Line height of switch. Default: 2.3rem.
264
+ // $paddle-bg - Background of switch paddle. Default: $switch-paddle-bg.
265
+ // $positive-color - Background color of positive side of switch. Default: $switch-positive-color.
266
+ // $negative-color - Background color of negative side of switch. Default: $switch-negative-color.
267
+ // $radius - Radius to apply to switch. Default: false.
268
+ // $base-style - Apply base styles? Default: true.
269
+ @mixin switch(
270
+ $transition-speed: $switch-paddle-transition-speed,
271
+ $transition-ease: $switch-paddle-transition-ease,
272
+ $height: $switch-height-med,
273
+ $font-size: $switch-font-size-med,
274
+ $line-height: 2.3rem,
275
+ $paddle-bg: $switch-paddle-bg,
276
+ $positive-color: $switch-positive-color,
277
+ $negative-color: $switch-negative-color,
278
+ $radius:false,
279
+ $base-style:true) {
280
+ @include switch-base($transition-speed, $transition-ease);
281
+ @include switch-size($height, $font-size, $line-height);
282
+ @include switch-style($paddle-bg, $positive-color, $negative-color, $radius, $base-style);
283
+ }
284
+
285
+ @include exports("switch") {
286
+ @if $include-html-form-classes {
287
+ div.switch {
288
+ @include switch;
289
+
290
+ // Large radio switches
291
+ &.large { @include switch-size($switch-height-lrg, $switch-font-size-lrg); }
292
+
293
+ // Small radio switches
294
+ &.small { @include switch-size($switch-height-sml, $switch-font-size-sml, 2.1rem); }
295
+
296
+ // Tiny radio switches
297
+ &.tiny { @include switch-size($switch-height-tny, $switch-font-size-tny, 1.9rem); }
298
+
299
+ // Add a radius to the switch
300
+ &.radius { @include radius(4px);
301
+ span:last-child{ @include radius(3px); }
302
+ }
303
+
304
+ // Make the switch completely round, like a pill
305
+ &.round { @include radius(1000px);
306
+ span:last-child { @include radius(999px); }
307
+ label { padding: rem-calc(0 $switch-label-side-padding + 3); }
308
+ }
309
+
310
+ }
311
+
312
+ @if $experimental { @-webkit-keyframes webkitSiblingBugfix { from { position: relative; } to { position: relative; } } }
313
+ }
314
+ }