docks_theme_api 1.0.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 (237) hide show
  1. checksums.yaml +15 -0
  2. data/.babelrc +4 -0
  3. data/.editorconfig +8 -0
  4. data/.eslintrc +115 -0
  5. data/.gitignore +24 -0
  6. data/.rubocop.yml +20 -0
  7. data/.travis.yml +16 -0
  8. data/Gemfile +4 -0
  9. data/README.md +5 -0
  10. data/Rakefile +3 -0
  11. data/assets/images/icons.svg +63 -0
  12. data/assets/scripts/coffeescript/pattern_library_helpers.coffee +8 -0
  13. data/assets/scripts/javascript/pattern_library_helpers.js +11 -0
  14. data/assets/scripts/pattern_library.js +10380 -0
  15. data/assets/scripts/pattern_library_demo.js +0 -0
  16. data/assets/styles/less/pattern-library-helpers.less +103 -0
  17. data/assets/styles/pattern-library-demo.css +1882 -0
  18. data/assets/styles/pattern-library.css +1882 -0
  19. data/assets/styles/sass/pattern-library-helpers.sass +90 -0
  20. data/assets/styles/scss/pattern-library-helpers.scss +99 -0
  21. data/assets/styles/stylus/pattern-library-helpers.styl +90 -0
  22. data/assets/templates/erb/demo.erb +26 -0
  23. data/assets/templates/erb/layouts/demo.erb +17 -0
  24. data/assets/templates/erb/layouts/pattern.erb +76 -0
  25. data/assets/templates/erb/partials/sidebar.erb +124 -0
  26. data/assets/templates/erb/partials/symbols/class.erb +1 -0
  27. data/assets/templates/erb/partials/symbols/demo.erb +40 -0
  28. data/assets/templates/erb/partials/symbols/factory.erb +70 -0
  29. data/assets/templates/erb/partials/symbols/function.erb +103 -0
  30. data/assets/templates/erb/partials/symbols/mixin.erb +62 -0
  31. data/assets/templates/erb/partials/symbols/variable.erb +59 -0
  32. data/assets/templates/erb/pattern.erb +102 -0
  33. data/assets/templates/haml/demo.haml +14 -0
  34. data/assets/templates/haml/layouts/demo.haml +6 -0
  35. data/assets/templates/haml/layouts/pattern.haml +38 -0
  36. data/assets/templates/haml/partials/sidebar.haml +68 -0
  37. data/assets/templates/haml/partials/symbols/class.haml +1 -0
  38. data/assets/templates/haml/partials/symbols/demo.haml +23 -0
  39. data/assets/templates/haml/partials/symbols/factory.haml +38 -0
  40. data/assets/templates/haml/partials/symbols/function.haml +54 -0
  41. data/assets/templates/haml/partials/symbols/mixin.haml +31 -0
  42. data/assets/templates/haml/partials/symbols/variable.haml +22 -0
  43. data/assets/templates/haml/pattern.haml +54 -0
  44. data/assets/templates/slim/demo.slim +24 -0
  45. data/assets/templates/slim/layouts/demo.slim +5 -0
  46. data/assets/templates/slim/layouts/pattern.slim +48 -0
  47. data/assets/templates/slim/partials/sidebar.slim +112 -0
  48. data/assets/templates/slim/partials/symbols/class.slim +1 -0
  49. data/assets/templates/slim/partials/symbols/demo.slim +30 -0
  50. data/assets/templates/slim/partials/symbols/factory.slim +57 -0
  51. data/assets/templates/slim/partials/symbols/function.slim +81 -0
  52. data/assets/templates/slim/partials/symbols/mixin.slim +45 -0
  53. data/assets/templates/slim/partials/symbols/variable.slim +35 -0
  54. data/assets/templates/slim/pattern.slim +63 -0
  55. data/docks_config.rb +32 -0
  56. data/docks_theme_api.gemspec +37 -0
  57. data/gulpfile.js +88 -0
  58. data/karma.conf.js +6 -0
  59. data/lib/docks_theme_api/components/base_component.rb +99 -0
  60. data/lib/docks_theme_api/components/code_block_component.rb +10 -0
  61. data/lib/docks_theme_api/components/popover_component.rb +15 -0
  62. data/lib/docks_theme_api/components/table_component.rb +34 -0
  63. data/lib/docks_theme_api/components/tablist_component.rb +11 -0
  64. data/lib/docks_theme_api/components.rb +21 -0
  65. data/lib/docks_theme_api/helpers/ui_helper.rb +69 -0
  66. data/lib/docks_theme_api/theme.rb +21 -0
  67. data/lib/docks_theme_api.rb +1 -0
  68. data/package.json +60 -0
  69. data/source/behaviors/filterable/filterable.coffee +353 -0
  70. data/source/behaviors/filterable/filterable.js +0 -0
  71. data/source/behaviors/filterable/filterable.scss +34 -0
  72. data/source/behaviors/filterable/package.json +3 -0
  73. data/source/behaviors/index.js +0 -0
  74. data/source/components/avatar/avatar.erb +20 -0
  75. data/source/components/avatar/avatar.js +142 -0
  76. data/source/components/avatar/avatar.scss +200 -0
  77. data/source/components/avatar/avatar_container.erb +13 -0
  78. data/source/components/avatar/package.json +3 -0
  79. data/source/components/avatar/spec/avatar_spec.js +81 -0
  80. data/source/components/badge/badge.scss +158 -0
  81. data/source/components/button/button.scss +213 -0
  82. data/source/components/card/card.scss +32 -0
  83. data/source/components/code_block/code-block.scss +353 -0
  84. data/source/components/code_block/code_block.erb +95 -0
  85. data/source/components/code_block/code_block.js +444 -0
  86. data/source/components/code_block/package.json +3 -0
  87. data/source/components/code_block/spec/code_block_spec.js +10 -0
  88. data/source/components/demo/demo.js +244 -0
  89. data/source/components/demo/demo.scss +90 -0
  90. data/source/components/demo/package.json +3 -0
  91. data/source/components/exploded/exploded.erb +25 -0
  92. data/source/components/exploded/exploded.js +694 -0
  93. data/source/components/exploded/exploded.scss +166 -0
  94. data/source/components/exploded/package.json +3 -0
  95. data/source/components/field/field.js +24 -0
  96. data/source/components/field/field.scss +101 -0
  97. data/source/components/field/package.json +3 -0
  98. data/source/components/header/header.scss +33 -0
  99. data/source/components/iframe/iframe.erb +12 -0
  100. data/source/components/iframe/iframe.js +381 -0
  101. data/source/components/iframe/package.json +3 -0
  102. data/source/components/index.js +37 -0
  103. data/source/components/inline_group/inline-group.scss +14 -0
  104. data/source/components/internal_link/internal_link.js +49 -0
  105. data/source/components/internal_link/package.json +3 -0
  106. data/source/components/list/list.scss +230 -0
  107. data/source/components/modal/modal.coffee +84 -0
  108. data/source/components/modal/modal.erb +19 -0
  109. data/source/components/modal/modal.js +0 -0
  110. data/source/components/modal/modal.scss +57 -0
  111. data/source/components/modal/package.json +3 -0
  112. data/source/components/notice/notice.scss +48 -0
  113. data/source/components/popover/package.json +3 -0
  114. data/source/components/popover/popover.coffee +562 -0
  115. data/source/components/popover/popover.erb +21 -0
  116. data/source/components/popover/popover.js +0 -0
  117. data/source/components/popover/popover.scss +139 -0
  118. data/source/components/range/range.scss +78 -0
  119. data/source/components/resizable/package.json +3 -0
  120. data/source/components/resizable/resizable.erb +30 -0
  121. data/source/components/resizable/resizable.js +250 -0
  122. data/source/components/resizable/resizable.scss +245 -0
  123. data/source/components/resizable/size_buttons.js +249 -0
  124. data/source/components/scroll_container/package.json +3 -0
  125. data/source/components/scroll_container/scroll-container.scss +4 -0
  126. data/source/components/scroll_container/scroll_container.js +24 -0
  127. data/source/components/section/section.scss +99 -0
  128. data/source/components/select/package.json +3 -0
  129. data/source/components/select/select.erb +21 -0
  130. data/source/components/select/select.js +35 -0
  131. data/source/components/select/select.scss +163 -0
  132. data/source/components/table/package.json +3 -0
  133. data/source/components/table/table.erb +16 -0
  134. data/source/components/table/table.js +351 -0
  135. data/source/components/table/table.scss +236 -0
  136. data/source/components/tablist/package.json +3 -0
  137. data/source/components/tablist/tablist.erb +13 -0
  138. data/source/components/tablist/tablist.js +246 -0
  139. data/source/components/tablist/tablist.scss +191 -0
  140. data/source/components/tablist/tablist_panel.erb +14 -0
  141. data/source/components/tablist/tablist_tab.erb +20 -0
  142. data/source/components/toggle/package.json +3 -0
  143. data/source/components/toggle/toggle.erb +11 -0
  144. data/source/components/toggle/toggle.js +211 -0
  145. data/source/components/toggle/toggle_container.erb +30 -0
  146. data/source/components/vertical_spacer/vertical-spacer.scss +3 -0
  147. data/source/components/vertical_stack/vertical-stack.scss +19 -0
  148. data/source/components/xray/package.json +3 -0
  149. data/source/components/xray/xray.erb +50 -0
  150. data/source/components/xray/xray.js +123 -0
  151. data/source/components/xray/xray.scss +79 -0
  152. data/source/foundation/app/app.js +15 -0
  153. data/source/foundation/app/package.json +3 -0
  154. data/source/pattern-library-demo.scss +13 -0
  155. data/source/pattern-library.scss +13 -0
  156. data/source/pattern_library.js +8 -0
  157. data/source/pattern_library_demo.js +8 -0
  158. data/source/structures/index.js +11 -0
  159. data/source/structures/sidebar/package.json +3 -0
  160. data/source/structures/sidebar/sidebar.js +69 -0
  161. data/source/structures/sidebar/sidebar.scss +79 -0
  162. data/source/utilities/builder/builder.js +138 -0
  163. data/source/utilities/builder/package.json +3 -0
  164. data/source/utilities/client/client.js +7 -0
  165. data/source/utilities/client/package.json +3 -0
  166. data/source/utilities/colors/colors.scss +112 -0
  167. data/source/utilities/defaults/defaults.scss +38 -0
  168. data/source/utilities/dom_cache/dom_cache.js +24 -0
  169. data/source/utilities/dom_cache/package.json +3 -0
  170. data/source/utilities/events/events.js +25 -0
  171. data/source/utilities/events/package.json +3 -0
  172. data/source/utilities/font_sizes/font-sizes.scss +85 -0
  173. data/source/utilities/foundation/a11y.scss +10 -0
  174. data/source/utilities/foundation/base.scss +29 -0
  175. data/source/utilities/foundation/icon.scss +114 -0
  176. data/source/utilities/foundation/layout.scss +67 -0
  177. data/source/utilities/foundation/page.scss +39 -0
  178. data/source/utilities/foundation/type.scss +208 -0
  179. data/source/utilities/functions/functions.scss +127 -0
  180. data/source/utilities/keycodes/keycodes.js +23 -0
  181. data/source/utilities/keycodes/package.json +3 -0
  182. data/source/utilities/markup/markup.js +90 -0
  183. data/source/utilities/markup/package.json +3 -0
  184. data/source/utilities/media/media.scss +172 -0
  185. data/source/utilities/mixins/mixins.scss +89 -0
  186. data/source/utilities/naming_convention/naming_convention.js +3 -0
  187. data/source/utilities/naming_convention/package.json +3 -0
  188. data/source/utilities/numbers/numbers.js +14 -0
  189. data/source/utilities/numbers/package.json +3 -0
  190. data/source/utilities/painting/package.json +3 -0
  191. data/source/utilities/painting/painting.js +7 -0
  192. data/source/utilities/pattern/package.json +3 -0
  193. data/source/utilities/pattern/pattern.js +50 -0
  194. data/source/utilities/query_string/package.json +3 -0
  195. data/source/utilities/query_string/query_string.js +24 -0
  196. data/source/utilities/template/package.json +3 -0
  197. data/source/utilities/template/template.js +10 -0
  198. data/source/utilities/text_range/package.json +3 -0
  199. data/source/utilities/text_range/text_range.js +30 -0
  200. data/source/utilities/ui_events/package.json +3 -0
  201. data/source/utilities/ui_events/ui_events.js +85 -0
  202. data/source/utilities/variables/variables.scss +18 -0
  203. data/source/utilities/z_indexes/z-indexes.scss +88 -0
  204. data/source/vendor/array_includes.js +28 -0
  205. data/source/vendor/highlight.js +1142 -0
  206. data/source/vendor/index.js +1 -0
  207. data/source/vendor/matrix.js +399 -0
  208. data/source/vendor/query_string.js +66 -0
  209. data/spec/assets/.eslintrc +9 -0
  210. data/spec/assets/spec_fixture.js +33 -0
  211. data/spec/assets/spec_helper.js +19 -0
  212. data/spec/lib/components/base_component_spec.rb +156 -0
  213. data/spec/lib/components_spec.rb +30 -0
  214. data/spec/lib/helpers/ui_helper_spec.rb +62 -0
  215. data/spec/lib/theme_spec.rb +25 -0
  216. data/spec/spec_helper.rb +15 -0
  217. data/tasks/gulp/.eslintrc +6 -0
  218. data/tasks/gulp/browser_sync.js +8 -0
  219. data/tasks/gulp/code_quality/scripts.js +10 -0
  220. data/tasks/gulp/config/index.js +116 -0
  221. data/tasks/gulp/minify/scripts.js +13 -0
  222. data/tasks/gulp/minify/styles.js +13 -0
  223. data/tasks/gulp/pattern_library/index.js +5 -0
  224. data/tasks/gulp/pattern_library/scripts.js +10 -0
  225. data/tasks/gulp/pattern_library/styles.js +10 -0
  226. data/tasks/gulp/scripts.js +8 -0
  227. data/tasks/gulp/spec/scripts.js +11 -0
  228. data/tasks/gulp/styles.js +17 -0
  229. data/tasks/gulp/utilities/babel/relative_require.js +22 -0
  230. data/tasks/gulp/utilities/babel/spec_helper.js +20 -0
  231. data/tasks/gulp/utilities/browserify_bundler.js +22 -0
  232. data/tasks/gulp/utilities/handle_errors.js +13 -0
  233. data/tasks/gulp/watch.js +9 -0
  234. data/tasks/rake/rspec.rake +7 -0
  235. data/tasks/rake/rubocop.rake +8 -0
  236. data/tasks/rake/templates.rake +50 -0
  237. metadata +470 -0
@@ -0,0 +1,200 @@
1
+ // ___ ___ ___ ___
2
+ // / /\ ___ / /\ ___ / /\ / /\
3
+ // / /::\ /__/\ / /::\ / /\ / /::\ / /::\
4
+ // / /:/\:\ \ \:\ / /:/\:\ / /:/ / /:/\:\ / /:/\:\
5
+ // / /:/~/::\ \ \:\ / /:/~/::\ / /:/ / /:/~/::\ / /:/~/:/
6
+ // /__/:/ /:/\:\___ \__\:\/__/:/ /:/\:\/ /::\/__/:/ /:/\:\/__/:/ /:/___
7
+ // \ \:\/:/__\/__/\ | |:|\ \:\/:/__\/__/:/\:\ \:\/:/__\/\ \:\/:::::/
8
+ // \ \::/ \ \:\| |:| \ \::/ \__\/ \:\ \::/ \ \::/~~~~
9
+ // \ \:\ \ \:\__|:| \ \:\ \ \:\ \:\ \ \:\
10
+ // \ \:\ \__\::::/ \ \:\ \__\/\ \:\ \ \:\
11
+ // \__\/ ~~~~ \__\/ \__\/ \__\/
12
+
13
+ //*
14
+ // @pattern Avatar
15
+ //
16
+ // A small image representing someone associated with this project. The script
17
+ // part of this component allows it to fetch avatar images from Github, Twitter,
18
+ // or Gravatar, depending on the information provided. If no images are found
19
+ // for the avatar, it will fall back to displaying their initials.
20
+ //
21
+ // @since 1.0.0
22
+
23
+ //*
24
+ // The size (height and width) of an `avatar`.
25
+ // @type Length
26
+
27
+ $avatar--size: 3rem;
28
+
29
+ //*
30
+ // The margin that should appear between two `avatar`s (including those on a
31
+ // new line).
32
+ // @type Length
33
+
34
+ $avatar--spacing: half(default(spacing));
35
+
36
+ //*
37
+ // The core container for a single avatar. An avatar supports fetching of the
38
+ // background image through either a [Github](http://github.com) profile name,
39
+ // a [Twitter](http://twitter.com) username, or an email address that is
40
+ // associated with a [Gravatar](http://gravatar.com) account. If any of the
41
+ // above are given, clicking on the avatar will open a tab with the relevant
42
+ // profile page open (or, compose a new email if email was the provided
43
+ // identifier). If none of the above are given, the initials of the user's name
44
+ // will be shown.
45
+ //
46
+ // @helper
47
+ // <% docks_component("avatar:container") do %>
48
+ // <%= docks_component("avatar", author: OpenStruct.new(name: "Chris Sauve", github: "lemonmade")) %>
49
+ // <% end %>
50
+
51
+ .avatar {
52
+ // position
53
+ @include z-index(avatar, page);
54
+ position: relative;
55
+
56
+ // box model
57
+ flex: 0 0 auto;
58
+ display: inline-block;
59
+
60
+ // backdrop
61
+ background-color: color(gray-light);
62
+ border-radius: default(border-radius);
63
+ overflow: hidden;
64
+
65
+ // type
66
+ @include font-size(avatar);
67
+ }
68
+
69
+ //*
70
+ // A container that shows the initals of the user. This will always be present
71
+ // so that it is visible immediately on page load. The avatar image, which is
72
+ // fetched by JavaScript, will be faded in over top of this subcomponent, if
73
+ // available.
74
+ //
75
+ // Every initial of the passed name will be shown. There is enough space for
76
+ // 2–3 initials, but any more than this will overflow the avatar. As such,
77
+ // please restrict names to first and last or first, middle, and last.
78
+
79
+ .avatar__initials {
80
+ // position
81
+ @include z-index(initials, avatar);
82
+ position: absolute;
83
+ top: 50%; left: 0;
84
+
85
+ // box model
86
+ width: 100%;
87
+ transform: translateY(-50%);
88
+
89
+ // backdrop
90
+ color: color(gray);
91
+
92
+ // type
93
+ font-size: 1em;
94
+ line-height: 1;
95
+ text-align: center;
96
+ text-transform: uppercase;
97
+ }
98
+
99
+ //*
100
+ // The container for the avatar image. The image will be set by JavaScript as
101
+ // a background image on this subcomponent, so if no image is provided this
102
+ // container will effectively be invisible. Once the background image is
103
+ // fetched (which will be done with a slight delay to prevent too much from
104
+ // happening on page load), it is faded into place using the
105
+ // `avatar__image--is-visible` state.
106
+
107
+ .avatar__image {
108
+ // position
109
+ @include z-index(image, avatar);
110
+ position: relative;
111
+
112
+ // box model
113
+ height: $avatar--size;
114
+ width: $avatar--size;
115
+
116
+ // backdrop
117
+ opacity: 0;
118
+ transition: opacity 0.3s ease;
119
+ background-size: cover;
120
+ background-position: center center;
121
+ background-repeat: no-repeat;
122
+ overflow: hidden;
123
+ }
124
+
125
+ //*
126
+ // The variation that causes the image to be faded into view.
127
+ //
128
+ // @demo_type none
129
+ // @set_by Avatar#show_image
130
+
131
+ .avatar__image--is-visible {
132
+ opacity: 1;
133
+ }
134
+
135
+ //*
136
+ // Creates the rules that are required to restrict an `avatar__container` to
137
+ // a particular number of `avatar`s per line.
138
+ //
139
+ // @param {Number} $n - The maximum number of `avatar`s allowed per line.
140
+
141
+ @mixin avatar--restrict-to-n-avatars($n) {
142
+ max-width: (($n * $avatar--size) + ($n * $avatar--spacing));
143
+ }
144
+
145
+ //*
146
+ // The container around a set of avatars. This container is important because it
147
+ // eliminates the excess margin below and to the right of `avatar`s on the
148
+ // outside edges of the container, but still allows them to be properly spaced
149
+ // out horizontally and vertically. This is accomplished using negative margin
150
+ // on the bottom and right to offset the margin of the contained `avatar`s.
151
+ //
152
+ // This container allows three avatars side-by-side, with additional avatars
153
+ // breaking onto a new line. If you only need a single avatar, this container
154
+ // is not necessary.
155
+ //
156
+ // You can create this component using the `"avatar:container"` helper. this
157
+ // helper allows you to specify the size of the container:
158
+ //
159
+ // ```erb_demo
160
+ // <div>
161
+ // <% docks_component("avatar:container") do %>
162
+ // <% 4.times do %>
163
+ // <%= docks_component("avatar", author: OpenStruct.new(name: "Chris Sauve", github: "lemonmade")) %>
164
+ // <% end %>
165
+ // <% end %>
166
+ // </div>
167
+ //
168
+ // <div>
169
+ // <% docks_component("avatar:container", size: :large) do %>
170
+ // <% 4.times do %>
171
+ // <%= docks_component("avatar", author: OpenStruct.new(name: "Chris Sauve", github: "lemonmade")) %>
172
+ // <% end %>
173
+ // <% end %>
174
+ // </div>
175
+ // ```
176
+
177
+ .avatar__container {
178
+ display: inline-flex;
179
+ flex-wrap: wrap;
180
+ overflow: hidden;
181
+ margin-right: negative($avatar--spacing) !important;
182
+ margin-bottom: negative($avatar--spacing) !important;
183
+ @include avatar--restrict-to-n-avatars(3);
184
+
185
+ > .avatar {
186
+ margin-right: $avatar--spacing;
187
+ margin-bottom: $avatar--spacing;
188
+ }
189
+ }
190
+
191
+ //*
192
+ // A container that can hold more `avatar`s on a single line (four, instead of
193
+ // the base three). Use this for situations in which you have more room
194
+ // available for ancillary information like contributor information.
195
+ //
196
+ // @set_by :size (:large)
197
+
198
+ .avatar__container--large {
199
+ @include avatar--restrict-to-n-avatars(4);
200
+ }
@@ -0,0 +1,13 @@
1
+ <%
2
+ component.configure do |config|
3
+ config.defaults(size: :medium)
4
+ config.classes(container: "avatar__container")
5
+ config.conditional_classes(with: :size) do |size|
6
+ size == :medium ? {} : { container: "avatar__container--#{size}" }
7
+ end
8
+ end
9
+ %>
10
+
11
+ <div class="<%= component.classes_for(:container) %>">
12
+ <%= capture(&component.block) %>
13
+ </div>
@@ -0,0 +1,3 @@
1
+ {
2
+ "main": "avatar.js"
3
+ }
@@ -0,0 +1,81 @@
1
+ import "spec_helper";
2
+ import Avatar, { classes, states, attrs } from "~components/avatar";
3
+
4
+ var urlFromOptions, makeFixture, loadAndInit;
5
+
6
+ urlFromOptions = (options = {}) => {
7
+ var url;
8
+
9
+ switch(options.name) {
10
+ case "github":
11
+ url = `https://github.com/${options.name}`;
12
+ break;
13
+ case "twitter":
14
+ url = `https://twitter.com/${options.name}`;
15
+ break;
16
+ case "email":
17
+ url = `mailto:${options.name}`;
18
+ break;
19
+ }
20
+
21
+ return url;
22
+ };
23
+
24
+ makeFixture = (options = {}) => {
25
+ var data = `${attrs.service}=${options.service} ${attrs.profile_name}=${options.name}`;
26
+
27
+ return `
28
+ <div class="${classes.root}" href="${urlFromOptions(options)}" ${data}>
29
+ <span class="${classes.initials}">CS</span>
30
+ <div class="${classes.image}"></div>
31
+ </div>
32
+ `;
33
+ };
34
+
35
+ loadAndInit = (...args) => {
36
+ Fixture.load(makeFixture(...args));
37
+ Avatar.init(Fixture.node);
38
+ return Fixture.node.querySelector(`.${classes.root}`);
39
+ };
40
+
41
+ describe("Avatar", () => {
42
+ describe(".init", () => {
43
+ beforeEach(function() {
44
+ sandbox.useFakeServer();
45
+ sandbox.useFakeTimers(Date.now());
46
+ });
47
+
48
+ it("has an init method", function() {
49
+ expect(Avatar.init).to.be.a.function;
50
+ });
51
+
52
+ it("loads email avatars", function() {
53
+ var avatar_node = loadAndInit({ service: "email", name: "chrismsauve@gmail.com" }),
54
+ image = avatar_node.querySelector(`.${classes.image}`);
55
+
56
+ sandbox.clock.tick(1000);
57
+ expect(image.classList.contains(states.image.visible)).to.be.true;
58
+ expect(image.style.backgroundImage).to.equal("url(http://avatars.io/email/chrismsauve@gmail.com)");
59
+ });
60
+
61
+ it("loads twitter avatars", function() {
62
+ var avatar_node = loadAndInit({ service: "twitter", name: "_lemonmade" }),
63
+ image = avatar_node.querySelector(`.${classes.image}`);
64
+
65
+ sandbox.clock.tick(1000);
66
+ expect(image.classList.contains(states.image.visible)).to.be.true;
67
+ expect(image.style.backgroundImage).to.equal("url(http://avatars.io/twitter/_lemonmade)");
68
+ });
69
+
70
+ // it("loads github avatars", function() {
71
+ // var avatar_node = loadAndInit({ service: "github", name: "lemonmade" }),
72
+ // image = avatar_node.querySelector(`.${classes.image}`);
73
+ //
74
+ // sandbox.server.requests[0].respond(200, { "Content-Type": "application/json" }, "{'avatar_url': 'foo.png'}");
75
+ // sandbox.clock.tick(1000);
76
+ //
77
+ // expect(image.classList.contains(states.image.visible)).to.be.true;
78
+ // expect(image.style.backgroundImage).to.equal("foo.png");
79
+ // });
80
+ });
81
+ });
@@ -0,0 +1,158 @@
1
+ // ___ _____ ___ ___
2
+ // _____ / /\ / /::\ / /\ / /\
3
+ // / /::\ / /::\ / /:/\:\ / /:/_ / /:/_
4
+ // / /:/\:\ / /:/\:\ / /:/ \:\ / /:/ /\ / /:/ /\
5
+ // / /:/~/::\ / /:/~/::\/__/:/ \__\:|/ /:/_/::\ / /:/ /:/_
6
+ // /__/:/ /:/\:/__/:/ /:/\:\ \:\ / /:/__/:/__\/\:\/__/:/ /:/ /\
7
+ // \ \:\/:/~/:| \:\/:/__\/\ \:\ /:/\ \:\ /~~/:/\ \:\/:/ /:/
8
+ // \ \::/ /:/ \ \::/ \ \:\/:/ \ \:\ /:/ \ \::/ /:/
9
+ // \ \:\/:/ \ \:\ \ \::/ \ \:\/:/ \ \:\/:/
10
+ // \ \::/ \ \:\ \__\/ \ \::/ \ \::/
11
+ // \__\/ \__\/ \__\/ \__\/
12
+
13
+ //*
14
+ // @pattern Badge
15
+ //
16
+ // A badge is a small chunk of text in a colored box that denotes a particular
17
+ // attribute about the interface element to which it is attached. When
18
+ // additional explanatory text is required, use a `notice` instead — badges
19
+ // should only ever be one word in length. It is appropriate to have multiple
20
+ // badges attached to a single element if additional details about that
21
+ // element need to be indicated.
22
+ //
23
+ // @since 1.0.0
24
+
25
+
26
+ $badge--spacing: half(default(spacing));
27
+
28
+
29
+
30
+ //*
31
+ // The actual badge. Each badge provides spacing between itself and badges it
32
+ // is next to, so they must be wrapped in a `badge__container` to remove any
33
+ // excess outside spacing if you include more than a single badge.
34
+ //
35
+ // Because badges most often sit allongside other text, they are designed to
36
+ // scale with the size of whatever container they are in. They will always be
37
+ // slightly smaller than the text size of the content to which they are
38
+ // attached such that the top and bottom of the badge approximately match the
39
+ // ascenders/ descenders of the text.
40
+ //
41
+ // @markup
42
+ // <div class="badge__container">
43
+ // <% 5.times do |i| %>
44
+ // <div class="badge">Badge <%= i + 1 %></div>
45
+ // <% end %>
46
+ // </div>
47
+
48
+ .badge {
49
+ // position
50
+ position: relative;
51
+
52
+ // box model
53
+ flex: 0 0 auto;
54
+ display: inline-block;
55
+ // A little extra bottom padding to make it look centered.
56
+ padding: 0.15em 0.5em 0.25em;
57
+
58
+ // backdrop
59
+ @include default(border-radius);
60
+ background-color: ui-color(gray, light);
61
+
62
+ // type
63
+ @include font-size(badge);
64
+ line-height: default(line-height);
65
+ vertical-align: middle;
66
+ color: ui-color(gray, darker);
67
+ }
68
+
69
+ //*
70
+ // Use this badge variation when you are trying to indicate some sort of
71
+ // warning to the user — for example, when the content to which this badge is
72
+ // attached has been deprecated or has a common pitfall.
73
+ //
74
+ // @demo_type joint
75
+
76
+ .badge--warning {
77
+ background-color: ui-color(yellow);
78
+ color: ui-color(yellow, dark);
79
+ }
80
+
81
+ //*
82
+ // Use this badge variation when you are trying to indicate a new or updated
83
+ // status for the attached content. For example, this badge might be used to
84
+ // indicate something is in beta or has recently been upgraded or released.
85
+ //
86
+ // @demo_type joint
87
+
88
+ .badge--new {
89
+ background-color: ui-color(blue);
90
+ color: ui-color(blue, darker);
91
+ }
92
+
93
+ //*
94
+ // Use this badge variation when the attached content is meant to be
95
+ // concealed, secret, or in some other way not intended to be used in the
96
+ // average case. For example, this badge can be used to indicate that
97
+ // something is private/ for internal use only.
98
+ //
99
+ // @demo_type joint
100
+
101
+ .badge--secret {
102
+ background-color: ui-color(gray, darkest);
103
+ color: ui-color(gray);
104
+ }
105
+
106
+ //*
107
+ // This variation is used to fix the vertical padding on badges that are meant
108
+ // to contain content styled as code. Because the monospace font family has
109
+ // different font properties, leaving the existing `padding`/ `line-height`
110
+ // along results in the text sitting too closely to the top of the badge. This
111
+ // fixes the problem using a very un-scientific redistribution of the
112
+ // available padding.
113
+ //
114
+ // Note that, because the monospace font has more space allocated for each
115
+ // character, a badge with this variant will be wider than one without it,
116
+ // even if they have the same content.
117
+ //
118
+ // @demo_type select
119
+
120
+ .badge--code {
121
+ // @include type--monospace-font-family;
122
+ padding-bottom: 0;
123
+ padding-top: 0.2em;
124
+ }
125
+
126
+ //*
127
+ // A badge that is used on its own (that is, not beside other text, but may be
128
+ // beside other buttons).
129
+ //
130
+ // @demo_type select
131
+
132
+ .badge--standalone {
133
+ @include font-size(badge--standalone);
134
+ }
135
+
136
+
137
+
138
+ //*
139
+ // This container should always be wrapped around a set of badges. It removes
140
+ // any excess right and bottom margin (which every contained badge has to
141
+ // allow for spacing between rows and columns of badges), while still allowing
142
+ // the badges to break onto a new line if there is not enough space to contain
143
+ // them all on a single line.
144
+ //
145
+ // If only a single badge exists, this container can be omitted.
146
+
147
+ .badge__container {
148
+ display: inline-flex;
149
+ flex-wrap: wrap;
150
+ overflow: hidden;
151
+ margin-right: negative($badge--spacing) !important;
152
+ margin-bottom: negative($badge--spacing) !important;
153
+
154
+ > .badge {
155
+ margin-right: $badge--spacing;
156
+ margin-bottom: $badge--spacing;
157
+ }
158
+ }
@@ -0,0 +1,213 @@
1
+ // ___ ___ ___
2
+ // _____ /__/\ ___ ___ / /\ /__/\
3
+ // / /::\ \ \:\ / /\ / /\ / /::\ \ \:\
4
+ // / /:/\:\ \ \:\ / /:/ / /:/ / /:/\:\ \ \:\
5
+ // / /:/~/::\ ___ \ \:\ / /:/ / /:/ / /:/ \:\ _____\__\:\
6
+ // /__/:/ /:/\:|/__/\ \__\:\ / /::\ / /::\ /__/:/ \__\:\/__/::::::::\
7
+ // \ \:\/:/~/:/\ \:\ / /://__/:/\:\ /__/:/\:\\ \:\ / /:/\ \:\~~\~~\/
8
+ // \ \::/ /:/ \ \:\ /:/ \__\/ \:\\__\/ \:\\ \:\ /:/ \ \:\ ~~~
9
+ // \ \:\/:/ \ \:\/:/ \ \:\ \ \:\\ \:\/:/ \ \:\
10
+ // \ \::/ \ \::/ \__\/ \__\/ \ \::/ \ \:\
11
+ // \__\/ \__\/ \__\/ \__\/
12
+ //
13
+ //*
14
+ // @pattern Buttons
15
+ // @tagline Capture all the clicks.
16
+ //
17
+ // Buttons are what the user should press to initiate most actions. Actions
18
+ // may take place on the page (for example, by activating a popover or x-ray
19
+ // mode) or may send the user to another site to perform an action (the most
20
+ // notable example of this are the buttons that send the user to Github). The
21
+ // element on which to apply these classes will depend on whether the action
22
+ // is internal or external to the page.
23
+ //
24
+ // @since 1.0.0
25
+
26
+
27
+
28
+ $button--spacing: half(default(spacing));
29
+
30
+
31
+
32
+ //*
33
+ // @title Standard Buttons
34
+ //
35
+ // A standard button. This component normalizes the styles of both `button` and
36
+ // `a` elements so that these classes can be placed on either one. If the action
37
+ // is internal (i.e., doesn't require a `GET` request), use a `button`. If the
38
+ // action does require a `GET`, use a URL. Never use an `a` tag with a blank
39
+ // (or `"#"`) `href` attribute.
40
+ //
41
+ // Any variations on this button should ensure that they design and implement
42
+ // designs for the `:focus` state, `:active` state, `:hover` state (optional),
43
+ // and for icons with buttons (using a child selector to the `icon` component),
44
+ // if adjustments to the contained icons are required.
45
+ //
46
+ // A single button can be included on its own, without any container. If
47
+ // multiple buttons have to be placed beside each other, wrap all of the buttons
48
+ // in a `docks-button__container`.
49
+ //
50
+ // @markup
51
+ // <div class="docks-button__container">
52
+ // <button class="docks-button">button!</button>
53
+ //
54
+ // <button class="docks-button">
55
+ // <%= docks_icon :github, size: :medium %>
56
+ // <span class="docks-button__text">icon + text</span>
57
+ // </button>
58
+ //
59
+ // <button class="docks-button">
60
+ // <span class="docks-button__text">text + icon</span>
61
+ // <%= docks_icon :github, size: :medium %>
62
+ // </button>
63
+ //
64
+ // <div class="docks-button__segmented-container">
65
+ // <button class="docks-button">Segment 1</button>
66
+ // <button class="docks-button">Segment 2</button>
67
+ // </div>
68
+ // </div>
69
+
70
+ .docks-button {
71
+ // box model
72
+ display: inline-flex;
73
+ align-items: center;
74
+ justify-content: center;
75
+ padding: 0 default(control-padding);
76
+
77
+ // backdrop
78
+ @include default(border-radius);
79
+ background-color: ui-color(gray, light);
80
+ border: none;
81
+ cursor: pointer;
82
+ opacity: 1;
83
+ transition: opacity 0.3s ease;
84
+
85
+ // type
86
+ // @include type--default-font-family;
87
+ @include font-size(control);
88
+ line-height: default(control-size);
89
+ color: ui-color(gray, darker);
90
+ vertical-align: middle;
91
+ text-decoration: none;
92
+ white-space: nowrap;
93
+
94
+ &:focus,
95
+ &:active {
96
+ background-color: ui-color(gray);
97
+ outline: none;
98
+ }
99
+
100
+ > *:first-child { margin-right: $button--spacing; }
101
+ }
102
+
103
+ //*
104
+ // A slighter dark variation.
105
+
106
+ .docks-button--dark {
107
+ background-color: ui-color(gray, dark);
108
+ color: ui-color(gray, darkest);
109
+
110
+ &:focus,
111
+ &:active {
112
+ background-color: ui-color(gray, dark);
113
+ color: ui-color(gray, darkest);
114
+ }
115
+ }
116
+
117
+ //*
118
+ // A button that can no longer be pressed. Make sure to always also include the
119
+ // `disabled` attribute on the actual `button` — this improves usability by
120
+ // preventing the button from being tabbed to, and prevents any event handlers
121
+ // on the `button` from running.
122
+ //
123
+ // @javascript_action this.classList.add("docks-button--is-disabled"); this.disabled = true
124
+
125
+ .docks-button--is-disabled {
126
+ opacity: 0.3;
127
+ }
128
+
129
+
130
+
131
+ //*
132
+ // A container for a collection of buttons that normalizes the margin on the
133
+ // outside. This is necessary because each button inside the container has
134
+ // right and bottom margin so that there is vertical and horizontal space
135
+ // between each of any number of buttons.
136
+
137
+ .docks-button__container {
138
+ display: inline-flex;
139
+ flex-wrap: wrap;
140
+ margin-right: negative($button--spacing) !important;
141
+ margin-bottom: negative($button--spacing) !important;
142
+
143
+ // Prevents margin from collapsing while still allowing overflow/
144
+
145
+ &:after { content: ""; display: table; }
146
+
147
+ // Allow for anything inside the container — this is useful for, for example,
148
+ // contained buttons that activate popovers and thus have popover containers
149
+ // around them.
150
+
151
+ > * {
152
+ flex: 0 0 auto;
153
+ margin-right: $button--spacing;
154
+ margin-bottom: $button--spacing;
155
+ }
156
+ }
157
+
158
+ //*
159
+ // Use this container variation when you want all of the buttons inside the
160
+ // container to consume an equal part of the total width available to the
161
+ // container. Note that potentially-unexpected behavior may occur when the
162
+ // buttons in this button group have a total intrinsic minimum width greater
163
+ // than that of the container — buttons with smaller intrinsic widths in the
164
+ // group will shrink as much as possible, and then buttons will start, one-by-one
165
+ // as required, breaking onto additional lines (and filling them completely,
166
+ // resulting in some buttons likely being larger than others).
167
+ //
168
+ // For the best results, try to have only two buttons side-by-side in a
169
+ // container using this variant.
170
+
171
+ .docks-button__container--fill-width {
172
+ display: flex;
173
+ flex-wrap: wrap;
174
+ align-items: flex-start;
175
+
176
+ // For both buttons and non-button-ey things in button groups, like popover
177
+ // containers.
178
+
179
+ .docks-button,
180
+ > *:not(.docks-button) {
181
+ display: flex;
182
+ flex: 1 0 0%;
183
+ min-width: -webkit-min-content;
184
+ min-width: -moz-min-content;
185
+ min-width: min-content;
186
+ }
187
+ }
188
+
189
+
190
+
191
+ //*
192
+ // The text for a button. This container is not necessary unless there is also
193
+ // an icon in the button.
194
+
195
+ .docks-button__text {}
196
+
197
+
198
+
199
+ //*
200
+ // A wrapper around buttons that causes them to look like one button segmented
201
+ // into pieces.
202
+
203
+ .docks-button__segmented-container {
204
+ display: inline-flex;
205
+
206
+ > .docks-button {
207
+ border-radius: 0;
208
+
209
+ &:not(:first-child) { border-left: none; }
210
+ &:first-child { border-radius: default(border-radius) 0 0 default(border-radius); }
211
+ &:last-child { border-radius: 0 default(border-radius) default(border-radius) 0; }
212
+ }
213
+ }