hintcss-rails 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 153e19a3ea0927d7628de00cd158f0682dd1f4f3
4
+ data.tar.gz: 44e7ccc8ec2996b899d1acafd7abe1635c466977
5
+ SHA512:
6
+ metadata.gz: c109263e8e5f0f8a6bb3ce8e57830bcf7d45ee11ab1b81c25edff7cf61ed7327ffe1da73373d19b4dd8a7d174e193baa71036db79fd7ae78eb08010b6d9d3a14
7
+ data.tar.gz: 202ed2d6537388e57a0f089354098d10b358dab7b4f8b82c29f77c251ea0afff1dfe358208eef3a22edf07260751abe1d20348e016b9a0aca66f06bb2d9373ed
@@ -0,0 +1,14 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ Gemfile.lock
6
+ InstalledFiles
7
+ doc/
8
+ lib/bundler/man
9
+ pkg
10
+ rdoc
11
+ spec/reports
12
+ test/tmp
13
+ test/version_tmp
14
+ tmp
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 1.9.3
4
+ - 2.0.0
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hintcss-rails.gemspec
4
+ gemspec
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Wilkin Novo
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # Hintcss-Rails
2
+
3
+ A tooltip library in CSS for your lovely websites
4
+
5
+ hint.css is written as a pure CSS resource using which you can create cool tooltips for your web app. It does not rely on JavaScript and rather uses data-* attribute, pseudo elements, content property and CSS3 transitions to create the tooltips. Also it uses BEM naming convention particularly for the modifiers.
6
+
7
+ Demo: http://kushagragour.in/lab/hint
8
+
9
+ The hintcss-rails project integrates Hint CSS v1.3.0 tooltip with the Rails' Asset Pipeline
10
+
11
+ **Current hintcss version = this gem's version
12
+
13
+ [![Build Status](https://travis-ci.org/wilkinn/hintcss-rails.png?branch=master)](https://travis-ci.org/wilkinn/hintcss-rails)
14
+
15
+ # Installation
16
+
17
+
18
+ Inside your Gemfile add the following line:
19
+
20
+ ```ruby
21
+ group :assets do
22
+ gem 'hintcss-rails'
23
+ end
24
+ ```
25
+
26
+ Then run `bundle install` to install the gem.
27
+
28
+ ## What now?
29
+
30
+ ```bash
31
+ $ rails g hintcss:install
32
+ ```
33
+
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create new Pull Request
@@ -0,0 +1,7 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ desc "Bundle the gem"
4
+ task :bundle do
5
+ sh 'bundle install'
6
+ end
7
+ task :default => :bundle
@@ -0,0 +1,33 @@
1
+ /**
2
+ * source: hint-always.scss
3
+ *
4
+ * Defines a persisted tooltip which shows always.
5
+ *
6
+ * Classes added:
7
+ * 1) hint--always
8
+ *
9
+ */
10
+
11
+ .hint--always {
12
+ &:after, &:before {
13
+ opacity: 1;
14
+ visibility: visible;
15
+ }
16
+
17
+ &.hint--top {
18
+ @include set-margin('translateY', -1);
19
+ }
20
+
21
+ &.hint--bottom {
22
+ @include set-margin('translateY', 1);
23
+ }
24
+
25
+ &.hint--left {
26
+ @include set-margin('translateX', -1);
27
+ }
28
+
29
+ &.hint--right {
30
+ @include set-margin('translateX', 1);
31
+ }
32
+ }
33
+
@@ -0,0 +1,52 @@
1
+ /**
2
+ * source: hint-color-types.scss
3
+ *
4
+ * Contains tooltips of various types based on color differences.
5
+ *
6
+ * Classes added:
7
+ * 1) hint--error
8
+ * 2) hint--warning
9
+ * 3) hint--info
10
+ * 4) hint--success
11
+ *
12
+ */
13
+
14
+
15
+ // mixin to generate different color style tooltips
16
+ @mixin hint-type($color) {
17
+ &:after {
18
+ background-color: $color;
19
+ text-shadow: 0 -1px 0px darken($color, $textShadowDarkenAmount);
20
+ }
21
+
22
+ // generate arrow color style
23
+ @include arrow-border-color($color);
24
+ }
25
+
26
+ /**
27
+ * Error
28
+ */
29
+ .hint--error {
30
+ @include hint-type($errorColor);
31
+ }
32
+
33
+ /**
34
+ * Warning
35
+ */
36
+ .hint--warning {
37
+ @include hint-type($warningColor)
38
+ }
39
+
40
+ /**
41
+ * Info
42
+ */
43
+ .hint--info {
44
+ @include hint-type($infoColor)
45
+ }
46
+
47
+ /**
48
+ * Success
49
+ */
50
+ .hint--success {
51
+ @include hint-type($successColor)
52
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * source: hint-core.scss
3
+ *
4
+ * Defines the basic styling for the tooltip.
5
+ * Each tooltip is made of 2 parts:
6
+ * 1) body (:after)
7
+ * 2) arrow (:before)
8
+ *
9
+ * Classes added:
10
+ * 1) hint
11
+ */
12
+
13
+ .hint, [data-hint] {
14
+ position: relative;
15
+ display: inline-block;
16
+
17
+ &:before, &:after {
18
+ position: absolute;
19
+
20
+ // HACK: Trigger hardware accelerated rendering, otherwise transform was not
21
+ // working on a hidden element
22
+ -webkit-transform: translate3d(0, 0, 0);
23
+ -moz-transform: translate3d(0, 0, 0);
24
+ transform: translate3d(0, 0, 0);
25
+
26
+ // HACK: visibility is set to hidden because IE & Opera don't support
27
+ // pointer-events on HTML content yet because of which hovering a hidden tooltip
28
+ // shows the tooltip.
29
+ visibility: hidden;
30
+ opacity: 0;
31
+ z-index: $zIndex;
32
+ // shouldn't receive pointer events, otherwise even hovering tooltip will make it appear
33
+ pointer-events: none;
34
+
35
+ -webkit-transition: 0.3s ease;
36
+ -moz-transition: 0.3s ease;
37
+ transition: 0.3s ease;
38
+ }
39
+
40
+ &:hover:before, &:hover:after,
41
+ &:focus:before, &:focus:after {
42
+ visibility: visible;
43
+ opacity: 1;
44
+ }
45
+
46
+ /**
47
+ * tooltip arrow
48
+ */
49
+ &:before {
50
+ content: '';
51
+ position: absolute;
52
+ background: transparent;
53
+ border: $arrowBorderWidth solid transparent;
54
+ // move z-index 1 up than :after so that it shows over box-shadow
55
+ z-index: 1000001;
56
+ }
57
+
58
+ /**
59
+ * tooltip body
60
+ */
61
+ &:after {
62
+ content: attr(data-hint);
63
+ background: $defaultColor;
64
+ color: white;
65
+ text-shadow: 0 -1px 0px darken($defaultColor, $textShadowDarkenAmount);
66
+ padding: 8px 10px;
67
+ font-size: 12px;
68
+ line-height: 12px;
69
+ white-space: nowrap;
70
+ box-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);
71
+ }
72
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * source: hint-effects.scss
3
+ *
4
+ * Defines various transition effects for the tooltips.
5
+ *
6
+ * Classes added:
7
+ * 1) hint--bounce
8
+ *
9
+ */
10
+
11
+ .hint--bounce {
12
+ &:before, &:after {
13
+ -webkit-transition: opacity 0.3s ease, visibility 0.3s ease, -webkit-transform 0.3s cubic-bezier(.71,1.7,.77,1.24);
14
+ -moz-transition: opacity 0.3s ease, visibility 0.3s ease, -moz-transform 0.3s cubic-bezier(.71,1.7,.77,1.24);
15
+ transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s cubic-bezier(.71,1.7,.77,1.24);
16
+ }
17
+ }
@@ -0,0 +1,32 @@
1
+ // hint-mixins.scss
2
+ //
3
+ // Place to store common mixins.
4
+
5
+
6
+ // Generates border-color rules for all 4 positions
7
+ @mixin arrow-border-color($color, $isInsideSelector: "true") {
8
+ @each $position in top, bottom, left, right {
9
+ // if the current mixin is called from within a selector, use a '&'. Otherwise not.
10
+ @if $isInsideSelector == "true" {
11
+ &.hint--#{$position}:before {
12
+ border-#{$position}-color: $color;
13
+ }
14
+ }
15
+ @else {
16
+ .hint--#{$position}:before {
17
+ border-#{$position}-color: $color;
18
+ }
19
+ }
20
+ }
21
+ }
22
+
23
+
24
+ // mixin to set margin on tooltip using translate transform
25
+ @mixin set-margin($property, $transitionDirection) {
26
+ $value: unquote("#{$property}(#{$transitionDistance * $transitionDirection})");
27
+ &:after, &:before {
28
+ -webkit-transform: $value;
29
+ -moz-transform: $value;
30
+ transform: $value;
31
+ }
32
+ }
@@ -0,0 +1,89 @@
1
+ /**
2
+ * source: hint-position.scss
3
+ *
4
+ * Defines the positoning logic for the tooltips.
5
+ *
6
+ * Classes added:
7
+ * 1) hint--top
8
+ * 2) hint--bottom
9
+ * 3) hint--left
10
+ * 4) hint--right
11
+ */
12
+
13
+ @mixin vertical-positioned-tooltip($propertyY, $transitionDirection) {
14
+ &:before {
15
+ // get the arrow out
16
+ margin-#{$propertyY}: -2 * $arrowBorderWidth;
17
+ }
18
+
19
+ &:after {
20
+ // bring back the tooltip by some offset so that arrow doesn't stick at end
21
+ margin-left: -1 * $arrowOffsetX;
22
+ }
23
+
24
+ &:before, &:after {
25
+ #{$propertyY}: 100%;
26
+ left: 50%;
27
+ }
28
+
29
+ &:hover, &:focus {
30
+ @include set-margin('translateY', $transitionDirection);
31
+ }
32
+ }
33
+
34
+ @mixin horizontal-positioned-tooltip($propertyX, $transitionDirection) {
35
+ &:before {
36
+ // get the arrow out
37
+ margin-#{$propertyX}: -2 * $arrowBorderWidth;
38
+ // bring back to center
39
+ margin-bottom: -1 * $arrowBorderWidth;
40
+ }
41
+
42
+ &:after {
43
+ // bring back to center
44
+ margin-bottom: -1 * floor($tooltipHeight / 2);
45
+ }
46
+
47
+ &:before, &:after {
48
+ #{$propertyX}: 100%;
49
+ bottom: 50%;
50
+ }
51
+
52
+ &:hover, &:focus {
53
+ @include set-margin('translateX', $transitionDirection);
54
+ }
55
+ }
56
+
57
+
58
+ /**
59
+ * set default color for tooltip arrows
60
+ */
61
+ @include arrow-border-color($defaultColor, 'false');
62
+
63
+ /**
64
+ * top tooltip
65
+ */
66
+ .hint--top {
67
+ @include vertical-positioned-tooltip('bottom', -1);
68
+ }
69
+
70
+ /**
71
+ * bottom tooltip
72
+ */
73
+ .hint--bottom {
74
+ @include vertical-positioned-tooltip('top', 1);
75
+ }
76
+
77
+ /**
78
+ * right tooltip
79
+ */
80
+ .hint--right {
81
+ @include horizontal-positioned-tooltip('left', 1);
82
+ }
83
+
84
+ /**
85
+ * left tooltip
86
+ */
87
+ .hint--left {
88
+ @include horizontal-positioned-tooltip('right', -1);
89
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * source: hint-rounded.scss
3
+ *
4
+ * Defines rounded corner tooltips.
5
+ *
6
+ * Classes added:
7
+ * 1) hint--rounded
8
+ *
9
+ */
10
+
11
+ .hint--rounded {
12
+ &:after {
13
+ border-radius: 4px;
14
+ }
15
+ }
@@ -0,0 +1,39 @@
1
+ // hint-variables.scss
2
+ //
3
+ // Declares some variables used within the library.
4
+
5
+
6
+ // default tooltip height
7
+ $tooltipHeight: 28px !default;
8
+
9
+ // border-width for tooltip arrow
10
+ $arrowBorderWidth: 6px !default;
11
+
12
+ // horizontal arrow offset
13
+ $arrowOffsetX: 3 * $arrowBorderWidth !default;
14
+
15
+ // text-shadow darken percentage
16
+ $textShadowDarkenAmount: 25% !default;
17
+
18
+ // transition distance
19
+ $transitionDistance: 8px !default;
20
+
21
+ // z-index for tooltips
22
+ $zIndex: 1000000 !default;
23
+
24
+
25
+ // Various colors
26
+ // Default color is blackish
27
+ $defaultColor: hsl(0, 0%, 22%) !default;
28
+
29
+ // Error color
30
+ $errorColor: hsl(1, 40%, 50%) !default;
31
+
32
+ // Warning color
33
+ $warningColor: hsl(38, 46%, 54%) !default;
34
+
35
+ // Info Color
36
+ $infoColor: hsl(200, 50%, 45%) !default;
37
+
38
+ // Success Color
39
+ $successColor: hsl(121, 32%, 40%) !default;
@@ -0,0 +1,24 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hintcss-rails/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "hintcss-rails"
8
+ spec.version = Hintcss::VERSION
9
+ spec.authors = ["Wilkin Novo"]
10
+ spec.email = ["novos100@gmail.com"]
11
+ spec.homepage = "https://github.com/wilkinn/hintcss-rails"
12
+ spec.description = %q{A tooltip library in CSS for your lovely websites}
13
+ spec.summary = %q{The hintcss-rails project integrates Hintcss tooltip with the Rails' Asset Pipeline}
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_dependency("railties", ">= 3.2.6", "< 5")
22
+ spec.add_development_dependency "bundler", "~> 1.3"
23
+ spec.add_development_dependency "rake"
24
+ end
@@ -0,0 +1,7 @@
1
+ require 'rails'
2
+ require 'hintcss-rails/version'
3
+ require 'hintcss-rails/generators/install_generator'
4
+
5
+ module Hintcss
6
+ require 'hintcss-rails/engine'
7
+ end
@@ -0,0 +1,4 @@
1
+ module Hintcss
2
+ class Engine < ::Rails::Engine
3
+ end
4
+ end
@@ -0,0 +1,8 @@
1
+ /*
2
+ * This is a manifest file that'll automatically include all the stylesheets available in this directory
3
+ * and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
4
+ * the top of the compiled file, but it's generally better to create a new file per style scope.
5
+ *= require_self
6
+ *= require hintcss
7
+ *= require_tree .
8
+ */
@@ -0,0 +1,8 @@
1
+ @import "hintcss/hint-variables";
2
+ @import "hintcss/hint-mixins";
3
+ @import "hintcss/hint-core";
4
+ @import "hintcss/hint-position";
5
+ @import "hintcss/hint-color-types";
6
+ @import "hintcss/hint-always";
7
+ @import "hintcss/hint-rounded";
8
+ @import "hintcss/hint-effects";
@@ -0,0 +1,32 @@
1
+ require 'rails/generators'
2
+
3
+ module Hintcss
4
+ module Generators
5
+ class InstallGenerator < ::Rails::Generators::Base
6
+ source_root File.expand_path("../includes/", __FILE__)
7
+ argument :stylesheets_type, :type => :string, :default => 'src'
8
+
9
+
10
+ def add_hintcss
11
+ copy_stylesheet(stylesheets_type)
12
+
13
+ css_manifest = 'app/assets/stylesheets/application.css'
14
+ if File.exist?(css_manifest)
15
+ style_require_block = " *= require hintcss\n"
16
+ insert_into_file css_manifest, style_require_block, :after => "require_self\n"
17
+ else
18
+ copy_file "application.css", "app/assets/stylesheets/application.css"
19
+ end
20
+ end
21
+
22
+ private
23
+ def copy_stylesheet(type)
24
+ if type == 'src'
25
+ copy_file "#{stylesheets_type}.css.scss", "app/assets/stylesheets/hintcss.css.scss"
26
+ else
27
+ raise "You must have supplied a wrong command:("
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,3 @@
1
+ module Hintcss
2
+ VERSION = "1.3.0"
3
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hintcss-rails
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.0
5
+ platform: ruby
6
+ authors:
7
+ - Wilkin Novo
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: railties
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: 3.2.6
20
+ - - <
21
+ - !ruby/object:Gem::Version
22
+ version: '5'
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.6
30
+ - - <
31
+ - !ruby/object:Gem::Version
32
+ version: '5'
33
+ - !ruby/object:Gem::Dependency
34
+ name: bundler
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ~>
38
+ - !ruby/object:Gem::Version
39
+ version: '1.3'
40
+ type: :development
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: '1.3'
47
+ - !ruby/object:Gem::Dependency
48
+ name: rake
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - '>='
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ description: A tooltip library in CSS for your lovely websites
62
+ email:
63
+ - novos100@gmail.com
64
+ executables: []
65
+ extensions: []
66
+ extra_rdoc_files: []
67
+ files:
68
+ - .gitignore
69
+ - .travis.yml
70
+ - Gemfile
71
+ - LICENSE.txt
72
+ - README.md
73
+ - Rakefile
74
+ - app/assets/stylesheets/hintcss/hint-always.scss
75
+ - app/assets/stylesheets/hintcss/hint-color-types.scss
76
+ - app/assets/stylesheets/hintcss/hint-core.scss
77
+ - app/assets/stylesheets/hintcss/hint-effects.scss
78
+ - app/assets/stylesheets/hintcss/hint-mixins.scss
79
+ - app/assets/stylesheets/hintcss/hint-position.scss
80
+ - app/assets/stylesheets/hintcss/hint-rounded.scss
81
+ - app/assets/stylesheets/hintcss/hint-variables.scss
82
+ - hintcss-rails.gemspec
83
+ - lib/hintcss-rails.rb
84
+ - lib/hintcss-rails/engine.rb
85
+ - lib/hintcss-rails/generators/includes/application.css
86
+ - lib/hintcss-rails/generators/includes/src.css.scss
87
+ - lib/hintcss-rails/generators/install_generator.rb
88
+ - lib/hintcss-rails/version.rb
89
+ homepage: https://github.com/wilkinn/hintcss-rails
90
+ licenses:
91
+ - MIT
92
+ metadata: {}
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - '>='
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.0.3
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: The hintcss-rails project integrates Hintcss tooltip with the Rails' Asset
113
+ Pipeline
114
+ test_files: []