docks_theme_api 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
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,90 @@
1
+ //*
2
+ // @pattern Pattern Library Helpers
3
+ // @author Chris Sauve (github: lemonmade)
4
+ //
5
+ // This file provides a set of helpers that allow you to provide custom style
6
+ // overrides for components in demos. Please use these helpers in place of
7
+ // custom selectors whenever possible — if the internal mechanisms the generator
8
+ // uses to create these demos is ever changed, these helpers will be updated to
9
+ // reflect the new selectors that are needed.
10
+
11
+ //*
12
+ // Forces the height of the passed `$component` demo to be at least `$height`.
13
+ // Demos of some components may not respond properly to automatically
14
+ // calculating their height. For example, absolutely-positioned dropdowns do
15
+ // not cause the height of their container to increase, but we may want some
16
+ // extra vertical space for them to appear into. This mixin allows you to
17
+ // force a particular demo to have at least the passed height.
18
+ //
19
+ // @param {String} $component - The exact name of the component you wish to
20
+ // forcibly size (in most cases, this is the component's class name, without
21
+ // the leading `"."`).
22
+ //
23
+ // @param {Number} $height - The height you wish to force the component demo
24
+ // to be. This number should have some units, the choice of which is left to
25
+ // you.
26
+ //
27
+ // @example
28
+ // +docks-demo-height(dropdown, 10em)
29
+
30
+ =docks-demo-height($component, $height)
31
+ #demo__section--#{$component} > .demo__content
32
+ min-height: #{$height} !important
33
+
34
+ //*
35
+ // Forces the background of the demo for `$component` to be `$color`. You may
36
+ // wish to use this in cases where an element typically appears on a background
37
+ // color that is not the default for the way they are presented in demos (the
38
+ // default theme displays these on a pure white background).
39
+ //
40
+ // @param {String} $component - The exact name of the component you wish to
41
+ // forcibly set the background color for (in most cases, this is the component's
42
+ // class name, without the leading `"."`).
43
+ //
44
+ // @param {Color} $color - The background color you want.
45
+ //
46
+ // @example
47
+ // +docks-demo-background(button--light, rgb(50, 50, 50))
48
+
49
+ =docks-demo-background($component, $color)
50
+ #demo__section--#{$component}
51
+ background-color: #{$color} !important
52
+
53
+ //*
54
+ // Forces the demo container for `$component` to have no horizontal padding.
55
+ // The default theme provides this padding since, in general, it is more
56
+ // aesthetically pleasing to do so. This may not, however, work for all your
57
+ // components, in which case you can use this mixin.
58
+ //
59
+ // @param {String} $component - The exact name of the component you wish to
60
+ // remove padding for (in most cases, this is the component's class name,
61
+ // without the leading `"."`).
62
+ //
63
+ // @example
64
+ // +docks-demo-no-padding(grid)
65
+
66
+ =docks-demo-no-padding($component)
67
+ #demo__section--#{$component}
68
+ padding-left: 0
69
+ padding-right: 0
70
+
71
+ //*
72
+ // Allows you to specify a block of styles that will apply only to the demo
73
+ // container for `$component`. If you are simply trying to force a particular
74
+ // height, use [`docks-demo-height`](@link). If you are trying to set a custom
75
+ // background color, use [`docks-demo-background`](@link). If you are trying to
76
+ // remove the horizontal padding on a component's demo, use
77
+ // [`docks-demo-no-padding`](@link). Use this mixin only for more advanced
78
+ // styling concerns.
79
+ //
80
+ // @param {String} $component - The exact name of the component you wish to
81
+ // add custom styling for (in most cases, this is the component's class name,
82
+ // without the leading `"."`).
83
+ //
84
+ // @example
85
+ // +docks-demo-styles(button)
86
+ // text-align: center
87
+
88
+ =docks-demo-styles($component)
89
+ #demo__section--#{$component}
90
+ @content
@@ -0,0 +1,99 @@
1
+ //*
2
+ // @pattern Pattern Library Helpers
3
+ // @author Chris Sauve (github: lemonmade)
4
+ //
5
+ // This file provides a set of helpers that allow you to provide custom style
6
+ // overrides for components in demos. Please use these helpers in place of
7
+ // custom selectors whenever possible — if the internal mechanisms the generator
8
+ // uses to create these demos is ever changed, these helpers will be updated to
9
+ // reflect the new selectors that are needed.
10
+
11
+ //*
12
+ // Forces the height of the passed `$component` demo to be at least `$height`.
13
+ // Demos of some components may not respond properly to automatically
14
+ // calculating their height. For example, absolutely-positioned dropdowns do
15
+ // not cause the height of their container to increase, but we may want some
16
+ // extra vertical space for them to appear into. This mixin allows you to
17
+ // force a particular demo to have at least the passed height.
18
+ //
19
+ // @param {String} $component - The exact name of the component you wish to
20
+ // forcibly size (in most cases, this is the component's class name, without
21
+ // the leading `"."`).
22
+ //
23
+ // @param {Number} $height - The height you wish to force the component demo
24
+ // to be. This number should have some units, the choice of which is left to
25
+ // you.
26
+ //
27
+ // @example
28
+ // @include docks-demo-height(dropdown, 10em);
29
+
30
+ @mixin docks-demo-height($component, $height) {
31
+ #demo__section--#{$component} > .demo__content {
32
+ min-height: #{$height} !important;
33
+ }
34
+ }
35
+
36
+ //*
37
+ // Forces the background of the demo for `$component` to be `$color`. You may
38
+ // wish to use this in cases where an element typically appears on a background
39
+ // color that is not the default for the way they are presented in demos (the
40
+ // default theme displays these on a pure white background).
41
+ //
42
+ // @param {String} $component - The exact name of the component you wish to
43
+ // forcibly set the background color for (in most cases, this is the component's
44
+ // class name, without the leading `"."`).
45
+ //
46
+ // @param {Color} $color - The background color you want.
47
+ //
48
+ // @example
49
+ // @include docks-demo-background(button--light, rgb(50, 50, 50));
50
+
51
+ @mixin docks-demo-background($component, $color) {
52
+ #demo__section--#{$component} {
53
+ background-color: #{$color} !important;
54
+ }
55
+ }
56
+
57
+ //*
58
+ // Forces the demo container for `$component` to have no horizontal padding.
59
+ // The default theme provides this padding since, in general, it is more
60
+ // aesthetically pleasing to do so. This may not, however, work for all your
61
+ // components, in which case you can use this mixin.
62
+ //
63
+ // @param {String} $component - The exact name of the component you wish to
64
+ // remove padding for (in most cases, this is the component's class name,
65
+ // without the leading `"."`).
66
+ //
67
+ // @example
68
+ // @include docks-demo-no-padding(grid);
69
+
70
+ @mixin docks-demo-no-padding($component) {
71
+ #demo__section--#{$component} {
72
+ padding-left: 0;
73
+ padding-right: 0;
74
+ }
75
+ }
76
+
77
+ //*
78
+ // Allows you to specify a block of styles that will apply only to the demo
79
+ // container for `$component`. If you are simply trying to force a particular
80
+ // height, use [`docks-demo-height`](@link). If you are trying to set a custom
81
+ // background color, use [`docks-demo-background`](@link). If you are trying to
82
+ // remove the horizontal padding on a component's demo, use
83
+ // [`docks-demo-no-padding`](@link). Use this mixin only for more advanced
84
+ // styling concerns.
85
+ //
86
+ // @param {String} $component - The exact name of the component you wish to
87
+ // add custom styling for (in most cases, this is the component's class name,
88
+ // without the leading `"."`).
89
+ //
90
+ // @example
91
+ // @include docks-demo-styles(button) {
92
+ // text-align: center;
93
+ // }
94
+
95
+ @mixin docks-demo-styles($component) {
96
+ #demo__section--#{$component} {
97
+ @content;
98
+ }
99
+ }
@@ -0,0 +1,90 @@
1
+ //*
2
+ // @pattern Pattern Library Helpers
3
+ // @author Chris Sauve (github: lemonmade)
4
+ //
5
+ // This file provides a set of helpers that allow you to provide custom style
6
+ // overrides for components in demos. Please use these helpers in place of
7
+ // custom selectors whenever possible — if the internal mechanisms the generator
8
+ // uses to create these demos is ever changed, these helpers will be updated to
9
+ // reflect the new selectors that are needed.
10
+
11
+ //*
12
+ // Forces the height of the passed `component` demo to be at least `height`.
13
+ // Demos of some components may not respond properly to automatically
14
+ // calculating their height. For example, absolutely-positioned dropdowns do
15
+ // not cause the height of their container to increase, but we may want some
16
+ // extra vertical space for them to appear into. This mixin allows you to
17
+ // force a particular demo to have at least the passed height.
18
+ //
19
+ // @param {String} component - The exact name of the component you wish to
20
+ // forcibly size (in most cases, this is the component's class name, without
21
+ // the leading `"."`).
22
+ //
23
+ // @param {Number} height - The height you wish to force the component demo
24
+ // to be. This number should have some units, the choice of which is left to
25
+ // you.
26
+ //
27
+ // @example
28
+ // docks-demo-height(dropdown, 10em)
29
+
30
+ docks-demo-height(component, height)
31
+ #demo__section--{component} > .demo__content
32
+ min-height height !important
33
+
34
+ //*
35
+ // Forces the background of the demo for `component` to be `color`. You may
36
+ // wish to use this in cases where an element typically appears on a background
37
+ // color that is not the default for the way they are presented in demos (the
38
+ // default theme displays these on a pure white background).
39
+ //
40
+ // @param {String} component - The exact name of the component you wish to
41
+ // forcibly set the background color for (in most cases, this is the component's
42
+ // class name, without the leading `"."`).
43
+ //
44
+ // @param {Color} color - The background color you want.
45
+ //
46
+ // @example
47
+ // docks-demo-background(button--light, rgb(50, 50, 50))
48
+
49
+ docks-demo-background(component, color)
50
+ #demo__section--{component}
51
+ background-color color !important
52
+
53
+ //*
54
+ // Forces the demo container for `component` to have no horizontal padding.
55
+ // The default theme provides this padding since, in general, it is more
56
+ // aesthetically pleasing to do so. This may not, however, work for all your
57
+ // components, in which case you can use this mixin.
58
+ //
59
+ // @param {String} component - The exact name of the component you wish to
60
+ // remove padding for (in most cases, this is the component's class name,
61
+ // without the leading `"."`).
62
+ //
63
+ // @example
64
+ // docks-demo-no-padding(grid)
65
+
66
+ docks-demo-no-padding(component)
67
+ #demo__section--{component}
68
+ padding-left 0
69
+ padding-right 0
70
+
71
+ //*
72
+ // Allows you to specify a block of styles that will apply only to the demo
73
+ // container for `component`. If you are simply trying to force a particular
74
+ // height, use [`docks-demo-height`](@link). If you are trying to set a custom
75
+ // background color, use [`docks-demo-background`](@link). If you are trying to
76
+ // remove the horizontal padding on a component's demo, use
77
+ // [`docks-demo-no-padding`](@link). Use this mixin only for more advanced
78
+ // styling concerns.
79
+ //
80
+ // @param {String} component - The exact name of the component you wish to
81
+ // add custom styling for (in most cases, this is the component's class name,
82
+ // without the leading `"."`).
83
+ //
84
+ // @example
85
+ // +docks-demo-styles(button)
86
+ // text-align: center
87
+
88
+ docks-demo-styles(component)
89
+ #demo__section--{component}
90
+ {block}
@@ -0,0 +1,26 @@
1
+ <div class="iframe" data-iframe-id="<%= id %>">
2
+ <div class="demo" data-iframe-id="<%= id %>">
3
+
4
+ <% if demo.kind_of?(Docks::Containers::Demo) %>
5
+ <% demo_variations = [demo.component] + demo.joint_variations %>
6
+ <% demo_variations.each do |variation| %>
7
+ <% name = variation.name %>
8
+
9
+ <section class="demo__section" data-name="<%= name %>" id="demo__section--<%= name %>">
10
+ <% unless demo_variations.length == 1 %>
11
+ <header class="demo__header">
12
+ <h2 class="badge badge--code"><%= name %></h2>
13
+ </header>
14
+ <% end %>
15
+
16
+ <div class="content"><%= variation.markup %></div>
17
+ </section>
18
+ <% end %>
19
+
20
+ <% else %>
21
+ <section class="demo__section">
22
+ <div class="content"><%= demo %></div>
23
+ </section>
24
+ <% end %>
25
+ </div>
26
+ </div>
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <%= docks_stylesheet(:demo) %>
5
+ <%= compiled_style_tags %>
6
+ <script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
7
+ </head>
8
+
9
+ <body>
10
+ <%= docks_icons %>
11
+
12
+ <div class="wrapper"><%= yield %></div>
13
+
14
+ <%= docks_javascript(:demo) %>
15
+ <%= compiled_script_tags %>
16
+ </body>
17
+ </html>
@@ -0,0 +1,76 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <%= docks_stylesheet %>
5
+ <%= compiled_style_tags %>
6
+ <script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>
7
+ </head>
8
+
9
+ <body>
10
+ <%= docks_icons %>
11
+
12
+ <div class="page">
13
+ <div class="page__sidebar">
14
+ <%= render "sidebar" %>
15
+ </div>
16
+
17
+ <div class="page__content">
18
+ <div class="vertical-stack">
19
+ <div class="vertical-stack__item vertical-stack__item--fixed">
20
+ <div class="page-header">
21
+ <div class="grid grid--vertically-centered">
22
+ <div class="grid__item grid__item--no-flex">
23
+ <button class="sidebar__toggler">
24
+ <span class="helper--visually-hidden">Toggle Sidebar</span>
25
+ <div class="icon icon--action icon--hamburger">
26
+ <div class="icon--hamburger__slice"></div>
27
+ </div>
28
+ </button>
29
+ </div>
30
+
31
+ <div class="grid__item">
32
+ <h1 class="type type--heading type--heading-1"><%= @pattern.title %></h1>
33
+ </div>
34
+
35
+ <% if has_github? %>
36
+ <div class="popover__container">
37
+ <button class="docks-button docks-button--dark">
38
+ Github
39
+ <i class="icon icon--disclosure"></i>
40
+ </button>
41
+
42
+ <% docks_popover do %>
43
+ <div class="list">
44
+ <a href="<%= "#{github_root_url}/issues/new?body=#{url_encode(github_issue_message)}" %>" target="_blank" class="list__item">File an issue</a>
45
+
46
+ <div class="list__group">
47
+ <h4 class="type type--heading type--heading-4">View source</h4>
48
+ <% relative_pattern_files.each do |file| %>
49
+ <a href="<%= github_url(file) %>" target="_blank" class="list__item type--code"><%= File.basename(file) %></a>
50
+ <% end %>
51
+ </div>
52
+ </div>
53
+ <% end %>
54
+ </div>
55
+ <% end %>
56
+ </div>
57
+ </div>
58
+ </div>
59
+
60
+ <div class="vertical-stack__item">
61
+ <main class="scroll-container"><%= yield %></main>
62
+ </div>
63
+ </div>
64
+
65
+ <%= docks_xray %>
66
+ </div>
67
+ </div>
68
+
69
+ <script type="text/javascript">
70
+ window.pattern = <%= json_escape(@pattern.to_json) %>;
71
+ </script>
72
+
73
+ <%= docks_javascript %>
74
+ <%= compiled_script_tags %>
75
+ </body>
76
+ </html>
@@ -0,0 +1,124 @@
1
+ <nav class="sidebar">
2
+ <div class="vertical-stack">
3
+ <div class="vertical-stack__item vertical-stack__item--fixed">
4
+ <header class="page-header">
5
+ <div class="grid grid--vertically-centered">
6
+ <div class="grid__item">
7
+ <label class="label helper--visually-hidden" for="search">Search</label>
8
+ <div class="field field--text">
9
+ <div class="field__icon">
10
+ <%= docks_icon(:search, size: :medium) %>
11
+ </div>
12
+ <input id="search" type="search" class="field__input" data-filters="#list--patterns, #list--this-pattern" data-filter-attribute="contents" placeholder="Search">
13
+ </div>
14
+ </div>
15
+
16
+ <div class="grid__item grid__item--no-flex">
17
+ <div class="popover__container">
18
+ <%= docks_icon :eye, size: :large, color: :gray_darker %>
19
+
20
+ <% docks_popover do |popover| %>
21
+ <% popover.pane do %>
22
+ <div class="field field--switch">
23
+ <input class="field__switch" type="checkbox" id="private-toggle" data-filters="#list--this-pattern, #symbols--structure, #symbols--behavior" data-filter-attribute="data-private" data-checked-value="true|false">
24
+ <label class="label" for="private-toggle">Show private symbols</label>
25
+ </div>
26
+ <% end %>
27
+ <% end %>
28
+ </div>
29
+ </div>
30
+ </div>
31
+ </header>
32
+ </div>
33
+
34
+ <div class="vertical-stack__item">
35
+ <% unless @pattern.symbols.empty? %>
36
+ <div class="list" id="list--this-pattern" data-filter-items=".list__item">
37
+ <%
38
+ symbol_contents = { "structure" => @pattern.has_structure?, "behavior" => @pattern.has_behavior? }
39
+ has_both = symbol_contents["structure"] && symbol_contents["behavior"]
40
+ %>
41
+
42
+ <h3 class="type type--heading type--heading-3">This Pattern</h3>
43
+ <% %w(structure behavior).each do |group| %>
44
+ <% if symbol_contents[group] %>
45
+ <% if group == "structure" && !(demos = @pattern.demos).empty? %>
46
+ <div class="list__group">
47
+ <h4 class="type type--heading type--heading-4">Components</h4>
48
+ <% demos.each do |demo| %>
49
+ <a class="list__item type--code" href="#<%= demo.component.symbol_id %>" data-private="<%= demo.component.private? %>"><%= demo.name %></a>
50
+ <% end %>
51
+ </div>
52
+ <% end %>
53
+
54
+ <% if group == "behavior" && !(factories = @pattern.factories).empty? %>
55
+ <div class="list__group">
56
+ <h4 class="type type--heading type--heading-4">Factories</h4>
57
+ <% factories.each do |factory| %>
58
+ <a class="list__item type--code" href="#<%= factory.symbol_id %>" data-private="<%= factory.private? %>"><%= factory.name %></a>
59
+
60
+ <% factory.static_properties.each do |prop| %>
61
+ <a href="#<%= prop.symbol_id %>" class="list__item list__item--indented type--code" data-private="<%= prop.private? %>">.<%= prop.name %></a>
62
+ <% end %>
63
+
64
+ <% factory.static_methods.each do |meth| %>
65
+ <a href="#<%= meth.symbol_id %>" class="list__item list__item--indented type--code" data-private="<%= meth.private? %>">.<%= meth.name %>()</a>
66
+ <% end %>
67
+
68
+ <% factory.instance_properties.each do |prop| %>
69
+ <a href="#<%= prop.symbol_id %>" class="list__item list__item--indented type--code" data-private="<%= prop.private? %>">#<%= prop.name %></a>
70
+ <% end %>
71
+
72
+ <% factory.instance_methods.each do |meth| %>
73
+ <a href="#<%= meth.symbol_id %>" class="list__item list__item--indented type--code" data-private="<%= meth.private? %>">#<%= meth.name %>()</a>
74
+ <% end %>
75
+ <% end %>
76
+ </div>
77
+ <% end %>
78
+
79
+ <% %w(variable function mixin).each do |type| %>
80
+ <%
81
+ symbol_options = {}
82
+ symbol_options[group == "behavior" ? :include : :exclude] = Docks::Types::Languages::SCRIPT
83
+ symbols = @pattern.send(type.pluralize.to_sym, symbol_options)
84
+ unless symbols.empty?
85
+ %>
86
+ <div class="list__group">
87
+ <h4 class="type type--heading type--heading-4"><%= type.pluralize.capitalize %></h4>
88
+ <% symbols.each do |symbol| %>
89
+ <a class="list__item type--code" href="#<%= symbol.symbol_id %>" data-private="<%= symbol.private? %>"><%= symbol.name %></a>
90
+
91
+ <% symbol.methods.each do |meth| %>
92
+ <a href="#<%= meth.symbol_id %>" class="list__item list__item--indented type--code" data-private="<%= meth.private? %>">.<%= meth.name %>()</a>
93
+ <% end %>
94
+
95
+ <% symbol.properties.each do |prop| %>
96
+ <a href="#<%= prop.symbol_id %>" class="list__item list__item--indented type--code" data-private="<%= prop.private? %>">.<%= prop.name %></a>
97
+ <% end %>
98
+ <% end %>
99
+ </div>
100
+ <% end %>
101
+ <% end %>
102
+ <% end %>
103
+ <% end %>
104
+ </div>
105
+ <% end %>
106
+
107
+ <div class="list" id="list--patterns" data-filter-items=".list__item">
108
+ <h3 class="type type--heading type--heading-3">Library</h3>
109
+ <% @pattern_library.groups do |group, patterns| %>
110
+ <div class="list__group">
111
+ <h4 class="type type--heading type--heading-4"><%= group.pluralize %></h4>
112
+
113
+ <% patterns.sort { |one, two| one.name <=> two.name }.each do |pattern| %>
114
+ <% active_pattern = pattern.name == @pattern.name %>
115
+ <a class="list__item<%= " list__item--is-active" if active_pattern %>" href="<%= active_pattern ? "javascript:" : docks_path(pattern.name) %>">
116
+ <%= pattern.title %>
117
+ </a>
118
+ <% end %>
119
+ </div>
120
+ <% end %>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ </nav>
@@ -0,0 +1 @@
1
+ <%= render(partial: "symbols/factory", locals: { factory: klass }) %>
@@ -0,0 +1,40 @@
1
+ <section class="section" id="<%= demo.component.symbol_id %>" data-private="<%= demo.component.private? %>">
2
+ <header class="content">
3
+ <div class="grid">
4
+ <div class="grid__item">
5
+ <h3 class="type type--heading type--heading-2">
6
+ <% if title = demo.component.title %>
7
+ <%= title %>
8
+ <% else %>
9
+ <span class="type--code"><%= demo.component.name %></span>
10
+ <% end %>
11
+ </h3>
12
+ </div>
13
+
14
+ <div class="grid__item grid__item--no-flex">
15
+ <div class="docks-button__container">
16
+ <div class="docks-button" data-xray-trigger="<%= demo.name %>">x-ray</div>
17
+ </div>
18
+ </div>
19
+ </div>
20
+ </header>
21
+
22
+ <%
23
+ markup = render(inline: (demo.component.markup || demo.component.helper), layout: false)
24
+ code_details = []
25
+ code_details << { code: demo.component.helper, language: "erb", label: "Helper" } unless demo.component.helper.nil?
26
+ code_details << { code: markup, language: "html", label: "Markup" }
27
+ options = [demo.name].concat demo.joint_variations.map { |variant| variant.name }
28
+ %>
29
+
30
+ <%= docks_code_block(code: code_details, hideable?: true, full_width?: true, hidden?: true, options: options, id: demo.name, demo: demo) %>
31
+ <%#= docks_toggle_container variations: demo.select_variations(group_by_component: true), base_class: demo.component.name %>
32
+
33
+ <% if demo.component.description %>
34
+ <div class="content">
35
+ <div class="type-container">
36
+ <%= demo.component.description %>
37
+ </div>
38
+ </div>
39
+ <% end %>
40
+ </section>
@@ -0,0 +1,70 @@
1
+ <div class="content content--extra-vertical-spacing">
2
+ <div class="section" id="<%= factory.symbol_id %>" data-private="<%= factory.private? %>">
3
+ <h2 class="type type--heading type--heading-2 type--heading-bordered">
4
+ <span class="type--code"><%= factory.name %></span>
5
+ </h2>
6
+
7
+ <div class="type-container"><%= factory.description %></div>
8
+
9
+ <%= docks_code_block(code: factory.signature, language: factory.source.language_code) %>
10
+
11
+ <% unless (params = factory.fetch(:params, [])).empty? %>
12
+ <h4 class="type type--heading type--heading-4">Parameters</h4>
13
+
14
+ <% params.each do |param| %>
15
+ <h5 class="type type--heading type--heading-5">
16
+ <span class="type--code"><%= param.name %></span>
17
+ <span class="badge"><%= param.types.first.name %><%= "[]" if param.types.first.array %></span>
18
+
19
+ <% if param.multiple %>
20
+ <span class="badge">Multiple</span>
21
+ <% end %>
22
+ </h5>
23
+
24
+ <div class="type-container type-container--small"><%= param.description %></div>
25
+
26
+ <% unless (properties = param.properties || []).empty? %>
27
+ <% docks_table do %>
28
+ <thead class="table__header">
29
+ <tr class="table__row">
30
+ <th class="table__cell">Name</th>
31
+ <th class="table__cell">Description</th>
32
+ <th class="table__cell">Types</th>
33
+ <th class="table__cell table__cell--centered">Default</th>
34
+ </tr>
35
+ </thead>
36
+
37
+ <tbody class="table__body">
38
+ <% properties.each do |property| %>
39
+ <tr class="table__row">
40
+ <td class="table__cell"><code class="type--code"><%= property.name %></code></td>
41
+ <td class="table__cell">
42
+ <div class="type-container type-container--small"><%= property.description %></div>
43
+ </td>
44
+ <td class="table__cell"><%= (type = property.types.try(:first)) ? "<span class='type--code'>#{type}</span>".html_safe : "Anything" %></td>
45
+ <td class="table__cell table__cell--centered"><%= (default = property.default) ? "<span class='type--code'>#{default}</span>".html_safe : "&mdash;".html_safe %></td>
46
+ </tr>
47
+ <% end %>
48
+ </tbody>
49
+ <% end %>
50
+ <% end %>
51
+ <% end %>
52
+ <% end %>
53
+
54
+ <% unless (examples = factory.fetch(:examples, [])).empty? %>
55
+ <h4 class="type type--heading type--heading-4"><%= "Example".pluralize(examples.length) %></h4>
56
+
57
+ <% examples.each do |example| %>
58
+ <%= docks_code_block(code: example.code, language: example.language, condensed?: true) %>
59
+ <% end %>
60
+ <% end %>
61
+ </div>
62
+
63
+ <% factory.properties.each do |property| %>
64
+ <%= render partial: "symbols/variable", locals: { variable: property } %>
65
+ <% end %>
66
+
67
+ <% factory.methods.each do |method| %>
68
+ <%= render partial: "symbols/function", locals: { function: method } %>
69
+ <% end %>
70
+ </div>