workarea-styled_selects 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +16 -0
  3. data/.eslintrc +25 -0
  4. data/.gitignore +19 -0
  5. data/.rails-rubocop.yml +119 -0
  6. data/.rubocop.yml +8 -0
  7. data/.scss-lint.yml +192 -0
  8. data/CHANGELOG.md +33 -0
  9. data/Gemfile +19 -0
  10. data/README.md +66 -0
  11. data/Rakefile +61 -0
  12. data/app/assets/stylesheets/workarea/styled_selects/components/_styled_select.scss +58 -0
  13. data/app/helpers/.keep +0 -0
  14. data/app/helpers/workarea/storefront/styled_select_helper.rb +11 -0
  15. data/app/views/workarea/storefront/style_guides/components/_styled_select.html.haml +13 -0
  16. data/bin/rails +20 -0
  17. data/config/initializers/appends.rb +6 -0
  18. data/config/initializers/workarea.rb +3 -0
  19. data/config/routes.rb +2 -0
  20. data/lib/tasks/styled_selects_tasks.rake +4 -0
  21. data/lib/workarea/styled_selects/engine.rb +12 -0
  22. data/lib/workarea/styled_selects/version.rb +5 -0
  23. data/lib/workarea/styled_selects.rb +11 -0
  24. data/script/admin_ci +9 -0
  25. data/script/ci +11 -0
  26. data/script/core_ci +9 -0
  27. data/script/plugins_ci +9 -0
  28. data/script/storefront_ci +9 -0
  29. data/test/dummy/Rakefile +6 -0
  30. data/test/dummy/app/assets/config/manifest.js +4 -0
  31. data/test/dummy/app/assets/images/.keep +0 -0
  32. data/test/dummy/app/assets/javascripts/application.js +13 -0
  33. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  34. data/test/dummy/app/controllers/application_controller.rb +3 -0
  35. data/test/dummy/app/controllers/concerns/.keep +0 -0
  36. data/test/dummy/app/helpers/application_helper.rb +2 -0
  37. data/test/dummy/app/jobs/application_job.rb +2 -0
  38. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  39. data/test/dummy/app/models/concerns/.keep +0 -0
  40. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  41. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  42. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  43. data/test/dummy/bin/bundle +3 -0
  44. data/test/dummy/bin/rails +4 -0
  45. data/test/dummy/bin/rake +4 -0
  46. data/test/dummy/bin/setup +38 -0
  47. data/test/dummy/bin/update +29 -0
  48. data/test/dummy/bin/yarn +11 -0
  49. data/test/dummy/config/application.rb +29 -0
  50. data/test/dummy/config/boot.rb +5 -0
  51. data/test/dummy/config/cable.yml +10 -0
  52. data/test/dummy/config/environment.rb +5 -0
  53. data/test/dummy/config/environments/development.rb +54 -0
  54. data/test/dummy/config/environments/production.rb +91 -0
  55. data/test/dummy/config/environments/test.rb +44 -0
  56. data/test/dummy/config/initializers/application_controller_renderer.rb +8 -0
  57. data/test/dummy/config/initializers/assets.rb +14 -0
  58. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  59. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  60. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  61. data/test/dummy/config/initializers/inflections.rb +16 -0
  62. data/test/dummy/config/initializers/mime_types.rb +4 -0
  63. data/test/dummy/config/initializers/workarea.rb +5 -0
  64. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  65. data/test/dummy/config/locales/en.yml +33 -0
  66. data/test/dummy/config/puma.rb +56 -0
  67. data/test/dummy/config/routes.rb +5 -0
  68. data/test/dummy/config/secrets.yml +32 -0
  69. data/test/dummy/config/spring.rb +6 -0
  70. data/test/dummy/config.ru +5 -0
  71. data/test/dummy/db/seeds.rb +2 -0
  72. data/test/dummy/lib/assets/.keep +0 -0
  73. data/test/dummy/log/.keep +0 -0
  74. data/test/dummy/package.json +5 -0
  75. data/test/system/workarea/storefront/styled_selects_system_test.rb +40 -0
  76. data/test/teaspoon_env.rb +6 -0
  77. data/test/test_helper.rb +10 -0
  78. data/workarea-styled_selects.gemspec +19 -0
  79. metadata +134 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 1b3a9639719e859f87d8755db2b65f902134d93e6e1959ac05a71a09b16c16b1
4
+ data.tar.gz: 69368adf4d17298675dc903ecd0ef2b9ac969071f7cd2b91f9e1a8f19fafc246
5
+ SHA512:
6
+ metadata.gz: de65e46944b4949510ae94256401e18e9aa02720a1c899df7596471846cf696551a0f6ddea00014943a28618f89c4bf8f7a2162dee17ed99612852da2b1425fc
7
+ data.tar.gz: 9504a19bfe83bad145694fffd3e6d49f95639c52441badb9259ed38a73c1d17f784393eea8d7cb718117a6b400fbcf8856ffaf2f1d2cc02e894414f03e4da50f
data/.editorconfig ADDED
@@ -0,0 +1,16 @@
1
+ # editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ charset = utf-8
6
+ indent_style = space
7
+ end_of_line = lf
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+
11
+ [{*.rb,*.haml,*.decorator}]
12
+ indent_size = 2
13
+ indent_style = space
14
+
15
+ [{*.js,*.jst,*.ejs,*.scss}]
16
+ indent_size = 4
data/.eslintrc ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "extends": "eslint:recommended",
3
+ "rules": {
4
+ "semi": ["error", "always"],
5
+ "eqeqeq": ["error", "always"]
6
+ },
7
+ "globals": {
8
+ "window": true,
9
+ "document": true,
10
+ "WORKAREA": true,
11
+ "$": true,
12
+ "jQuery": true,
13
+ "_": true,
14
+ "feature": true,
15
+ "JST": true,
16
+ "Turbolinks": true,
17
+ "I18n": true,
18
+ "Chart": true,
19
+ "Dropzone": true,
20
+ "strftime": true,
21
+ "Waypoint": true,
22
+ "wysihtml": true,
23
+ "LocalTime": true,
24
+ }
25
+ }
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/db/*.sqlite3-journal
6
+ test/dummy/log/*.log
7
+ test/dummy/tmp/
8
+ .DS_Store
9
+ .byebug_history
10
+ .bundle/
11
+ .sass-cache/
12
+ Gemfile.lock
13
+ pkg/
14
+ test/dummy/tmp/
15
+ test/dummy/public/
16
+ log/*.log
17
+ test/dummy/log/*.log
18
+ test/dummy/db/*.sqlite3
19
+ test/dummy/db/*.sqlite3-journal
@@ -0,0 +1,119 @@
1
+ AllCops:
2
+ # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
3
+ # to ignore them, so only the ones explicitly set in this file are enabled.
4
+ DisabledByDefault: true
5
+
6
+ # Prefer &&/|| over and/or.
7
+ Style/AndOr:
8
+ Enabled: true
9
+
10
+ # Do not use braces for hash literals when they are the last argument of a
11
+ # method call.
12
+ Style/BracesAroundHashParameters:
13
+ Enabled: true
14
+
15
+ # Align `when` with `case`.
16
+ Layout/CaseIndentation:
17
+ Enabled: true
18
+
19
+ # Align comments with method definitions.
20
+ Layout/CommentIndentation:
21
+ Enabled: true
22
+
23
+ # No extra empty lines.
24
+ Layout/EmptyLines:
25
+ Enabled: true
26
+
27
+ # In a regular class definition, no empty lines around the body.
28
+ Layout/EmptyLinesAroundClassBody:
29
+ Enabled: true
30
+
31
+ # In a regular method definition, no empty lines around the body.
32
+ Layout/EmptyLinesAroundMethodBody:
33
+ Enabled: true
34
+
35
+ # In a regular module definition, no empty lines around the body.
36
+ Layout/EmptyLinesAroundModuleBody:
37
+ Enabled: true
38
+
39
+ # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
40
+ Style/HashSyntax:
41
+ Enabled: true
42
+
43
+ # Method definitions after `private` or `protected` isolated calls need one
44
+ # extra level of indentation.
45
+ Layout/IndentationConsistency:
46
+ Enabled: true
47
+ EnforcedStyle: rails
48
+
49
+ # Two spaces, no tabs (for indentation).
50
+ Layout/IndentationWidth:
51
+ Enabled: true
52
+
53
+ Layout/SpaceAfterColon:
54
+ Enabled: true
55
+
56
+ Layout/SpaceAfterComma:
57
+ Enabled: true
58
+
59
+ Layout/SpaceAroundEqualsInParameterDefault:
60
+ Enabled: true
61
+
62
+ Layout/SpaceAroundKeyword:
63
+ Enabled: true
64
+
65
+ Layout/SpaceAroundOperators:
66
+ Enabled: true
67
+
68
+ Layout/SpaceBeforeFirstArg:
69
+ Enabled: true
70
+
71
+ # Defining a method with parameters needs parentheses.
72
+ Style/MethodDefParentheses:
73
+ Enabled: true
74
+
75
+ # Use `foo {}` not `foo{}`.
76
+ Layout/SpaceBeforeBlockBraces:
77
+ Enabled: true
78
+
79
+ # Use `foo { bar }` not `foo {bar}`.
80
+ Layout/SpaceInsideBlockBraces:
81
+ Enabled: true
82
+
83
+ # Use `{ a: 1 }` not `{a:1}`.
84
+ Layout/SpaceInsideHashLiteralBraces:
85
+ Enabled: true
86
+
87
+ Layout/SpaceInsideParens:
88
+ Enabled: true
89
+
90
+ # Check quotes usage according to lint rule below.
91
+ Style/StringLiterals:
92
+ Enabled: true
93
+ EnforcedStyle: double_quotes
94
+
95
+ # Detect hard tabs, no hard tabs.
96
+ Layout/Tab:
97
+ Enabled: true
98
+
99
+ # Blank lines should not have any spaces.
100
+ Layout/TrailingBlankLines:
101
+ Enabled: true
102
+
103
+ # No trailing whitespace.
104
+ Layout/TrailingWhitespace:
105
+ Enabled: true
106
+
107
+ # Use quotes for string literals when they are enough.
108
+ Style/UnneededPercentQ:
109
+ Enabled: true
110
+
111
+ # Align `end` with the matching keyword or starting expression except for
112
+ # assignments, where it should be aligned with the LHS.
113
+ Lint/EndAlignment:
114
+ Enabled: true
115
+ EnforcedStyleAlignWith: variable
116
+
117
+ # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
118
+ Lint/RequireParentheses:
119
+ Enabled: true
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ inherit_gem:
2
+ workarea-ci: rubocop.yml
3
+
4
+ AllCops:
5
+ Exclude:
6
+ - 'test/dummy/**/*'
7
+ - 'lib/styled_selects.rb'
8
+ - 'lib/styled_selects/**/*'
data/.scss-lint.yml ADDED
@@ -0,0 +1,192 @@
1
+ # Extension of the default configuration:
2
+ # https://github.com/causes/scss-lint/blob/master/config/default.yml
3
+
4
+ exclude: 'docs/**'
5
+
6
+ linters:
7
+ Comment:
8
+ enabled: false
9
+
10
+ DeclarationOrder:
11
+ enabled: true
12
+
13
+ ElsePlacement:
14
+ enabled: true
15
+
16
+ EmptyRule:
17
+ enabled: false
18
+
19
+ HexLength:
20
+ enabled: true
21
+ style: long
22
+
23
+ Indentation:
24
+ enabled: true
25
+ allow_non_nested_indentation: true
26
+ character: space
27
+ width: 4
28
+
29
+ LeadingZero:
30
+ enabled: true
31
+ style: include_zero
32
+
33
+ MergeableSelector:
34
+ enabled: true
35
+ force_nesting: false
36
+
37
+ PropertySortOrder:
38
+ enabled: true
39
+ ignore_unspecified: false
40
+ separate_groups: false
41
+ order:
42
+ - display
43
+ -
44
+ - position
45
+ - top
46
+ - right
47
+ - bottom
48
+ - left
49
+ - z-index
50
+ -
51
+ - margin
52
+ - margin-top
53
+ - margin-right
54
+ - margin-bottom
55
+ - margin-left
56
+ -
57
+ - margin-collapse
58
+ - margin-top-collapse
59
+ - margin-right-collapse
60
+ - margin-bottom-collapse
61
+ - margin-left-collapse
62
+ -
63
+ - padding
64
+ - padding-top
65
+ - padding-right
66
+ - padding-bottom
67
+ - padding-left
68
+ -
69
+ - width
70
+ - height
71
+ - max-width
72
+ - max-height
73
+ - min-width
74
+ - min-height
75
+ -
76
+ - float
77
+ - clear
78
+ -
79
+ - color
80
+ -
81
+ - font
82
+ - font-size
83
+ - font-style
84
+ - font-family
85
+ - font-weight
86
+ - font-variant
87
+ - font-smoothing
88
+ -
89
+ - line-height
90
+ - letter-spacing
91
+ - word-spacing
92
+ -
93
+ - text-align
94
+ - text-indent
95
+ - text-shadow
96
+ - text-overflow
97
+ - text-rendering
98
+ - text-transform
99
+ - text-decoration
100
+ - text-size-adjust
101
+ -
102
+ - word-break
103
+ - word-wrap
104
+ -
105
+ - white-space
106
+ -
107
+ - background
108
+ - background-size
109
+ - background-color
110
+ - background-image
111
+ - background-repeat
112
+ - background-position
113
+ - background-attachment
114
+ -
115
+ - border
116
+ - border-top
117
+ - border-right
118
+ - border-bottom
119
+ - border-left
120
+ -
121
+ - border-image
122
+ - border-spacing
123
+ - border-collapse
124
+ -
125
+ - border-color
126
+ - border-top-color
127
+ - border-right-color
128
+ - border-bottom-color
129
+ - border-left-color
130
+ -
131
+ - border-style
132
+ - border-top-style
133
+ - border-right-style
134
+ - border-bottom-style
135
+ - border-left-style
136
+ -
137
+ - border-width
138
+ - border-top-width
139
+ - border-right-width
140
+ - border-bottom-width
141
+ - border-left-width
142
+ -
143
+ - border-radius
144
+ - border-top-right-radius
145
+ - border-bottom-right-radius
146
+ - border-bottom-left-radius
147
+ - border-top-left-radius
148
+ - border-radius-topright
149
+ - border-radius-bottomright
150
+ - border-radius-bottomleft
151
+ - border-radius-topleft
152
+ -
153
+ - box-shadow
154
+
155
+ SelectorFormat:
156
+ enabled: true
157
+ convention: hyphenated_BEM
158
+
159
+ SingleLinePerSelector:
160
+ enabled: false
161
+
162
+ SpaceAfterPropertyColon:
163
+ enabled: true
164
+ style: at_least_one_space
165
+
166
+ SpaceBeforeBrace:
167
+ enabled: true
168
+ style: space
169
+ allow_single_line_padding: true
170
+
171
+ VariableForProperty:
172
+ enabled: true
173
+ properties:
174
+ - color
175
+ - font-family
176
+ - background-color
177
+
178
+ PseudoElement:
179
+ enabled: false
180
+
181
+ # These default settings may be problematic to implementors. They are not
182
+ # ommitted so that they may be adjusted as needed during an implementation.
183
+ #
184
+ # For documentation:
185
+ # https://github.com/causes/scss-lint/blob/master/lib/scss_lint/linter/README.md
186
+
187
+ DuplicateProperty:
188
+ enabled: true
189
+
190
+ PropertySpelling:
191
+ enabled: true
192
+ extra_properties: [] # Add experimental CSS to this array, if needed
data/CHANGELOG.md ADDED
@@ -0,0 +1,33 @@
1
+ Workarea Styled Selects 1.1.1 (2019-08-21)
2
+ --------------------------------------------------------------------------------
3
+
4
+ * Open Source!
5
+
6
+
7
+
8
+ Workarea Styled Selects 1.1.0 (2018-10-30)
9
+ --------------------------------------------------------------------------------
10
+
11
+ * Adds option for modifier
12
+
13
+ Create a parameter that allows a modifier to be passed into the styled select
14
+
15
+ STYLESELEC-4
16
+ Lucas Boyd
17
+
18
+
19
+
20
+ Workarea Styled Selects 1.0.1 (2018-04-25)
21
+ --------------------------------------------------------------------------------
22
+
23
+ Fixes duplicate ID errors in styleguide
24
+
25
+ STYLESELEC-3
26
+ Jake Beresford
27
+
28
+
29
+
30
+ Workarea Styled Selects 1.0.0 (2018-02-01)
31
+ --------------------------------------------------------------------------------
32
+
33
+ Easily customize the styling of the <select> input type in a workarea application
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "https://rubygems.org"
2
+
3
+ # Declare your gem's dependencies in styled_selects.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
6
+ gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use a debugger
14
+ # gem 'byebug', group: [:development, :test]
15
+
16
+ gem "workarea", source: "https://gems.weblinc.com"
17
+ group :test do
18
+ gem "workarea-testing", source: "https://gems.weblinc.com"
19
+ end
data/README.md ADDED
@@ -0,0 +1,66 @@
1
+ Workarea Styled Selects
2
+ ================================================================================
3
+
4
+ Styled Selects plugin for the Workarea platform.
5
+
6
+ This plugin adds a necessary styling hook for select inputs, along with a basic stylesheet to help
7
+ jump-start styling the select elements within your application.
8
+
9
+ Installing this plugin will override the select_tag haml helped, wrapping it in a content tag with the .styled-select class.
10
+
11
+ Any select tags created by any means other than the select_tag helper, for example using a JST or %select will not automatically recieve styles from this plugin. In order to style those elements you will need to update the relevant view files to wrap the select in
12
+
13
+ <div class="styled-select">
14
+ # Your existing markup here
15
+ </div>
16
+
17
+ Some default styles have been included in this plugin, however it is expected that you will need to override the stylesheet to update these styles to match your design, you can do this using the following override generator command
18
+
19
+ bundle exec rails g workarea:override stylesheets workarea/styled_selects/components/_styled_select.scss
20
+
21
+ Getting Started
22
+ --------------------------------------------------------------------------------
23
+
24
+ This gem contains a rails engine that must be mounted onto a host Rails application.
25
+
26
+ To access Workarea gems and source code, you must be an employee of WebLinc or a licensed retailer or partner.
27
+
28
+ Workarea gems are hosted privately at https://gems.weblinc.com/.
29
+ You must have individual or team credentials to install gems from this server. Add your gems server credentials to Bundler:
30
+
31
+ bundle config gems.weblinc.com my_username:my_password
32
+
33
+ Or set the appropriate environment variable in a shell startup file:
34
+
35
+ export BUNDLE_GEMS__WEBLINC__COM='my_username:my_password'
36
+
37
+ Then add the gem to your application's Gemfile specifying the source:
38
+
39
+ # ...
40
+ gem 'workarea-styled_selects', source: 'https://gems.weblinc.com'
41
+ # ...
42
+
43
+ Or use a source block:
44
+
45
+ # ...
46
+ source 'https://gems.weblinc.com' do
47
+ gem 'workarea-styled_selects'
48
+ end
49
+ # ...
50
+
51
+ Update your application's bundle.
52
+
53
+ cd path/to/application
54
+ bundle
55
+
56
+ Workarea Platform Documentation
57
+ --------------------------------------------------------------------------------
58
+
59
+ See [http://developer.weblinc.com](http://developer.weblinc.com) for Workarea platform documentation.
60
+
61
+ Copyright & Licensing
62
+ --------------------------------------------------------------------------------
63
+
64
+ Copyright WebLinc 2018. All rights reserved.
65
+
66
+ For licensing, contact sales@workarea.com.
data/Rakefile ADDED
@@ -0,0 +1,61 @@
1
+ begin
2
+ require "bundler/setup"
3
+ rescue LoadError
4
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
5
+ end
6
+
7
+ require "rdoc/task"
8
+ RDoc::Task.new(:rdoc) do |rdoc|
9
+ rdoc.rdoc_dir = "rdoc"
10
+ rdoc.title = "Styled Selects"
11
+ rdoc.options << "--line-numbers"
12
+ rdoc.rdoc_files.include("README.md")
13
+ rdoc.rdoc_files.include("lib/**/*.rb")
14
+ end
15
+
16
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
17
+ load "rails/tasks/engine.rake"
18
+ load "rails/tasks/statistics.rake"
19
+ load "workarea/changelog.rake"
20
+
21
+ require "rake/testtask"
22
+
23
+ Rake::TestTask.new(:test) do |t|
24
+ t.libs << "lib"
25
+ t.libs << "test"
26
+ t.pattern = "test/**/*_test.rb"
27
+ t.verbose = false
28
+ end
29
+ task default: :test
30
+
31
+ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
32
+ require "workarea/styled_selects/version"
33
+
34
+ desc "Release version #{Workarea::StyledSelects::VERSION} of the gem"
35
+ task :release do
36
+ host = "https://#{ENV['BUNDLE_GEMS__WEBLINC__COM']}@gems.weblinc.com"
37
+
38
+ #Rake::Task['workarea:changelog'].execute
39
+ #system 'git add CHANGELOG.md'
40
+ #system 'git commit -m "Update CHANGELOG"'
41
+ #system 'git push origin HEAD'
42
+
43
+ system "git tag -a v#{Workarea::StyledSelects::VERSION} -m 'Tagging #{Workarea::StyledSelects::VERSION}'"
44
+ system "git push --tags"
45
+
46
+ system "gem build workarea-styled_selects.gemspec"
47
+ system "gem push workarea-styled_selects-#{Workarea::StyledSelects::VERSION}.gem"
48
+ system "gem push workarea-styled_selects-#{Workarea::StyledSelects::VERSION}.gem --host #{host}"
49
+ system "rm workarea-styled_selects-#{Workarea::StyledSelects::VERSION}.gem"
50
+ end
51
+
52
+ desc "Run the JavaScript tests"
53
+ ENV["TEASPOON_RAILS_ENV"] = File.expand_path("../test/dummy/config/environment", __FILE__)
54
+ task teaspoon: "app:teaspoon"
55
+
56
+ desc "Start a server at http://localhost:3000/teaspoon for JavaScript tests"
57
+ task :teaspoon_server do
58
+ Dir.chdir("test/dummy")
59
+ teaspoon_env = File.expand_path("../test/teaspoon_env.rb", __FILE__)
60
+ system "RAILS_ENV=test TEASPOON_ENV=#{teaspoon_env} rails s"
61
+ end
@@ -0,0 +1,58 @@
1
+ /*------------------------------------*\
2
+ #SELECT-MENU
3
+ \*------------------------------------*/
4
+
5
+ $select-menu-color: $black !default;
6
+ $select-menu-bg-color: $background-color !default;
7
+ $select-menu-border-color: $black !default;
8
+ $select-menu-border-radius: 5px !default;
9
+
10
+ $select-menu-arrow-size: 10px !default;
11
+ $select-menu-arrow-width: $spacing-unit * 5 !default;
12
+ $select-menu-arrow-color: $black !default;
13
+ $select-menu-arrow-bg-color: $background-color !default;
14
+
15
+
16
+ /**
17
+ * 1. Positioning context for before pseudo element
18
+ */
19
+ .styled-select {
20
+ position: relative; /* [1] */
21
+
22
+ &:before {
23
+ @include center($to: vertical);
24
+ right: 1px;
25
+ bottom: 0;
26
+ padding-top: $spacing-unit / 2;
27
+ width: $select-menu-arrow-width;
28
+ color: $select-menu-arrow-color;
29
+ font-size: $select-menu-arrow-size;
30
+ text-align: center;
31
+ background-color: $select-menu-arrow-bg-color;
32
+ border-left: 1px solid $select-menu-border-color;
33
+ content: '▼';
34
+ pointer-events: none;
35
+ }
36
+
37
+ /**
38
+ * 1. Prevent chrome applying yellow background on autofill.
39
+ */
40
+ select:-webkit-autofill {
41
+ box-shadow: 0 0 0 30px $select-menu-arrow-bg-color inset; /* [1] */
42
+ }
43
+
44
+ select {
45
+ padding: $spacing-unit ($spacing-unit * 2);
46
+ padding-right: ($spacing-unit * 2) + $select-menu-arrow-width;
47
+ width: 100%;
48
+ color: $select-menu-color;
49
+ background-color: $select-menu-bg-color;
50
+ border: 1px solid $select-menu-border-color;
51
+ border-radius: $select-menu-border-radius;
52
+ appearance: none;
53
+
54
+ &::-ms-expand {
55
+ display: none;
56
+ }
57
+ }
58
+ }
data/app/helpers/.keep ADDED
File without changes
@@ -0,0 +1,11 @@
1
+ module Workarea
2
+ module Storefront
3
+ module StyledSelectHelper
4
+ def select_tag(name, option_tags = nil, options = {})
5
+ classes = ['styled-select']
6
+ classes << options.delete(:modifier)
7
+ content_tag :div, super, class: classes.compact.join(' ')
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ #styled-select.style-guide__subsection
2
+
3
+ %h3= link_to_style_guide('components', 'styled_select')
4
+
5
+ %p Provides a stylized select menu UI
6
+ %p The select_tag helper is decorated to automatically wrap most select tags in your application. You will need to update the markup of select tags injected as JST templates
7
+
8
+ .style-guide__example-block
9
+ = select_tag "style-guide-example", options_for_select([ "Option 1", "Option 2", "Option 3" ], "Option 1")
10
+
11
+ %p should allow the optional passing of a modifier
12
+ .style-guide__example-block
13
+ = select_tag "style-guide-example-modified", options_for_select([ "Option 1", "Option 2", "Option 3" ], "Option 1"), modifier: 'styled-select--modified'
data/bin/rails ADDED
@@ -0,0 +1,20 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails gems
3
+ # installed from the root of your application.
4
+
5
+ ENGINE_ROOT = File.expand_path("../..", __FILE__)
6
+ ENGINE_PATH = File.expand_path("../../lib/styled_selects/engine", __FILE__)
7
+ APP_PATH = File.expand_path("../../test/dummy/config/application", __FILE__)
8
+
9
+ # Set up gems listed in the Gemfile.
10
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__)
11
+ require "bundler/setup" if File.exist?(ENV["BUNDLE_GEMFILE"])
12
+
13
+ require "action_controller/railtie"
14
+ require "action_view/railtie"
15
+ require "action_mailer/railtie"
16
+ require "rails/test_unit/railtie"
17
+ require "sprockets/railtie"
18
+ require "teaspoon-mocha"
19
+
20
+ require "rails/engine/commands"
@@ -0,0 +1,6 @@
1
+ module Workarea
2
+ Plugin.append_stylesheets(
3
+ "storefront.components",
4
+ "workarea/styled_selects/components/styled_select"
5
+ )
6
+ end
@@ -0,0 +1,3 @@
1
+ Workarea.configure do |config|
2
+ # Add custom configuration here
3
+ end