bitstyles 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. checksums.yaml +7 -0
  2. data/.eslintignore +5 -0
  3. data/.eslintrc +4 -0
  4. data/.github/PULL_REQUEST_TEMPLATE.md +20 -0
  5. data/.gitignore +19 -0
  6. data/.nvmrc +1 -0
  7. data/.stylelintrc +166 -0
  8. data/CODE_OF_CONDUCT.md +49 -0
  9. data/Gemfile +4 -0
  10. data/LICENSE.txt +7 -0
  11. data/README.md +251 -0
  12. data/Rakefile +2 -0
  13. data/bin/console +14 -0
  14. data/bin/setup +8 -0
  15. data/bitstyles.gemspec +29 -0
  16. data/bower.json +31 -0
  17. data/build/.gitignore +4 -0
  18. data/lib/bitstyles/engine.rb +9 -0
  19. data/lib/bitstyles/version.rb +3 -0
  20. data/lib/bitstyles.rb +2 -0
  21. data/package.json +85 -0
  22. data/postcss_build.json +12 -0
  23. data/postcss_lint.json +11 -0
  24. data/scripts/styleguide.sh +16 -0
  25. data/scss/bitstyles/base/_figure.scss +9 -0
  26. data/scss/bitstyles/base/_forms.scss +182 -0
  27. data/scss/bitstyles/base/_hr.scss +6 -0
  28. data/scss/bitstyles/base/_images.scss +13 -0
  29. data/scss/bitstyles/base/_link.scss +32 -0
  30. data/scss/bitstyles/base/_media.scss +24 -0
  31. data/scss/bitstyles/base/_typography.scss +354 -0
  32. data/scss/bitstyles/components/_expander.scss +45 -0
  33. data/scss/bitstyles/components/_modal.scss +170 -0
  34. data/scss/bitstyles/generic/_box-sizing.scss +16 -0
  35. data/scss/bitstyles/generic/_normalize.scss +421 -0
  36. data/scss/bitstyles/layout/_content.scss +33 -0
  37. data/scss/bitstyles/layout/_grid.scss +148 -0
  38. data/scss/bitstyles/layout/_topbar.scss +25 -0
  39. data/scss/bitstyles/layout/_width.scss +48 -0
  40. data/scss/bitstyles/objects/_absolute-center.scss +16 -0
  41. data/scss/bitstyles/objects/_absolute-cover.scss +16 -0
  42. data/scss/bitstyles/objects/_block.scss +14 -0
  43. data/scss/bitstyles/objects/_bordered-header.scss +39 -0
  44. data/scss/bitstyles/objects/_break-long-words.scss +15 -0
  45. data/scss/bitstyles/objects/_button--icon.scss +30 -0
  46. data/scss/bitstyles/objects/_button.scss +103 -0
  47. data/scss/bitstyles/objects/_clearfix.scss +19 -0
  48. data/scss/bitstyles/objects/_expander.scss +45 -0
  49. data/scss/bitstyles/objects/_fixed-ratio.scss +23 -0
  50. data/scss/bitstyles/objects/_flex.scss +24 -0
  51. data/scss/bitstyles/objects/_hidden.scss +33 -0
  52. data/scss/bitstyles/objects/_icon.scss +43 -0
  53. data/scss/bitstyles/objects/_input.scss +83 -0
  54. data/scss/bitstyles/objects/_label.scss +15 -0
  55. data/scss/bitstyles/objects/_link.scss +29 -0
  56. data/scss/bitstyles/objects/_list-reset.scss +25 -0
  57. data/scss/bitstyles/objects/_media.scss +20 -0
  58. data/scss/bitstyles/objects/_truncate-with-ellipsis.scss +18 -0
  59. data/scss/bitstyles/objects/_typography.scss +92 -0
  60. data/scss/bitstyles/objects/_vertical-center.scss +16 -0
  61. data/scss/bitstyles/objects/_visuallyhidden.scss +30 -0
  62. data/scss/bitstyles/settings/_bordered-header.scss +3 -0
  63. data/scss/bitstyles/settings/_button--icon.scss +5 -0
  64. data/scss/bitstyles/settings/_button.scss +18 -0
  65. data/scss/bitstyles/settings/_content.scss +5 -0
  66. data/scss/bitstyles/settings/_global.animation.scss +3 -0
  67. data/scss/bitstyles/settings/_global.breakpoints.scss +12 -0
  68. data/scss/bitstyles/settings/_global.color-base.scss +14 -0
  69. data/scss/bitstyles/settings/_global.color-theme.scss +11 -0
  70. data/scss/bitstyles/settings/_global.layout.scss +7 -0
  71. data/scss/bitstyles/settings/_global.setup.scss +1 -0
  72. data/scss/bitstyles/settings/_global.typography.scss +28 -0
  73. data/scss/bitstyles/settings/_grid.scss +1 -0
  74. data/scss/bitstyles/settings/_hidden.scss +1 -0
  75. data/scss/bitstyles/settings/_icon.scss +5 -0
  76. data/scss/bitstyles/settings/_input.scss +12 -0
  77. data/scss/bitstyles/settings/_link.scss +4 -0
  78. data/scss/bitstyles/settings/_modal.scss +9 -0
  79. data/scss/bitstyles/settings/_topbar.scss +2 -0
  80. data/scss/bitstyles/settings/_visuallyhidden.scss +1 -0
  81. data/scss/bitstyles/settings/_width.scss +12 -0
  82. data/scss/bitstyles/tools/_absolute-center.scss +13 -0
  83. data/scss/bitstyles/tools/_absolute-cover.scss +13 -0
  84. data/scss/bitstyles/tools/_block.scss +9 -0
  85. data/scss/bitstyles/tools/_break-long-words.scss +11 -0
  86. data/scss/bitstyles/tools/_clearfix.scss +13 -0
  87. data/scss/bitstyles/tools/_fixed-ratio.scss +27 -0
  88. data/scss/bitstyles/tools/_flex.scss +15 -0
  89. data/scss/bitstyles/tools/_font-face.scss +21 -0
  90. data/scss/bitstyles/tools/_hidden.scss +11 -0
  91. data/scss/bitstyles/tools/_list-reset.scss +17 -0
  92. data/scss/bitstyles/tools/_media-query.scss +30 -0
  93. data/scss/bitstyles/tools/_media.scss +15 -0
  94. data/scss/bitstyles/tools/_truncate-with-ellipsis.scss +13 -0
  95. data/scss/bitstyles/tools/_typography-conversions.scss +18 -0
  96. data/scss/bitstyles/tools/_typography.scss +17 -0
  97. data/scss/bitstyles/tools/_vertical-center.scss +11 -0
  98. data/scss/bitstyles/tools/_visuallyhidden.scss +18 -0
  99. data/scss/bitstyles/tools/_width.scss +30 -0
  100. data/scss/bitstyles/tools/_zindex.scss +36 -0
  101. data/scss/bitstyles/trumps/_background-color.scss +18 -0
  102. data/scss/bitstyles/trumps/_color.scss +19 -0
  103. data/scss/bitstyles/trumps/_margin.scss +39 -0
  104. data/scss/bitstyles/trumps/_no-margin.scss +39 -0
  105. data/scss/bitstyles/trumps/_no-padding.scss +43 -0
  106. data/scss/bitstyles/trumps/_padding.scss +43 -0
  107. data/scss/bitstyles/trumps/_text-align.scss +21 -0
  108. data/scss/bitstyles/trumps/_text-style.scss +19 -0
  109. data/scss/bitstyles/trumps/_text-weight.scss +25 -0
  110. data/scss/bitstyles.scss +167 -0
  111. data/styleguide/assets/images/icons.svg +12 -0
  112. data/styleguide/assets/images/placeholder_16-9.png +0 -0
  113. data/styleguide/assets/images/placeholder_button.png +0 -0
  114. data/styleguide/assets/javascripts/a11y-dialog.js +135 -0
  115. data/styleguide/assets/javascripts/expander.js +40 -0
  116. data/styleguide/assets/javascripts/modal.js +55 -0
  117. data/styleguide/assets/javascripts/styleguide-init.js +6 -0
  118. data/styleguide/assets/stylesheets/styleguide-extras.css +17 -0
  119. metadata +192 -0
@@ -0,0 +1,30 @@
1
+ // Widths
2
+ //
3
+ // Pass in a list of one or more fractions that you need a row split into e.g. if you need
4
+ // to split some rows into 10 sections and others into 12 sections, call the width mixin
5
+ // with:
6
+ //
7
+ // `$fractions: (10, 12)`
8
+ //
9
+ // From that this mixin will generate width classes in the format:
10
+ //
11
+ // `.l-width--1-of-10` through to `.l-width--10-of-10` and
12
+ // `.l-width--1-of-12` through to `.l-width--12-of-12`
13
+ //
14
+ // Normally it’s best to set the `$bitstyles-widths` and
15
+ // `$bitstyles-widths-breakpoints` variables, and then let the sass in `layout/width`
16
+ // generate your width classes at various breakpoints (see the layout section on widths).
17
+ //
18
+ // Styleguide 2.14
19
+
20
+ @mixin width($fractions, $breakpoint: null) {
21
+ @each $fraction in $fractions {
22
+ @for $index from 1 through $fraction {
23
+ /* stylelint-disable max-nesting-depth */
24
+ .#{$bitstyles-namespace}l-width--#{$index}-of-#{$fraction}#{$breakpoint} {
25
+ width: ($index / $fraction) * 100%; /* stylelint-disable-line declaration-no-important */
26
+ }
27
+ /* stylelint-enable max-nesting-depth */
28
+ }
29
+ }
30
+ }
@@ -0,0 +1,36 @@
1
+ // Z-index
2
+ //
3
+ // This mixin allows you to assign z-index values in a stacking context of
4
+ // your choice.
5
+ // Solves problems outlined at:
6
+ // <http://philipwalton.com/articles/what-no-one-told-you-about-z-index/>
7
+ //
8
+ // Define a global variable (such as $globalz). Assign to it a sass list of
9
+ // stacking contexts.
10
+ // $globalz: stackcontext1;
11
+ // or
12
+ // $globalz: stackcontext1,stackcontext2,stackcontext3;
13
+ // Items further to the right are higher in the stack.
14
+ //
15
+ // Now when you assign a zindex in your Sass, you can choose which stacking
16
+ // context it will be assigned to.
17
+ // .class {
18
+ // z-index: z($globalz, stackcontext1);
19
+ // }
20
+ //
21
+ // The function will then loop through each item, in each stacking context, and
22
+ // assign it a z-index value, based on its declared order in your Sass.
23
+ //
24
+ // Styleguide 2.10
25
+
26
+ @function z($list, $element) {
27
+ $z-index: index($list, $element);
28
+
29
+ @if $z-index {
30
+ @return $z-index;
31
+ }
32
+
33
+ @warn 'There is no item "#{$element}" in this list; choose one of: #{$list}';
34
+
35
+ @return null;
36
+ }
@@ -0,0 +1,18 @@
1
+ // Background Colors
2
+ //
3
+ // Set background color. Actual classnames will vary based on colors defined in the $foreground-color variable
4
+ //
5
+ // markup:
6
+ // <p class="{$modifiers}">Some content here</p>
7
+ //
8
+ // - Base style, inherits from parent
9
+ // .t-background-color--background - Sets color to whatever is defined as your theme’s primary color.
10
+ // .t-background-color--secondary - Sets color to whatever is defined as your theme’s secondary color.
11
+ //
12
+ // Styleguide 3.9
13
+
14
+ @each $name in ($background-colors) {
15
+ .t-background-color--#{$name} {
16
+ background-color: map-get($bitstyles-colors-theme, $name);
17
+ }
18
+ }
@@ -0,0 +1,19 @@
1
+ // Foreground Colors
2
+ //
3
+ // Set foreground color. Actual classnames will vary based on colors defined in the $foreground-color variable
4
+ //
5
+ // markup:
6
+ // <p class="{$modifiers}">Some content here</p>
7
+ //
8
+ // - Base style, inherits from parent
9
+ // .t-color--primary - Sets color to whatever is defined as your theme’s primary color.
10
+ // .t-color--secondary - Sets color to whatever is defined as your theme’s secondary color.
11
+ // .t-color--error - Sets color to whatever is defined as your theme’s error color.
12
+ //
13
+ // Styleguide 3.8
14
+
15
+ @each $name in ($foreground-colors) {
16
+ .t-color--#{$name} {
17
+ color: map-get($bitstyles-colors-theme, $name);
18
+ }
19
+ }
@@ -0,0 +1,39 @@
1
+ // Margins
2
+ //
3
+ // Styleguide 3.1
4
+
5
+ // Margins - individual
6
+ //
7
+ // Add ad-hoc margins to elements.
8
+ //
9
+ // markup:
10
+ // <div class="{$modifiers}"><div class="background-grey">Some content here</div></div>
11
+ //
12
+ // - Base style
13
+ // .t-margin--left - Left margin added.
14
+ // .t-margin--top - Top margin added.
15
+ // .t-margin--right - Right margin added.
16
+ // .t-margin--bottom - Bottom margin added.
17
+ //
18
+ // Styleguide 3.1.1
19
+
20
+ @each $position in (left, top, right, bottom) {
21
+ .#{$bitstyles-namespace}t-margin--#{$position} {
22
+ //styleguide:ignore:start
23
+ margin-#{$position}: $bitstyles-spacing;
24
+ //styleguide:ignore:end
25
+ }
26
+ }
27
+
28
+ // Margins - all sides
29
+ //
30
+ // Add ad-hoc margins to elements.
31
+ //
32
+ // markup:
33
+ // <div class="t-margin"><div class="background-grey">Some content here</div></div>
34
+ //
35
+ // Styleguide 3.1.2
36
+
37
+ .#{$bitstyles-namespace}t-margin {
38
+ margin: $bitstyles-spacing;
39
+ }
@@ -0,0 +1,39 @@
1
+ // No-Margins
2
+ //
3
+ // Styleguide 3.2
4
+
5
+ // No-Margins - individual
6
+ //
7
+ // Remove margins from elements on an ad-hoc basis.
8
+ //
9
+ // markup:
10
+ // <div class="t-margin {$modifiers}"><div class="background-grey">Some content here</div></div>
11
+ //
12
+ // - Base style
13
+ // .t-no-margin--left - Removes left-margin
14
+ // .t-no-margin--top - Removes top-margin
15
+ // .t-no-margin--right - Removes right-margin
16
+ // .t-no-margin--bottom - Removes bottom-margin
17
+ //
18
+ // Styleguide 3.2.1
19
+
20
+ @each $position in (left, top, right, bottom) {
21
+ .#{$bitstyles-namespace}t-no-margin--#{$position} {
22
+ //styleguide:ignore:start
23
+ margin-#{$position}: 0;
24
+ //styleguide:ignore:end
25
+ }
26
+ }
27
+
28
+ // No-Margins - all sides
29
+ //
30
+ // Add ad-hoc margins to elements.
31
+ //
32
+ // markup:
33
+ // <div class="t-margin t-no-margin"><div class="background-grey">Some content here</div></div>
34
+ //
35
+ // Styleguide 3.2.2
36
+
37
+ .#{$bitstyles-namespace}t-no-margin {
38
+ margin: 0;
39
+ }
@@ -0,0 +1,43 @@
1
+ // No-Paddings
2
+ //
3
+ // Styleguide 3.3
4
+
5
+ // No-Paddings - individual
6
+ //
7
+ // Use to remove padding from elements on an ad-hoc basis
8
+ //
9
+ // markup:
10
+ // <div class="background-grey">
11
+ // <div class="t-padding {$modifiers}">Some content here</div>
12
+ // </div>
13
+ //
14
+ // - Base style
15
+ // .t-no-padding--left - Removes left padding.
16
+ // .t-no-padding--top - Removes top padding.
17
+ // .t-no-padding--right - Removes right padding.
18
+ // .t-no-padding--bottom - Removes bottom padding.
19
+ //
20
+ // Styleguide 3.3.1
21
+
22
+ @each $position in (left, top, right, bottom) {
23
+ .#{$bitstyles-namespace}t-no-padding--#{$position} {
24
+ //styleguide:ignore:start
25
+ padding-#{$position}: 0;
26
+ //styleguide:ignore:end
27
+ }
28
+ }
29
+
30
+ // No-Paddings - all sides
31
+ //
32
+ // Use to remove padding from elements on an ad-hoc basis
33
+ //
34
+ // Markup:
35
+ // <div class="background-grey">
36
+ // <div class="t-padding t-no-padding">Some content here</div>
37
+ // </div>
38
+ //
39
+ // Styleguide 3.3.2
40
+
41
+ .#{$bitstyles-namespace}t-no-padding {
42
+ padding: 0;
43
+ }
@@ -0,0 +1,43 @@
1
+ // Paddings
2
+ //
3
+ // Styleguide 3.4
4
+
5
+ // Paddings
6
+ //
7
+ // Use to add ad-hoc padding to elements
8
+ //
9
+ // markup:
10
+ // <div class="background-grey">
11
+ // <div class="{$modifiers}">Some content here.</div>
12
+ // </div>
13
+ //
14
+ // - Base styling
15
+ // .t-padding--left - Add left-padding.
16
+ // .t-padding--top - Add top-padding.
17
+ // .t-padding--right - Add right-padding.
18
+ // .t-padding--bottom - Add bottom-padding.
19
+ //
20
+ // Styleguide 3.4.1
21
+
22
+ @each $position in (left, top, right, bottom) {
23
+ .#{$bitstyles-namespace}t-padding--#{$position} {
24
+ //styleguide:ignore:start
25
+ padding-#{$position}: $bitstyles-spacing;
26
+ //styleguide:ignore:end
27
+ }
28
+ }
29
+
30
+ // Padding, all sides
31
+ //
32
+ // Add ad-hoc padding to elements.
33
+ //
34
+ // Markup:
35
+ // <div class="background-grey">
36
+ // <div class="t-padding">Some content here.</div>
37
+ // </div>
38
+ //
39
+ // Styleguide 3.4.2
40
+
41
+ .#{$bitstyles-namespace}t-padding {
42
+ padding: $bitstyles-spacing;
43
+ }
@@ -0,0 +1,21 @@
1
+ // Text Align
2
+ //
3
+ // Overide text-align on an element
4
+ // Named `.t-text-` for consistency with the other text/font-related trumps.
5
+ //
6
+ // markup:
7
+ // <p class="{$modifiers}">Some content here</p>
8
+ //
9
+ // - Base text
10
+ // .t-text-align--left - Align text left
11
+ // .t-text-align--right - Align text right.
12
+ // .t-text-align--center - Centre align text.
13
+ // .t-text-align--justify - Justify text.
14
+ //
15
+ // Styleguide 3.5
16
+
17
+ @each $position in (left, right, center, justify) {
18
+ .#{$bitstyles-namespace}t-text-align--#{$position} {
19
+ text-align: $position;
20
+ }
21
+ }
@@ -0,0 +1,19 @@
1
+ // Text-style
2
+ //
3
+ // Override font-style of an element.
4
+ // Named `.t-text-` for consistency with the other text/font-related trumps
5
+ //
6
+ // markup:
7
+ // <p class="{$modifiers}">Some content here</p>
8
+ //
9
+ // - Base text
10
+ // .t-text-style--italic - Italicise text.
11
+ // .t-text-style--normal - De-italicise text.
12
+ //
13
+ // Styleguide 3.6
14
+
15
+ @each $style in (italic, normal) {
16
+ .#{$bitstyles-namespace}t-text-style--#{$style} {
17
+ font-style: $style;
18
+ }
19
+ }
@@ -0,0 +1,25 @@
1
+ // Font-weight
2
+ //
3
+ // Named `.t-text-` for consistency with the other text/font-related trumps.
4
+ //
5
+ // markup:
6
+ // <p class="{$modifiers}">Some content here</p>
7
+ //
8
+ // - Base text.
9
+ // .t-text-weight--light - Ensure font-weight is light
10
+ // .t-text-weight--normal - Ensure font-weight is normal
11
+ // .t-text-weight--bold - Ensure font-weight is bold
12
+ //
13
+ // Styleguide 3.7
14
+
15
+ .#{$bitstyles-namespace}t-text-weight--light {
16
+ font-weight: $bitstyles-font-weight-light;
17
+ }
18
+
19
+ .#{$bitstyles-namespace}t-text-weight--normal {
20
+ font-weight: $bitstyles-font-weight-normal;
21
+ }
22
+
23
+ .#{$bitstyles-namespace}t-text-weight--bold {
24
+ font-weight: $bitstyles-font-weight-bold;
25
+ }
@@ -0,0 +1,167 @@
1
+ /* stylelint-disable max-empty-lines */
2
+ // SETTINGS
3
+ // Global settings & settings for each object below (if needed).
4
+ //
5
+ // * No CSS output *
6
+
7
+ //
8
+ // ******** Add overrides for Bitstyles settings here ********
9
+ //
10
+ @import 'bitstyles/settings/global.setup';
11
+ @import 'bitstyles/settings/global.layout';
12
+ @import 'bitstyles/settings/global.breakpoints';
13
+ @import 'bitstyles/settings/global.animation';
14
+ @import 'bitstyles/settings/global.color-base';
15
+ @import 'bitstyles/settings/global.color-theme';
16
+ @import 'bitstyles/settings/global.typography';
17
+ //
18
+ // ******** Add global settings for your own project here ********
19
+ //
20
+
21
+
22
+ // Tools: Functions & Mixins
23
+ //
24
+ // Mixins and functions. Includes mixins we later use to build objects e.g. at different breakpoints,
25
+ // and some we use only in the background as utilities.
26
+ // * No CSS output *
27
+ //
28
+ // Styleguide 2.0
29
+ @import 'bitstyles/tools/zindex';
30
+ @import 'bitstyles/tools/absolute-cover';
31
+ @import 'bitstyles/tools/fixed-ratio';
32
+ @import 'bitstyles/tools/media-query';
33
+ @import 'bitstyles/tools/absolute-center';
34
+ @import 'bitstyles/tools/vertical-center';
35
+ @import 'bitstyles/tools/break-long-words';
36
+ @import 'bitstyles/tools/truncate-with-ellipsis';
37
+ @import 'bitstyles/tools/clearfix';
38
+ @import 'bitstyles/tools/hidden';
39
+ @import 'bitstyles/tools/visuallyhidden';
40
+ @import 'bitstyles/tools/list-reset';
41
+ @import 'bitstyles/tools/font-face';
42
+ @import 'bitstyles/tools/width';
43
+ @import 'bitstyles/tools/typography';
44
+ @import 'bitstyles/tools/typography-conversions';
45
+ @import 'bitstyles/tools/block';
46
+ @import 'bitstyles/tools/flex';
47
+ @import 'bitstyles/tools/media';
48
+ //
49
+ // ******** Add project-specific tools here ********
50
+ //
51
+
52
+
53
+ // ******** GENERIC
54
+ // Low-specificity, far-reaching rulesets (e.g. resets, normalise.css, box-sizing).
55
+ @import 'bitstyles/generic/box-sizing';
56
+ @import 'bitstyles/generic/normalize';
57
+
58
+ // Base
59
+ //
60
+ // Unclassed elements. (Directly selects elements e.g. `<a>`, `<blockquote>`, `<address>`).
61
+ //
62
+ // sg-wrapper:
63
+ // <div class="object-section">
64
+ // <sg-wrapper-content/>
65
+ // </div>
66
+ //
67
+ // Styleguide 4.0
68
+ @import 'bitstyles/base/typography';
69
+ @import 'bitstyles/base/link';
70
+ @import 'bitstyles/base/images';
71
+ @import 'bitstyles/base/forms'; // FOR TESTING ONLY - Empty of styles
72
+ @import 'bitstyles/base/media'; // FOR TESTING ONLY - Empty of styles
73
+ @import 'bitstyles/base/hr'; // FOR TESTING ONLY - Empty of styles
74
+ @import 'bitstyles/base/figure'; // FOR TESTING ONLY - Empty of styles
75
+
76
+ // Layout
77
+ //
78
+ // Classes that enable the high-level layout of a page.
79
+ //
80
+ // sg-wrapper:
81
+ // <div class="object-section">
82
+ // <sg-wrapper-content/>
83
+ // </div>
84
+ //
85
+ // Styleguide 5.0
86
+ @import 'bitstyles/layout/content';
87
+ @import 'bitstyles/layout/grid';
88
+ @import 'bitstyles/layout/width';
89
+ @import 'bitstyles/layout/topbar';
90
+
91
+ // Objects
92
+ //
93
+ // Objects, abstractions, and design patterns (e.g. .media, .icon, .button). Cosmetic-free.
94
+ // These are intended to be reused throughout the site, composed together as needed e.g. <div class="button expander-toggle"></div>
95
+ //
96
+ // sg-wrapper:
97
+ // <div class="object-section">
98
+ // <sg-wrapper-content/>
99
+ // </div>
100
+ //
101
+ // Styleguide 1.0
102
+ @import 'bitstyles/objects/icon';
103
+ @import 'bitstyles/objects/button';
104
+ @import 'bitstyles/objects/button--icon';
105
+ @import 'bitstyles/objects/absolute-center';
106
+ @import 'bitstyles/objects/absolute-cover';
107
+ @import 'bitstyles/objects/break-long-words';
108
+ @import 'bitstyles/objects/clearfix';
109
+ @import 'bitstyles/objects/fixed-ratio';
110
+ @import 'bitstyles/objects/hidden';
111
+ @import 'bitstyles/objects/truncate-with-ellipsis';
112
+ @import 'bitstyles/objects/vertical-center';
113
+ @import 'bitstyles/objects/visuallyhidden';
114
+ @import 'bitstyles/objects/flex';
115
+ @import 'bitstyles/objects/bordered-header';
116
+ @import 'bitstyles/objects/list-reset';
117
+ @import 'bitstyles/objects/typography';
118
+ @import 'bitstyles/objects/media';
119
+ @import 'bitstyles/objects/block';
120
+ @import 'bitstyles/objects/input';
121
+ @import 'bitstyles/objects/label';
122
+ @import 'bitstyles/objects/link';
123
+ //
124
+ // ******** Add project-specific low-level objects here ********
125
+ //
126
+
127
+
128
+ // Components
129
+ //
130
+ // Chunks of UI e.g. the structure for a page type, a single block of UI composed of smaller objects.
131
+ //
132
+ // sg-wrapper:
133
+ // <div class="object-section">
134
+ // <sg-wrapper-content/>
135
+ // </div>
136
+ //
137
+ // Styleguide 6.0
138
+ @import 'bitstyles/components/modal';
139
+ @import 'bitstyles/components/expander';
140
+ //
141
+ // ******** Add project-specific components here ********
142
+ //
143
+
144
+
145
+ // Trumps
146
+ //
147
+ // High-specificity overrides and helper classes (e.g. .hidden {}). `!important` exists here.
148
+ //
149
+ // sg-wrapper:
150
+ // <div class="object-section">
151
+ // <sg-wrapper-content/>
152
+ // </div>
153
+ //
154
+ // Styleguide 3.0
155
+ @import 'bitstyles/trumps/text-weight';
156
+ @import 'bitstyles/trumps/text-align';
157
+ @import 'bitstyles/trumps/text-style';
158
+ @import 'bitstyles/trumps/margin';
159
+ @import 'bitstyles/trumps/padding';
160
+ @import 'bitstyles/trumps/no-margin';
161
+ @import 'bitstyles/trumps/no-padding';
162
+ @import 'bitstyles/trumps/color';
163
+ @import 'bitstyles/trumps/background-color';
164
+ //
165
+ // ******** Add project-specific trumps here ********
166
+ //
167
+ /* stylelint-enable */
@@ -0,0 +1,12 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg">
2
+ <defs>
3
+ <symbol id="icon-twitter" viewBox="0 0 500 500">
4
+ <title>Twitter logo</title>
5
+ <path d="M500,95.5a214.6,214.6,0,0,1-59.9,16.3c21.8-12.3,38.1-32.7,46.3-57.2C466,65.5,442.8,75,419.6,79.1a103.1,103.1,0,0,0-178.4,70.8,77.7,77.7,0,0,0,4.1,24.5c-85.8-4.1-160.8-45-211.2-107.6-9.5,16.3-13.6,32.7-13.6,53.1,0,36.8,19.1,68.1,46.3,84.5-17.7,0-32.7-4.1-46.3-12.3v1.4c0,50.4,36.8,91.3,83.1,100.8A104.6,104.6,0,0,1,75,298.4c-6.8,0-12.3,0-19.1-1.4,12.3,40.9,50.4,70.8,96.7,70.8-34.1,28.6-80.4,45-128.1,45-8.2,0-16.3,0-24.5-1.4,40.9,27.2,94,42.2,152.6,42.2,190.7,0,294.3-156.7,294.3-292.9V147.1c20.4-13.5,40.8-31.2,53.1-51.6h0Z"/>
6
+ </symbol>
7
+ <symbol id="icon-arrow-up" viewBox="0 0 200 200">
8
+ <title>arrow-up</title>
9
+ <path d="M100,57.3a2,2,0,0,1,1.6.8l81.5,84.8a.1.1,0,0,0,0-.1.9.9,0,0,1,.8,0L104.3,60,100,55.5,95.7,60,16.1,142.8a.9.9,0,0,1,.8,0,.1.1,0,0,0,0,.1L98.4,58a1.9,1.9,0,0,1,1.6-.8h0Zm0-11.9a13.3,13.3,0,0,0-10.5,4.8L8.3,134.7a11.7,11.7,0,0,0,0,16.3,11.2,11.2,0,0,0,15.8.6l.6-.6,79.6-82.8H95.7L175.3,151a11.2,11.2,0,0,0,15.8.6l.6-.6a11.7,11.7,0,0,0,0-16.3L110.2,49.8a13.8,13.8,0,0,0-10.1-4.4H100Z"/>
10
+ </symbol>
11
+ </defs>
12
+ </svg>
@@ -0,0 +1,135 @@
1
+ /* eslint-disable */
2
+ (function (global) {
3
+ 'use strict';
4
+
5
+ // Helper function for dispatching cross browser dispatch events
6
+ // from http://youmightnotneedjquery.com/#trigger_custom
7
+ function dispatchEvent (el, eventName) {
8
+ // IE < Edge Polyfill
9
+ // from https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent
10
+ function _CustomEvent (event, params) {
11
+ params = params || { bubbles: false, cancelable: false, detail: undefined };
12
+ var evt = document.createEvent('CustomEvent');
13
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
14
+ return evt;
15
+ }
16
+
17
+ _CustomEvent.prototype = global.Event.prototype;
18
+
19
+ var event;
20
+
21
+ if (global.CustomEvent) {
22
+ event = new global.CustomEvent(eventName);
23
+ } else {
24
+ event = new _CustomEvent(eventName)
25
+ }
26
+
27
+ event && el.dispatchEvent(event);
28
+ }
29
+
30
+ // Helper function to get all focusable children from a node
31
+ function getFocusableChildren (node) {
32
+ var focusableElements = ['a[href]', 'area[href]', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])', 'button:not([disabled])', 'iframe', 'object', 'embed', '[contenteditable]', '[tabindex]:not([tabindex^="-"])'];
33
+
34
+ return $$(focusableElements.join(','), node).filter(function (child) {
35
+ return !!(child.offsetWidth || child.offsetHeight || child.getClientRects().length);
36
+ });
37
+ }
38
+
39
+ // Helper function to get all nodes in context matching selector as an array
40
+ function $$ (selector, context) {
41
+ return Array.prototype.slice.call((context || document).querySelectorAll(selector));
42
+ }
43
+
44
+ // Helper function trapping the tab key inside a node
45
+ function trapTabKey (node, event) {
46
+ var focusableChildren = getFocusableChildren(node);
47
+ var focusedItemIndex = focusableChildren.indexOf(document.activeElement);
48
+
49
+ if (event.shiftKey && focusedItemIndex === 0) {
50
+ focusableChildren[focusableChildren.length - 1].focus();
51
+ event.preventDefault();
52
+ } else if (!event.shiftKey && focusedItemIndex === focusableChildren.length - 1) {
53
+ focusableChildren[0].focus();
54
+ event.preventDefault();
55
+ }
56
+ }
57
+
58
+ // Helper function to focus first focusable item in node
59
+ function setFocusToFirstItem (node) {
60
+ var focusableChildren = getFocusableChildren(node);
61
+ if (focusableChildren.length) focusableChildren[0].focus();
62
+ }
63
+
64
+ var focusedBeforeDialog;
65
+
66
+ /**
67
+ * A11yDialog constructor
68
+ * @param {Node} node - Dialog element
69
+ * @param {Node} main - Main element of the page
70
+ */
71
+ var A11yDialog = function (node, main) {
72
+ var namespace = 'data-a11y-dialog';
73
+ var that = this;
74
+ main = main || document.querySelector('#main');
75
+
76
+ this.shown = false;
77
+ this.show = show;
78
+ this.hide = hide;
79
+
80
+ $$('[' + namespace + '-show="' + node.id + '"]').forEach(function (opener) {
81
+ opener.addEventListener('click', show);
82
+ });
83
+
84
+ $$('[' + namespace + '-hide]', node).concat($$('[' + namespace + '-hide="' + node.id + '"]')).forEach(function (closer) {
85
+ closer.addEventListener('click', hide);
86
+ });
87
+
88
+ document.addEventListener('keydown', function (event) {
89
+ if (that.shown && event.which === 27) {
90
+ event.preventDefault();
91
+ hide();
92
+ }
93
+
94
+ if (that.shown && event.which === 9) {
95
+ trapTabKey(node, event);
96
+ }
97
+ });
98
+
99
+ function maintainFocus (event) {
100
+ if (that.shown && !node.contains(event.target)) {
101
+ setFocusToFirstItem(node);
102
+ }
103
+ }
104
+
105
+ function show () {
106
+ that.shown = true;
107
+ node.removeAttribute('aria-hidden');
108
+ main.setAttribute('aria-hidden', 'true');
109
+ focusedBeforeDialog = document.activeElement;
110
+ setFocusToFirstItem(node);
111
+ document.body.addEventListener('focus', maintainFocus, true);
112
+ dispatchEvent(node, 'dialog:show');
113
+ }
114
+
115
+ function hide () {
116
+ that.shown = false;
117
+ node.setAttribute('aria-hidden', 'true');
118
+ main.removeAttribute('aria-hidden');
119
+ focusedBeforeDialog && focusedBeforeDialog.focus();
120
+ document.body.removeEventListener('focus', maintainFocus, true);
121
+ dispatchEvent(node, 'dialog:hide');
122
+ }
123
+ };
124
+
125
+ if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') {
126
+ module.exports = A11yDialog;
127
+ } else if (typeof define === 'function' && define.amd) {
128
+ define('A11yDialog', [], function () {
129
+ return A11yDialog;
130
+ });
131
+ } else if (typeof global === 'object') {
132
+ global.A11yDialog = A11yDialog;
133
+ }
134
+ }(window));
135
+ /* eslint-enable */