claritas-web-framework 5.0.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 (162) hide show
  1. package/dist/index.css +7 -0
  2. package/images/block.svg +3 -0
  3. package/images/check.svg +3 -0
  4. package/images/chevron-down.svg +1 -0
  5. package/images/menu.svg +3 -0
  6. package/images/remove.svg +3 -0
  7. package/images/subdirectory.svg +3 -0
  8. package/images/upload.svg +3 -0
  9. package/index.js +2 -0
  10. package/js/defaults/getPage.js +4 -0
  11. package/js/defaults/getSiblings.js +3 -0
  12. package/js/polyfills/customevent.js +16 -0
  13. package/js/utilities/debounce.js +27 -0
  14. package/js/utilities/isElement.js +11 -0
  15. package/js/utilities/removehash.js +8 -0
  16. package/package.json +33 -0
  17. package/postcss.config.js +45 -0
  18. package/scss/_base.scss +3 -0
  19. package/scss/_functions.scss +302 -0
  20. package/scss/_helpers.scss +7 -0
  21. package/scss/_mixins.scss +12 -0
  22. package/scss/_modules.scss +17 -0
  23. package/scss/_reboot.scss +403 -0
  24. package/scss/_root.scss +30 -0
  25. package/scss/_utilities.scss +17 -0
  26. package/scss/_variables.scss +500 -0
  27. package/scss/helpers/_container.scss +8 -0
  28. package/scss/helpers/_embed.scss +41 -0
  29. package/scss/helpers/_grid.scss +39 -0
  30. package/scss/helpers/_image.scss +5 -0
  31. package/scss/helpers/_link.scss +18 -0
  32. package/scss/helpers/_screenReaders.scss +22 -0
  33. package/scss/helpers/_wrap.scss +3 -0
  34. package/scss/index.scss +7 -0
  35. package/scss/mixins/_breakpoints.scss +123 -0
  36. package/scss/mixins/_button.scss +92 -0
  37. package/scss/mixins/_card.scss +31 -0
  38. package/scss/mixins/_caret.scss +33 -0
  39. package/scss/mixins/_clearfix.scss +7 -0
  40. package/scss/mixins/_close.scss +40 -0
  41. package/scss/mixins/_container.scss +20 -0
  42. package/scss/mixins/_grid.scss +20 -0
  43. package/scss/mixins/_group.scss +78 -0
  44. package/scss/mixins/_list.scss +22 -0
  45. package/scss/mixins/_pill.scss +44 -0
  46. package/scss/mixins/_table.scss +93 -0
  47. package/scss/mixins/_wrap.scss +7 -0
  48. package/scss/modules/_alert.scss +47 -0
  49. package/scss/modules/_button.scss +260 -0
  50. package/scss/modules/_card.scss +71 -0
  51. package/scss/modules/_close.scss +3 -0
  52. package/scss/modules/_details.scss +61 -0
  53. package/scss/modules/_dialog.scss +82 -0
  54. package/scss/modules/_dropdown.scss +74 -0
  55. package/scss/modules/_form.scss +191 -0
  56. package/scss/modules/_list.scss +88 -0
  57. package/scss/modules/_loader.scss +226 -0
  58. package/scss/modules/_nav.scss +92 -0
  59. package/scss/modules/_pill.scss +37 -0
  60. package/scss/modules/_table.scss +19 -0
  61. package/scss/modules/_tabs.scss +99 -0
  62. package/scss/modules/_tag.scss +82 -0
  63. package/scss/modules/_tile.scss +82 -0
  64. package/scss/modules/_tooltip.scss +127 -0
  65. package/scss/modules/form/_checkbox.scss +99 -0
  66. package/scss/modules/form/_file.scss +109 -0
  67. package/scss/modules/form/_formFieldGroup.scss +74 -0
  68. package/scss/modules/form/_output.scss +5 -0
  69. package/scss/modules/form/_progress.scss +57 -0
  70. package/scss/modules/form/_radio.scss +49 -0
  71. package/scss/modules/form/_range.scss +104 -0
  72. package/scss/modules/form/_select.scss +22 -0
  73. package/scss/modules/form/_text.scss +19 -0
  74. package/scss/utilities/_align.scss +21 -0
  75. package/scss/utilities/_border.scss +63 -0
  76. package/scss/utilities/_colors.scss +68 -0
  77. package/scss/utilities/_display.scss +21 -0
  78. package/scss/utilities/_flex.scss +55 -0
  79. package/scss/utilities/_float.scss +13 -0
  80. package/scss/utilities/_order.scss +19 -0
  81. package/scss/utilities/_overflow.scss +21 -0
  82. package/scss/utilities/_pointerEvents.scss +13 -0
  83. package/scss/utilities/_position.scss +43 -0
  84. package/scss/utilities/_shadow.scss +5 -0
  85. package/scss/utilities/_size.scss +63 -0
  86. package/scss/utilities/_spacing.scss +79 -0
  87. package/scss/utilities/_translate.scss +15 -0
  88. package/scss/utilities/_typography.scss +58 -0
  89. package/scss/utilities/_visibility.scss +13 -0
  90. package/scss/utilities/_zIndex.scss +11 -0
  91. package/styles/helpers/container.css +21 -0
  92. package/styles/helpers/embed.css +70 -0
  93. package/styles/helpers/grid.css +64 -0
  94. package/styles/helpers/image.css +5 -0
  95. package/styles/helpers/link.css +20 -0
  96. package/styles/helpers/screen-readers.css +22 -0
  97. package/styles/helpers/wrap.css +5 -0
  98. package/styles/helpers.css +7 -0
  99. package/styles/index.css +6 -0
  100. package/styles/mixins/caret.css +32 -0
  101. package/styles/mixins/clearfix.css +7 -0
  102. package/styles/mixins/group.css +78 -0
  103. package/styles/mixins/helpers/container.css +12 -0
  104. package/styles/mixins/helpers/grid.css +20 -0
  105. package/styles/mixins/helpers/link.css +18 -0
  106. package/styles/mixins/helpers/wrap.css +7 -0
  107. package/styles/mixins/modules/button.css +92 -0
  108. package/styles/mixins/modules/card.css +29 -0
  109. package/styles/mixins/modules/close.css +42 -0
  110. package/styles/mixins/modules/list.css +24 -0
  111. package/styles/mixins/modules/pill.css +44 -0
  112. package/styles/mixins/modules/table.css +75 -0
  113. package/styles/mixins.css +13 -0
  114. package/styles/modules/alert.css +85 -0
  115. package/styles/modules/breadcrumbs.css +41 -0
  116. package/styles/modules/button.css +151 -0
  117. package/styles/modules/card.css +80 -0
  118. package/styles/modules/close.css +5 -0
  119. package/styles/modules/details.css +61 -0
  120. package/styles/modules/dialog.css +82 -0
  121. package/styles/modules/dropdown.css +126 -0
  122. package/styles/modules/form/checkbox.css +99 -0
  123. package/styles/modules/form/file.css +117 -0
  124. package/styles/modules/form/form-field-group.css +74 -0
  125. package/styles/modules/form/output.css +5 -0
  126. package/styles/modules/form/progress.css +57 -0
  127. package/styles/modules/form/radio.css +49 -0
  128. package/styles/modules/form/range.css +104 -0
  129. package/styles/modules/form/select.css +24 -0
  130. package/styles/modules/form/text.css +19 -0
  131. package/styles/modules/form.css +191 -0
  132. package/styles/modules/list.css +98 -0
  133. package/styles/modules/loader.css +229 -0
  134. package/styles/modules/nav.css +99 -0
  135. package/styles/modules/pill.css +72 -0
  136. package/styles/modules/table.css +21 -0
  137. package/styles/modules/tabs.css +101 -0
  138. package/styles/modules/tag.css +117 -0
  139. package/styles/modules/tile.css +114 -0
  140. package/styles/modules.css +17 -0
  141. package/styles/reboot.css +403 -0
  142. package/styles/utilities/align.css +5 -0
  143. package/styles/utilities/border.css +55 -0
  144. package/styles/utilities/colors.css +65 -0
  145. package/styles/utilities/display.css +45 -0
  146. package/styles/utilities/flex.css +131 -0
  147. package/styles/utilities/float.css +15 -0
  148. package/styles/utilities/order.css +33 -0
  149. package/styles/utilities/overflow.css +31 -0
  150. package/styles/utilities/pointer-events.css +5 -0
  151. package/styles/utilities/position.css +79 -0
  152. package/styles/utilities/shadow.css +5 -0
  153. package/styles/utilities/size.css +123 -0
  154. package/styles/utilities/spacing.css +866 -0
  155. package/styles/utilities/tooltip.css +127 -0
  156. package/styles/utilities/translate.css +15 -0
  157. package/styles/utilities/typography.css +74 -0
  158. package/styles/utilities/visibility.css +14 -0
  159. package/styles/utilities/zindex.css +7 -0
  160. package/styles/utilities.css +18 -0
  161. package/styles/vars.css +158 -0
  162. package/webpack.config.js +25 -0
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
2
+ <path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zM4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12zm8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8z" />
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
2
+ <path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z" />
3
+ </svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down"><polyline points="6 9 12 15 18 9"></polyline></svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
2
+ <path d="M3 18h18v-2H3v2zm0-5h18v-2H3v2zm0-7v2h18V6H3z" />
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
2
+ <path d="M19 13H5v-2h14v2z" />
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
2
+ <path d="M19 15l-6 6-1.42-1.42L15.17 16H4V4h2v10h9.17l-3.59-3.58L13 9l6 6z" />
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24" viewBox="0 0 24 24" width="24">
2
+ <path d="M9 16h6v-6h4l-7-7-7 7h4zm-4 2h14v2H5z" />
3
+ </svg>
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ // Import CSS
2
+ import './styles/index.css';
@@ -0,0 +1,4 @@
1
+ export default String.prototype.getPage = function () {
2
+ const urlArray = this.split('/');
3
+ return urlArray[urlArray.length - 1].split('?')[0];
4
+ };
@@ -0,0 +1,3 @@
1
+ export default Node.prototype.getSiblings = function () {
2
+ return Array.from(this.parentNode.children).filter(sibling => sibling !== this);
3
+ };
@@ -0,0 +1,16 @@
1
+ (function () {
2
+ 'use strict';
3
+
4
+ if (typeof window.CustomEvent === 'function') return false; //If not IE
5
+
6
+ function CustomEvent(event, params) {
7
+ params = params || { bubbles: false, cancelable: false, detail: undefined };
8
+ var evt = document.createEvent('CustomEvent');
9
+ evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
10
+ return evt;
11
+ }
12
+
13
+ CustomEvent.prototype = window.Event.prototype;
14
+
15
+ window.Event = CustomEvent;
16
+ })();
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Debounce functions for better performance
3
+ * @param {Function} fn The function to debounce
4
+ */
5
+ export function debounce(fn) {
6
+ 'use strict';
7
+
8
+ // Setup a timer
9
+ let timeout;
10
+
11
+ // Return a function to run debounced
12
+ return () => {
13
+
14
+ // Setup the arguments
15
+ let context = this;
16
+ let args = arguments;
17
+
18
+ // If there's a timer, cancel it
19
+ if (timeout) {
20
+ window.cancelAnimationFrame(timeout);
21
+ }
22
+
23
+ // Setup the new requestAnimationFrame()
24
+ timeout = window.requestAnimationFrame(() => fn.apply(context, args));
25
+ };
26
+
27
+ }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @desc Checks if an element exists in the DOM
3
+ * @param {Element} element The element to check
4
+ * @return {Boolean} The outcome of the check
5
+ * @example isElement('#myElement');
6
+ */
7
+ export function isElement(element) {
8
+ 'use strict';
9
+
10
+ return document.body.contains(document.querySelector(element)) ? true : false;
11
+ }
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @desc Removes the hash from the page url.
3
+ */
4
+ export function removeHash() {
5
+ 'use strict';
6
+
7
+ return history.pushState('', document.title, window.location.pathname + window.location.search);
8
+ }
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "claritas-web-framework",
3
+ "version": "5.0.0",
4
+ "updated": "21/01/2022",
5
+ "description": "The CSS framework built for Claritas front end.",
6
+ "main": "index.js",
7
+ "scripts": {
8
+ "build": "webpack --config webpack.config.js --mode production"
9
+ },
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+ssh://10.10.10.21/GitRepositories/ClaWebFramework"
13
+ },
14
+ "author": "David Brooks",
15
+ "license": "ISC",
16
+ "devDependencies": {
17
+ "@alexlafroscia/postcss-color-mod-function": "^4.0.0",
18
+ "css-loader": "^6.7.1",
19
+ "cssnano": "^5.1.7",
20
+ "mini-css-extract-plugin": "^2.6.0",
21
+ "postcss": "^8.4.12",
22
+ "postcss-advanced-variables": "^3.0.1",
23
+ "postcss-inline-svg": "^5.0.0",
24
+ "postcss-loader": "^6.2.1",
25
+ "postcss-percentage": "0.0.0",
26
+ "postcss-preset-env": "^7.4.3",
27
+ "postcss-scss": "^4.0.3",
28
+ "sass": "^1.49.11",
29
+ "sass-loader": "^12.6.0",
30
+ "webpack": "^5.71.0",
31
+ "webpack-cli": "^4.9.2"
32
+ }
33
+ }
@@ -0,0 +1,45 @@
1
+ const postcssAdvancedVar = require("postcss-advanced-variables");
2
+ const postcssPresetEnv = require("postcss-preset-env");
3
+ const postcssColorMod = require("@alexlafroscia/postcss-color-mod-function");
4
+ const postcssPercentage = require("postcss-percentage");
5
+ const postcssInlineSvg = require("postcss-inline-svg");
6
+ const cssNano = require("cssnano");
7
+
8
+ module.exports = {
9
+ plugins: [
10
+ postcssAdvancedVar({}),
11
+ postcssColorMod({
12
+ importFrom: [
13
+ "./styles/vars.css",
14
+ ],
15
+ unresolved: "warn"
16
+ }),
17
+ postcssPresetEnv({
18
+ importFrom: "./styles/index.css",
19
+ stage: 0
20
+ }),
21
+ postcssPercentage({}),
22
+ postcssInlineSvg({
23
+ paths: [
24
+ "./images/"
25
+ ],
26
+ removeFill: true,
27
+ removeStroke: true
28
+ }),
29
+ cssNano({
30
+ preset: [
31
+ "default",
32
+ {
33
+ discardComments: {
34
+ removeAll: true
35
+ },
36
+ autoprefixer: true,
37
+ colorMin: false,
38
+ mergeLonghand: false,
39
+ mergeRules: false,
40
+ minifySelectors: false
41
+ }
42
+ ]
43
+ })
44
+ ]
45
+ }
@@ -0,0 +1,3 @@
1
+ @import "functions";
2
+ @import "variables";
3
+ @import "mixins";
@@ -0,0 +1,302 @@
1
+ // Bootstrap functions
2
+ //
3
+ // Utility mixins and functions for evaluating source code across our variables, maps, and mixins.
4
+
5
+ // Ascending
6
+ // Used to evaluate Sass maps like our grid breakpoints.
7
+ @mixin _assert-ascending($map, $map-name) {
8
+ $prev-key: null;
9
+ $prev-num: null;
10
+ @each $key, $num in $map {
11
+ @if $prev-num == null or unit($num) == "%" or unit($prev-num) == "%" {
12
+ // Do nothing
13
+ } @else if not comparable($prev-num, $num) {
14
+ @warn "Potentially invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} whose unit makes it incomparable to #{$prev-num}, the value of the previous key '#{$prev-key}' !";
15
+ } @else if $prev-num >= $num {
16
+ @warn "Invalid value for #{$map-name}: This map must be in ascending order, but key '#{$key}' has value #{$num} which isn't greater than #{$prev-num}, the value of the previous key '#{$prev-key}' !";
17
+ }
18
+ $prev-key: $key;
19
+ $prev-num: $num;
20
+ }
21
+ }
22
+
23
+ // Starts at zero
24
+ // Used to ensure the min-width of the lowest breakpoint starts at 0.
25
+ @mixin _assert-starts-at-zero($map, $map-name: "$breakpoints") {
26
+ @if length($map) > 0 {
27
+ $values: map-values($map);
28
+ $first-value: nth($values, 1);
29
+ @if $first-value != 0 {
30
+ @warn "First breakpoint in #{$map-name} must start at 0, but starts at #{$first-value}.";
31
+ }
32
+ }
33
+ }
34
+
35
+ // Colors
36
+ @function to-rgb($value) {
37
+ @return red($value), green($value), blue($value);
38
+ }
39
+
40
+ // stylelint-disable scss/dollar-variable-pattern
41
+ @function rgba-css-var($identifier, $target) {
42
+ @if $identifier == "body" and $target == "bg" {
43
+ @return rgba(var(--#{$variable-prefix}#{$identifier}-bg-rgb), var(--#{$variable-prefix}#{$target}-opacity));
44
+ } @if $identifier == "body" and $target == "text" {
45
+ @return rgba(var(--#{$variable-prefix}#{$identifier}-color-rgb), var(--#{$variable-prefix}#{$target}-opacity));
46
+ } @else {
47
+ @return rgba(var(--#{$variable-prefix}#{$identifier}-rgb), var(--#{$variable-prefix}#{$target}-opacity));
48
+ }
49
+ }
50
+
51
+ @function map-loop($map, $func, $args...) {
52
+ $_map: ();
53
+
54
+ @each $key, $value in $map {
55
+ // allow to pass the $key and $value of the map as an function argument
56
+ $_args: ();
57
+ @each $arg in $args {
58
+ $_args: append($_args, if($arg == "$key", $key, if($arg == "$value", $value, $arg)));
59
+ }
60
+
61
+ $_map: map-merge($_map, ($key: call(get-function($func), $_args...)));
62
+ }
63
+
64
+ @return $_map;
65
+ }
66
+ // stylelint-enable scss/dollar-variable-pattern
67
+
68
+ @function varify($list) {
69
+ $result: null;
70
+ @each $entry in $list {
71
+ $result: append($result, var(--#{$variable-prefix}#{$entry}), space);
72
+ }
73
+ @return $result;
74
+ }
75
+
76
+ // Internal Bootstrap function to turn maps into its negative variant.
77
+ // It prefixes the keys with `n` and makes the value negative.
78
+ @function negativify-map($map) {
79
+ $result: ();
80
+ @each $key, $value in $map {
81
+ @if $key != 0 {
82
+ $result: map-merge($result, ("n" + $key: (-$value)));
83
+ }
84
+ }
85
+ @return $result;
86
+ }
87
+
88
+ // Get multiple keys from a sass map
89
+ @function map-get-multiple($map, $values) {
90
+ $result: ();
91
+ @each $key, $value in $map {
92
+ @if (index($values, $key) != null) {
93
+ $result: map-merge($result, ($key: $value));
94
+ }
95
+ }
96
+ @return $result;
97
+ }
98
+
99
+ // Merge multiple maps
100
+ @function map-merge-multiple($maps...) {
101
+ $merged-maps: ();
102
+
103
+ @each $map in $maps {
104
+ $merged-maps: map-merge($merged-maps, $map);
105
+ }
106
+ @return $merged-maps;
107
+ }
108
+
109
+ // Replace `$search` with `$replace` in `$string`
110
+ // Used on our SVG icon backgrounds for custom forms.
111
+ //
112
+ // @author Hugo Giraudel
113
+ // @param {String} $string - Initial string
114
+ // @param {String} $search - Substring to replace
115
+ // @param {String} $replace ('') - New value
116
+ // @return {String} - Updated string
117
+ @function str-replace($string, $search, $replace: "") {
118
+ $index: str-index($string, $search);
119
+
120
+ @if $index {
121
+ @return str-slice($string, 1, $index - 1) + $replace + str-replace(str-slice($string, $index + str-length($search)), $search, $replace);
122
+ }
123
+
124
+ @return $string;
125
+ }
126
+
127
+ // See https://codepen.io/kevinweber/pen/dXWoRw
128
+ //
129
+ // Requires the use of quotes around data URIs.
130
+
131
+ @function escape-svg($string) {
132
+ @if str-index($string, "data:image/svg+xml") {
133
+ @each $char, $encoded in $escaped-characters {
134
+ // Do not escape the url brackets
135
+ @if str-index($string, "url(") == 1 {
136
+ $string: url("#{str-replace(str-slice($string, 6, -3), $char, $encoded)}");
137
+ } @else {
138
+ $string: str-replace($string, $char, $encoded);
139
+ }
140
+ }
141
+ }
142
+
143
+ @return $string;
144
+ }
145
+
146
+ // Color contrast
147
+ // See https://github.com/twbs/bootstrap/pull/30168
148
+
149
+ // A list of pre-calculated numbers of pow(divide((divide($value, 255) + .055), 1.055), 2.4). (from 0 to 255)
150
+ // stylelint-disable-next-line scss/dollar-variable-default, scss/dollar-variable-pattern
151
+ $_luminance-list: .0008 .001 .0011 .0013 .0015 .0017 .002 .0022 .0025 .0027 .003 .0033 .0037 .004 .0044 .0048 .0052 .0056 .006 .0065 .007 .0075 .008 .0086 .0091 .0097 .0103 .011 .0116 .0123 .013 .0137 .0144 .0152 .016 .0168 .0176 .0185 .0194 .0203 .0212 .0222 .0232 .0242 .0252 .0262 .0273 .0284 .0296 .0307 .0319 .0331 .0343 .0356 .0369 .0382 .0395 .0409 .0423 .0437 .0452 .0467 .0482 .0497 .0513 .0529 .0545 .0561 .0578 .0595 .0612 .063 .0648 .0666 .0685 .0704 .0723 .0742 .0762 .0782 .0802 .0823 .0844 .0865 .0887 .0908 .0931 .0953 .0976 .0999 .1022 .1046 .107 .1095 .1119 .1144 .117 .1195 .1221 .1248 .1274 .1301 .1329 .1356 .1384 .1413 .1441 .147 .15 .1529 .1559 .159 .162 .1651 .1683 .1714 .1746 .1779 .1812 .1845 .1878 .1912 .1946 .1981 .2016 .2051 .2086 .2122 .2159 .2195 .2232 .227 .2307 .2346 .2384 .2423 .2462 .2502 .2542 .2582 .2623 .2664 .2705 .2747 .2789 .2831 .2874 .2918 .2961 .3005 .305 .3095 .314 .3185 .3231 .3278 .3325 .3372 .3419 .3467 .3515 .3564 .3613 .3663 .3712 .3763 .3813 .3864 .3916 .3968 .402 .4072 .4125 .4179 .4233 .4287 .4342 .4397 .4452 .4508 .4564 .4621 .4678 .4735 .4793 .4851 .491 .4969 .5029 .5089 .5149 .521 .5271 .5333 .5395 .5457 .552 .5583 .5647 .5711 .5776 .5841 .5906 .5972 .6038 .6105 .6172 .624 .6308 .6376 .6445 .6514 .6584 .6654 .6724 .6795 .6867 .6939 .7011 .7084 .7157 .7231 .7305 .7379 .7454 .7529 .7605 .7682 .7758 .7835 .7913 .7991 .807 .8148 .8228 .8308 .8388 .8469 .855 .8632 .8714 .8796 .8879 .8963 .9047 .9131 .9216 .9301 .9387 .9473 .956 .9647 .9734 .9823 .9911 1;
152
+
153
+ @function color-contrast($background, $color-contrast-dark: $color-contrast-dark, $color-contrast-light: $color-contrast-light, $min-contrast-ratio: $min-contrast-ratio) {
154
+ $foregrounds: $color-contrast-light, $color-contrast-dark, $white, $black;
155
+ $max-ratio: 0;
156
+ $max-ratio-color: null;
157
+
158
+ @each $color in $foregrounds {
159
+ $contrast-ratio: contrast-ratio($background, $color);
160
+ @if $contrast-ratio > $min-contrast-ratio {
161
+ @return $color;
162
+ } @else if $contrast-ratio > $max-ratio {
163
+ $max-ratio: $contrast-ratio;
164
+ $max-ratio-color: $color;
165
+ }
166
+ }
167
+
168
+ @warn "Found no color leading to #{$min-contrast-ratio}:1 contrast ratio against #{$background}...";
169
+
170
+ @return $max-ratio-color;
171
+ }
172
+
173
+ @function contrast-ratio($background, $foreground: $color-contrast-light) {
174
+ $l1: luminance($background);
175
+ $l2: luminance(opaque($background, $foreground));
176
+
177
+ @return if($l1 > $l2, divide($l1 + .05, $l2 + .05), divide($l2 + .05, $l1 + .05));
178
+ }
179
+
180
+ // Return WCAG2.0 relative luminance
181
+ // See https://www.w3.org/WAI/GL/wiki/Relative_luminance
182
+ // See https://www.w3.org/TR/WCAG20-TECHS/G17.html#G17-tests
183
+ @function luminance($color) {
184
+ $rgb: (
185
+ "r": red($color),
186
+ "g": green($color),
187
+ "b": blue($color)
188
+ );
189
+
190
+ @each $name, $value in $rgb {
191
+ $value: if(divide($value, 255) < .03928, divide(divide($value, 255), 12.92), nth($_luminance-list, $value + 1));
192
+ $rgb: map-merge($rgb, ($name: $value));
193
+ }
194
+
195
+ @return (map-get($rgb, "r") * .2126) + (map-get($rgb, "g") * .7152) + (map-get($rgb, "b") * .0722);
196
+ }
197
+
198
+ // Return opaque color
199
+ // opaque(#fff, rgba(0, 0, 0, .5)) => #808080
200
+ @function opaque($background, $foreground) {
201
+ @return mix(rgba($foreground, 1), $background, opacity($foreground) * 100);
202
+ }
203
+
204
+ // scss-docs-start color-functions
205
+ // Tint a color: mix a color with white
206
+ @function tint-color($color, $weight) {
207
+ @return mix(white, $color, $weight);
208
+ }
209
+
210
+ // Shade a color: mix a color with black
211
+ @function shade-color($color, $weight) {
212
+ @return mix(black, $color, $weight);
213
+ }
214
+
215
+ // Shade the color if the weight is positive, else tint it
216
+ @function shift-color($color, $weight) {
217
+ @return if($weight > 0, shade-color($color, $weight), tint-color($color, -$weight));
218
+ }
219
+ // scss-docs-end color-functions
220
+
221
+ // Return valid calc
222
+ @function add($value1, $value2, $return-calc: true) {
223
+ @if $value1 == null {
224
+ @return $value2;
225
+ }
226
+
227
+ @if $value2 == null {
228
+ @return $value1;
229
+ }
230
+
231
+ @if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
232
+ @return $value1 + $value2;
233
+ }
234
+
235
+ @return if($return-calc == true, calc(#{$value1} + #{$value2}), $value1 + unquote(" + ") + $value2);
236
+ }
237
+
238
+ @function subtract($value1, $value2, $return-calc: true) {
239
+ @if $value1 == null and $value2 == null {
240
+ @return null;
241
+ }
242
+
243
+ @if $value1 == null {
244
+ @return -$value2;
245
+ }
246
+
247
+ @if $value2 == null {
248
+ @return $value1;
249
+ }
250
+
251
+ @if type-of($value1) == number and type-of($value2) == number and comparable($value1, $value2) {
252
+ @return $value1 - $value2;
253
+ }
254
+
255
+ @if type-of($value2) != number {
256
+ $value2: unquote("(") + $value2 + unquote(")");
257
+ }
258
+
259
+ @return if($return-calc == true, calc(#{$value1} - #{$value2}), $value1 + unquote(" - ") + $value2);
260
+ }
261
+
262
+ @function divide($dividend, $divisor, $precision: 10) {
263
+ $sign: if($dividend > 0 and $divisor > 0 or $dividend < 0 and $divisor < 0, 1, -1);
264
+ $dividend: abs($dividend);
265
+ $divisor: abs($divisor);
266
+ @if $dividend == 0 {
267
+ @return 0;
268
+ }
269
+ @if $divisor == 0 {
270
+ @error "Cannot divide by 0";
271
+ }
272
+ $remainder: $dividend;
273
+ $result: 0;
274
+ $factor: 10;
275
+ @while ($remainder > 0 and $precision >= 0) {
276
+ $quotient: 0;
277
+ @while ($remainder >= $divisor) {
278
+ $remainder: $remainder - $divisor;
279
+ $quotient: $quotient + 1;
280
+ }
281
+ $result: $result * 10 + $quotient;
282
+ $factor: $factor * .1;
283
+ $remainder: $remainder * 10;
284
+ $precision: $precision - 1;
285
+ @if ($precision < 0 and $remainder >= $divisor * 5) {
286
+ $result: $result + 1;
287
+ }
288
+ }
289
+ $result: $result * $factor * $sign;
290
+ $dividend-unit: unit($dividend);
291
+ $divisor-unit: unit($divisor);
292
+ $unit-map: (
293
+ "px": 1px,
294
+ "rem": 1rem,
295
+ "em": 1em,
296
+ "%": 1%
297
+ );
298
+ @if ($dividend-unit != $divisor-unit and map-has-key($unit-map, $dividend-unit)) {
299
+ $result: $result * map-get($unit-map, $dividend-unit);
300
+ }
301
+ @return $result;
302
+ }
@@ -0,0 +1,7 @@
1
+ @import "./helpers/container";
2
+ @import "./helpers/embed";
3
+ @import "./helpers/grid";
4
+ @import "./helpers/image";
5
+ @import "./helpers/link";
6
+ @import "./helpers/screenReaders";
7
+ @import "./helpers/wrap";
@@ -0,0 +1,12 @@
1
+ @import "./mixins/breakpoints";
2
+ @import "./mixins/card";
3
+ @import "./mixins/caret";
4
+ @import "./mixins/clearfix";
5
+ @import "./mixins/close";
6
+ @import "./mixins/container";
7
+ @import "./mixins/grid";
8
+ @import "./mixins/group";
9
+ @import "./mixins/list";
10
+ @import "./mixins/pill";
11
+ @import "./mixins/table";
12
+ @import "./mixins/wrap";
@@ -0,0 +1,17 @@
1
+ @import "./modules/alert";
2
+ @import "./modules/button";
3
+ @import "./modules/card";
4
+ @import "./modules/close";
5
+ @import "./modules/details";
6
+ @import "./modules/dialog";
7
+ @import "./modules/dropdown";
8
+ @import "./modules/form";
9
+ @import "./modules/list";
10
+ @import "./modules/loader";
11
+ @import "./modules/nav";
12
+ @import "./modules/pill";
13
+ @import "./modules/tabs";
14
+ @import "./modules/tag";
15
+ @import "./modules/tile";
16
+ @import "./modules/table";
17
+ @import "./modules/tooltip";