@graupl/core 1.0.0-beta.10

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 (303) hide show
  1. package/dist/css/base/button.css +2 -0
  2. package/dist/css/base/button.css.map +1 -0
  3. package/dist/css/base/form.css +2 -0
  4. package/dist/css/base/form.css.map +1 -0
  5. package/dist/css/base/link.css +2 -0
  6. package/dist/css/base/link.css.map +1 -0
  7. package/dist/css/base/table.css +2 -0
  8. package/dist/css/base/table.css.map +1 -0
  9. package/dist/css/base.css +2 -0
  10. package/dist/css/base.css.map +1 -0
  11. package/dist/css/component/accordion.css +5 -0
  12. package/dist/css/component/accordion.css.map +1 -0
  13. package/dist/css/component/alert.css +2 -0
  14. package/dist/css/component/alert.css.map +1 -0
  15. package/dist/css/component/card.css +2 -0
  16. package/dist/css/component/card.css.map +1 -0
  17. package/dist/css/component/carousel.css +2 -0
  18. package/dist/css/component/carousel.css.map +1 -0
  19. package/dist/css/component/input-group.css +2 -0
  20. package/dist/css/component/input-group.css.map +1 -0
  21. package/dist/css/component/list.css +2 -0
  22. package/dist/css/component/list.css.map +1 -0
  23. package/dist/css/component/menu.css +2 -0
  24. package/dist/css/component/menu.css.map +1 -0
  25. package/dist/css/component/navigation.css +2 -0
  26. package/dist/css/component/navigation.css.map +1 -0
  27. package/dist/css/component.css +5 -0
  28. package/dist/css/component.css.map +1 -0
  29. package/dist/css/graupl.css +5 -0
  30. package/dist/css/graupl.css.map +1 -0
  31. package/dist/css/init.css +2 -0
  32. package/dist/css/init.css.map +1 -0
  33. package/dist/css/layout/columns.css +2 -0
  34. package/dist/css/layout/columns.css.map +1 -0
  35. package/dist/css/layout/container.css +2 -0
  36. package/dist/css/layout/container.css.map +1 -0
  37. package/dist/css/layout/flex-columns.css +2 -0
  38. package/dist/css/layout/flex-columns.css.map +1 -0
  39. package/dist/css/layout.css +5 -0
  40. package/dist/css/layout.css.map +1 -0
  41. package/dist/css/normalize.css +2 -0
  42. package/dist/css/normalize.css.map +1 -0
  43. package/dist/css/state/focus.css +2 -0
  44. package/dist/css/state/focus.css.map +1 -0
  45. package/dist/css/state.css +2 -0
  46. package/dist/css/state.css.map +1 -0
  47. package/dist/css/theme/color.css +2 -0
  48. package/dist/css/theme/color.css.map +1 -0
  49. package/dist/css/theme/typography.css +2 -0
  50. package/dist/css/theme/typography.css.map +1 -0
  51. package/dist/css/theme.css +2 -0
  52. package/dist/css/theme.css.map +1 -0
  53. package/dist/css/utilities/alignment.css +2 -0
  54. package/dist/css/utilities/alignment.css.map +1 -0
  55. package/dist/css/utilities/background.css +2 -0
  56. package/dist/css/utilities/background.css.map +1 -0
  57. package/dist/css/utilities/border.css +2 -0
  58. package/dist/css/utilities/border.css.map +1 -0
  59. package/dist/css/utilities/color.css +2 -0
  60. package/dist/css/utilities/color.css.map +1 -0
  61. package/dist/css/utilities/container.css +2 -0
  62. package/dist/css/utilities/container.css.map +1 -0
  63. package/dist/css/utilities/display.css +2 -0
  64. package/dist/css/utilities/display.css.map +1 -0
  65. package/dist/css/utilities/flex.css +2 -0
  66. package/dist/css/utilities/flex.css.map +1 -0
  67. package/dist/css/utilities/gradient.css +2 -0
  68. package/dist/css/utilities/gradient.css.map +1 -0
  69. package/dist/css/utilities/height.css +2 -0
  70. package/dist/css/utilities/height.css.map +1 -0
  71. package/dist/css/utilities/inset.css +2 -0
  72. package/dist/css/utilities/inset.css.map +1 -0
  73. package/dist/css/utilities/justification.css +2 -0
  74. package/dist/css/utilities/justification.css.map +1 -0
  75. package/dist/css/utilities/list.css +2 -0
  76. package/dist/css/utilities/list.css.map +1 -0
  77. package/dist/css/utilities/order.css +2 -0
  78. package/dist/css/utilities/order.css.map +1 -0
  79. package/dist/css/utilities/position.css +2 -0
  80. package/dist/css/utilities/position.css.map +1 -0
  81. package/dist/css/utilities/ratio.css +2 -0
  82. package/dist/css/utilities/ratio.css.map +1 -0
  83. package/dist/css/utilities/spacing.css +2 -0
  84. package/dist/css/utilities/spacing.css.map +1 -0
  85. package/dist/css/utilities/typography.css +2 -0
  86. package/dist/css/utilities/typography.css.map +1 -0
  87. package/dist/css/utilities/visibility.css +2 -0
  88. package/dist/css/utilities/visibility.css.map +1 -0
  89. package/dist/css/utilities/visually-hidden.css +2 -0
  90. package/dist/css/utilities/visually-hidden.css.map +1 -0
  91. package/dist/css/utilities/width.css +2 -0
  92. package/dist/css/utilities/width.css.map +1 -0
  93. package/dist/css/utilities/z-index.css +2 -0
  94. package/dist/css/utilities/z-index.css.map +1 -0
  95. package/dist/css/utilities.css +2 -0
  96. package/dist/css/utilities.css.map +1 -0
  97. package/package.json +58 -0
  98. package/scss/base/button.scss +3 -0
  99. package/scss/base/form.scss +3 -0
  100. package/scss/base/link.scss +3 -0
  101. package/scss/base/table.scss +3 -0
  102. package/scss/base.scss +3 -0
  103. package/scss/component/accordion.scss +3 -0
  104. package/scss/component/alert.scss +3 -0
  105. package/scss/component/card.scss +3 -0
  106. package/scss/component/carousel.scss +3 -0
  107. package/scss/component/input-group.scss +3 -0
  108. package/scss/component/list.scss +3 -0
  109. package/scss/component/menu.scss +3 -0
  110. package/scss/component/navigation.scss +3 -0
  111. package/scss/component.scss +3 -0
  112. package/scss/graupl.scss +3 -0
  113. package/scss/init.scss +3 -0
  114. package/scss/layout/columns.scss +3 -0
  115. package/scss/layout/container.scss +3 -0
  116. package/scss/layout/flex-columns.scss +3 -0
  117. package/scss/layout.scss +3 -0
  118. package/scss/normalize.scss +3 -0
  119. package/scss/state/focus.scss +3 -0
  120. package/scss/state.scss +3 -0
  121. package/scss/theme/color.scss +3 -0
  122. package/scss/theme/typography.scss +3 -0
  123. package/scss/theme.scss +3 -0
  124. package/scss/utilities/alignment.scss +3 -0
  125. package/scss/utilities/background.scss +3 -0
  126. package/scss/utilities/border.scss +3 -0
  127. package/scss/utilities/color.scss +3 -0
  128. package/scss/utilities/container.scss +3 -0
  129. package/scss/utilities/display.scss +3 -0
  130. package/scss/utilities/flex.scss +3 -0
  131. package/scss/utilities/gradient.scss +3 -0
  132. package/scss/utilities/height.scss +3 -0
  133. package/scss/utilities/inset.scss +3 -0
  134. package/scss/utilities/justification.scss +3 -0
  135. package/scss/utilities/list.scss +3 -0
  136. package/scss/utilities/order.scss +3 -0
  137. package/scss/utilities/position.scss +3 -0
  138. package/scss/utilities/ratio.scss +3 -0
  139. package/scss/utilities/spacing.scss +3 -0
  140. package/scss/utilities/typography.scss +3 -0
  141. package/scss/utilities/visibility.scss +3 -0
  142. package/scss/utilities/visually-hidden.scss +3 -0
  143. package/scss/utilities/width.scss +3 -0
  144. package/scss/utilities/z-index.scss +3 -0
  145. package/scss/utilities.scss +3 -0
  146. package/src/js/accordion/Accordion.js +1163 -0
  147. package/src/js/accordion/AccordionItem.js +496 -0
  148. package/src/js/accordion/index.js +10 -0
  149. package/src/js/alert/Alert.js +581 -0
  150. package/src/js/alert/index.js +11 -0
  151. package/src/js/carousel/Carousel.js +1427 -0
  152. package/src/js/carousel/index.js +10 -0
  153. package/src/js/domHelpers.js +37 -0
  154. package/src/js/eventHandlers.js +39 -0
  155. package/src/js/navigation/index.js +36 -0
  156. package/src/js/storage.js +106 -0
  157. package/src/js/validate.js +225 -0
  158. package/src/scss/_defaults.scss +184 -0
  159. package/src/scss/_index.scss +15 -0
  160. package/src/scss/_init.scss +6 -0
  161. package/src/scss/_normalize.scss +197 -0
  162. package/src/scss/_variables.scss +95 -0
  163. package/src/scss/base/_index.scss +6 -0
  164. package/src/scss/base/button/_defaults.scss +49 -0
  165. package/src/scss/base/button/_index.scss +206 -0
  166. package/src/scss/base/button/_mixins.scss +104 -0
  167. package/src/scss/base/button/_variables.scss +252 -0
  168. package/src/scss/base/form/_defaults.scss +24 -0
  169. package/src/scss/base/form/_index.scss +227 -0
  170. package/src/scss/base/form/_variables.scss +245 -0
  171. package/src/scss/base/link/_defaults.scss +35 -0
  172. package/src/scss/base/link/_index.scss +245 -0
  173. package/src/scss/base/link/_variables.scss +370 -0
  174. package/src/scss/base/table/_defaults.scss +68 -0
  175. package/src/scss/base/table/_index.scss +314 -0
  176. package/src/scss/base/table/_variables.scss +309 -0
  177. package/src/scss/component/_index.scss +10 -0
  178. package/src/scss/component/accordion/_defaults.scss +40 -0
  179. package/src/scss/component/accordion/_index.scss +198 -0
  180. package/src/scss/component/accordion/_variables.scss +356 -0
  181. package/src/scss/component/alert/_defaults.scss +49 -0
  182. package/src/scss/component/alert/_index.scss +119 -0
  183. package/src/scss/component/alert/_variables.scss +200 -0
  184. package/src/scss/component/card/_defaults.scss +32 -0
  185. package/src/scss/component/card/_index.scss +212 -0
  186. package/src/scss/component/card/_variables.scss +216 -0
  187. package/src/scss/component/carousel/_defaults.scss +43 -0
  188. package/src/scss/component/carousel/_index.scss +192 -0
  189. package/src/scss/component/carousel/_variables.scss +104 -0
  190. package/src/scss/component/input-group/_defaults.scss +30 -0
  191. package/src/scss/component/input-group/_index.scss +47 -0
  192. package/src/scss/component/input-group/_variables.scss +66 -0
  193. package/src/scss/component/list/_defaults.scss +15 -0
  194. package/src/scss/component/list/_index.scss +52 -0
  195. package/src/scss/component/list/_variables.scss +236 -0
  196. package/src/scss/component/menu/_defaults.scss +57 -0
  197. package/src/scss/component/menu/_index.scss +308 -0
  198. package/src/scss/component/menu/_variables.scss +642 -0
  199. package/src/scss/component/navigation/_defaults.scss +23 -0
  200. package/src/scss/component/navigation/_index.scss +190 -0
  201. package/src/scss/component/navigation/_variables.scss +290 -0
  202. package/src/scss/functions/_container.scss +38 -0
  203. package/src/scss/functions/_important.scss +36 -0
  204. package/src/scss/functions/_screen.scss +38 -0
  205. package/src/scss/functions/_theme.scss +39 -0
  206. package/src/scss/functions/_utility.scss +28 -0
  207. package/src/scss/layout/_index.scss +5 -0
  208. package/src/scss/layout/columns/_defaults.scss +24 -0
  209. package/src/scss/layout/columns/_index.scss +137 -0
  210. package/src/scss/layout/columns/_variables.scss +55 -0
  211. package/src/scss/layout/container/_defaults.scss +35 -0
  212. package/src/scss/layout/container/_index.scss +628 -0
  213. package/src/scss/layout/container/_variables.scss +114 -0
  214. package/src/scss/layout/flex-columns/_defaults.scss +28 -0
  215. package/src/scss/layout/flex-columns/_index.scss +184 -0
  216. package/src/scss/layout/flex-columns/_variables.scss +30 -0
  217. package/src/scss/mixins/_animation.scss +15 -0
  218. package/src/scss/mixins/_container.scss +80 -0
  219. package/src/scss/mixins/_layer.scss +16 -0
  220. package/src/scss/mixins/_screen.scss +77 -0
  221. package/src/scss/mixins/_state.scss +18 -0
  222. package/src/scss/mixins/_theme.scss +15 -0
  223. package/src/scss/mixins/_utility.scss +185 -0
  224. package/src/scss/mixins/_visually-hidden.scss +30 -0
  225. package/src/scss/state/_index.scss +3 -0
  226. package/src/scss/state/focus/_defaults.scss +9 -0
  227. package/src/scss/state/focus/_index.scss +42 -0
  228. package/src/scss/state/focus/_mixins.scss +13 -0
  229. package/src/scss/state/focus/_variables.scss +50 -0
  230. package/src/scss/theme/_index.scss +4 -0
  231. package/src/scss/theme/color/_defaults.scss +143 -0
  232. package/src/scss/theme/color/_index.scss +42 -0
  233. package/src/scss/theme/color/_variables.scss +133 -0
  234. package/src/scss/theme/typography/_defaults.scss +54 -0
  235. package/src/scss/theme/typography/_index.scss +120 -0
  236. package/src/scss/theme/typography/_variables.scss +248 -0
  237. package/src/scss/utilities/_index.scss +23 -0
  238. package/src/scss/utilities/_template/_defaults.scss +41 -0
  239. package/src/scss/utilities/_template/_index.scss +171 -0
  240. package/src/scss/utilities/_template/_variables.scss +6 -0
  241. package/src/scss/utilities/alignment/_defaults.scss +76 -0
  242. package/src/scss/utilities/alignment/_index.scss +336 -0
  243. package/src/scss/utilities/alignment/_variables.scss +6 -0
  244. package/src/scss/utilities/background/_defaults.scss +122 -0
  245. package/src/scss/utilities/background/_index.scss +634 -0
  246. package/src/scss/utilities/background/_variables.scss +6 -0
  247. package/src/scss/utilities/border/_defaults.scss +73 -0
  248. package/src/scss/utilities/border/_index.scss +558 -0
  249. package/src/scss/utilities/border/_variables.scss +6 -0
  250. package/src/scss/utilities/color/_defaults.scss +49 -0
  251. package/src/scss/utilities/color/_index.scss +469 -0
  252. package/src/scss/utilities/color/_variables.scss +6 -0
  253. package/src/scss/utilities/container/_defaults.scss +40 -0
  254. package/src/scss/utilities/container/_index.scss +174 -0
  255. package/src/scss/utilities/container/_variables.scss +6 -0
  256. package/src/scss/utilities/display/_defaults.scss +47 -0
  257. package/src/scss/utilities/display/_index.scss +184 -0
  258. package/src/scss/utilities/display/_variables.scss +6 -0
  259. package/src/scss/utilities/flex/_defaults.scss +99 -0
  260. package/src/scss/utilities/flex/_index.scss +486 -0
  261. package/src/scss/utilities/flex/_variables.scss +6 -0
  262. package/src/scss/utilities/gradient/_defaults.scss +70 -0
  263. package/src/scss/utilities/gradient/_index.scss +696 -0
  264. package/src/scss/utilities/gradient/_variables.scss +29 -0
  265. package/src/scss/utilities/height/_defaults.scss +54 -0
  266. package/src/scss/utilities/height/_index.scss +525 -0
  267. package/src/scss/utilities/height/_variables.scss +6 -0
  268. package/src/scss/utilities/inset/_defaults.scss +55 -0
  269. package/src/scss/utilities/inset/_index.scss +258 -0
  270. package/src/scss/utilities/inset/_variables.scss +6 -0
  271. package/src/scss/utilities/justification/_defaults.scss +73 -0
  272. package/src/scss/utilities/justification/_index.scss +333 -0
  273. package/src/scss/utilities/justification/_variables.scss +6 -0
  274. package/src/scss/utilities/list/_defaults.scss +53 -0
  275. package/src/scss/utilities/list/_index.scss +253 -0
  276. package/src/scss/utilities/list/_variables.scss +6 -0
  277. package/src/scss/utilities/order/_defaults.scss +36 -0
  278. package/src/scss/utilities/order/_index.scss +246 -0
  279. package/src/scss/utilities/order/_variables.scss +6 -0
  280. package/src/scss/utilities/position/_defaults.scss +41 -0
  281. package/src/scss/utilities/position/_index.scss +178 -0
  282. package/src/scss/utilities/position/_variables.scss +6 -0
  283. package/src/scss/utilities/ratio/_defaults.scss +42 -0
  284. package/src/scss/utilities/ratio/_index.scss +188 -0
  285. package/src/scss/utilities/ratio/_variables.scss +9 -0
  286. package/src/scss/utilities/spacing/_defaults.scss +64 -0
  287. package/src/scss/utilities/spacing/_index.scss +970 -0
  288. package/src/scss/utilities/spacing/_variables.scss +6 -0
  289. package/src/scss/utilities/typography/_defaults.scss +58 -0
  290. package/src/scss/utilities/typography/_index.scss +1089 -0
  291. package/src/scss/utilities/typography/_variables.scss +6 -0
  292. package/src/scss/utilities/visibility/_defaults.scss +39 -0
  293. package/src/scss/utilities/visibility/_index.scss +173 -0
  294. package/src/scss/utilities/visibility/_variables.scss +6 -0
  295. package/src/scss/utilities/visually-hidden/_defaults.scss +29 -0
  296. package/src/scss/utilities/visually-hidden/_index.scss +189 -0
  297. package/src/scss/utilities/visually-hidden/_variables.scss +6 -0
  298. package/src/scss/utilities/width/_defaults.scss +54 -0
  299. package/src/scss/utilities/width/_index.scss +525 -0
  300. package/src/scss/utilities/width/_variables.scss +6 -0
  301. package/src/scss/utilities/z-index/_defaults.scss +40 -0
  302. package/src/scss/utilities/z-index/_index.scss +173 -0
  303. package/src/scss/utilities/z-index/_variables.scss +6 -0
@@ -0,0 +1,185 @@
1
+ // @graupl/core utility mixins.
2
+ //
3
+ // Mixins to help generate utility classes.
4
+
5
+ @use "./screen";
6
+ @use "./container";
7
+ @use "./state";
8
+ @use "./theme";
9
+ @use "../functions/important";
10
+ @use "../functions/utility";
11
+ @use "../defaults" as root-defaults;
12
+ @use "sass:string";
13
+
14
+ /// Insert a map of properties and values into a utility class.
15
+ ///
16
+ /// @param {Map} $map
17
+ /// The map of properties and values to apply to the selector.
18
+ /// @param {Boolean} $important
19
+ /// A flag to determine if the important flag should be added.
20
+ @mixin _insert($map, $important: null) {
21
+ @each $prop, $value in $map {
22
+ // Do not attempt to insert important values inside of custom properties.
23
+ @if string.slice($prop, 1, 2) != "--" {
24
+ #{$prop}: important.insert(#{$value}, $override: $important);
25
+ } @else {
26
+ #{$prop}: #{$value};
27
+ }
28
+ }
29
+
30
+ // Allow for custom overrides and additional styles.
31
+ @content;
32
+ }
33
+
34
+ /// Handles wrapping utilities with a conditional state.
35
+ ///
36
+ /// @param {?string} $state
37
+ /// The state to wrap.
38
+ @mixin _handle-state($state: null) {
39
+ @if $state {
40
+ @include state.state($state) {
41
+ @content;
42
+ }
43
+ } @else {
44
+ @content;
45
+ }
46
+ }
47
+
48
+ /// Handles wrapping utilities with a conditional screen.
49
+ ///
50
+ /// @param {?string} $screen
51
+ /// The screen to wrap.
52
+ @mixin _handle-screen($screen: null) {
53
+ @if $screen {
54
+ @include screen.up($screen) {
55
+ @content;
56
+ }
57
+ } @else {
58
+ @content;
59
+ }
60
+ }
61
+
62
+ /// Handles wrapping utilities with a conditional container.
63
+ ///
64
+ /// @param {?string} $container
65
+ /// The container to wrap.
66
+ @mixin _handle-container($container: null) {
67
+ @if $container {
68
+ @include container.up($container) {
69
+ @content;
70
+ }
71
+ } @else {
72
+ @content;
73
+ }
74
+ }
75
+
76
+ /// Handles wrapping utilities with a conditional theme.
77
+ ///
78
+ /// @param {?string} $theme
79
+ /// The theme mode to wrap.
80
+ @mixin _handle-theme($theme: null) {
81
+ @if $theme {
82
+ @include theme.theme($theme) {
83
+ @content;
84
+ }
85
+ } @else {
86
+ @content;
87
+ }
88
+ }
89
+
90
+ /// Create a utility class with a list of properties and a single value.
91
+ ///
92
+ /// @param {string} $selector
93
+ /// The selector to apply the utility class to.
94
+ /// @param {string|List} $property
95
+ /// The property/properties to apply to the selector.
96
+ /// @param {string} $value
97
+ /// The value to apply to the property/properties.
98
+ /// @param {?Boolean} $important
99
+ /// A flag to determine if the important flag should be added.
100
+ /// @param {?string} $screen
101
+ /// The screen to apply the utility class to.
102
+ /// @param {?string} $theme
103
+ /// The theme mode to apply the utility class to.
104
+ /// @param {?string} $state
105
+ /// The state to apply the utility class to.
106
+ @mixin create(
107
+ $selector,
108
+ $property,
109
+ $value,
110
+ $important: null,
111
+ $screen: null,
112
+ $theme: null,
113
+ $state: null,
114
+ $container: null
115
+ ) {
116
+ $map: utility.convert-property-values-to-map($property, $value);
117
+
118
+ @include create-mapped(
119
+ $selector,
120
+ $map,
121
+ $important: $important,
122
+ $screen: $screen,
123
+ $theme: $theme,
124
+ $state: $state,
125
+ $container: $container
126
+ ) {
127
+ @content;
128
+ }
129
+ }
130
+
131
+ /// Create a utility class with a map of properties and values.
132
+ ///
133
+ /// @param {string} $selector
134
+ /// The selector to apply the utility class to.
135
+ /// @param {Map} $map
136
+ /// The map of properties and values to apply to the selector.
137
+ /// @param {?Boolean} $important
138
+ /// A flag to determine if the important flag should be added.
139
+ /// @param {?string} $screen
140
+ /// The screen to apply the utility class to.
141
+ /// @param {?string} $theme
142
+ /// The theme mode to apply the utility class to.
143
+ /// @param {?string} $state
144
+ /// The state to apply the utility class to.
145
+ @mixin create-mapped(
146
+ $selector,
147
+ $map,
148
+ $important: null,
149
+ $screen: null,
150
+ $theme: null,
151
+ $state: null,
152
+ $container: null
153
+ ) {
154
+ @include _handle-theme($theme) {
155
+ #{$selector} {
156
+ @if $screen or $container {
157
+ @if $screen {
158
+ @include _handle-screen($screen) {
159
+ @include _handle-state($state) {
160
+ @include _insert($map, $important) {
161
+ @content;
162
+ }
163
+ }
164
+ }
165
+ }
166
+
167
+ @if $container {
168
+ @include _handle-container($container) {
169
+ @include _handle-state($state) {
170
+ @include _insert($map, $important) {
171
+ @content;
172
+ }
173
+ }
174
+ }
175
+ }
176
+ } @else {
177
+ @include _handle-state($state) {
178
+ @include _insert($map, $important) {
179
+ @content;
180
+ }
181
+ }
182
+ }
183
+ }
184
+ }
185
+ }
@@ -0,0 +1,30 @@
1
+ // @graupl/core visually hidden mixins.
2
+
3
+ @use "../functions/important";
4
+
5
+ /// Apply the visually hidden utility.
6
+ ///
7
+ /// @param {Boolean} $important
8
+ /// A flag to determine if the important flag should be added.
9
+ @mixin apply($important: true) {
10
+ position: important.insert(absolute, $override: $important);
11
+ width: important.insert(1px, $override: $important);
12
+ height: important.insert(1px, $override: $important);
13
+ margin: important.insert(-1px, $override: $important);
14
+ padding: important.insert(0, $override: $important);
15
+ overflow: important.insert(hidden, $override: $important);
16
+ clip: important.insert(rect(0, 0, 0, 0), $override: $important);
17
+ border: important.insert(0, $override: $important);
18
+ white-space: important.insert(nowrap, $override: $important);
19
+ clip-path: important.insert(inset(50%), $override: $important);
20
+ }
21
+
22
+ /// Apply the visually hidden utility to not-focussed elements.
23
+ ///
24
+ /// @param {Boolean} $important
25
+ /// A flag to determine if the important flag should be added.
26
+ @mixin focusable($important: true) {
27
+ &:not(:focus, :focus-within) {
28
+ @include apply($important);
29
+ }
30
+ }
@@ -0,0 +1,3 @@
1
+ // @graupl/core state styles.
2
+
3
+ @forward "focus";
@@ -0,0 +1,9 @@
1
+ // @graupl/core focus state default values.
2
+ //
3
+ // Generally, these should not be used directly when styling components unless a static value is needed.
4
+ // They are mainly used to provide class selectors, fallbacks for custom properties, or loop values.
5
+ //
6
+ // They should not be used to define direct property values (i.e. font-size, color, etc.).
7
+ // Those should be defined as custom properties in the `_variables.scss` file.
8
+
9
+ $focus-outline-style: dotted !default;
@@ -0,0 +1,42 @@
1
+ // @graupl/core focus state styles.
2
+ //
3
+ // This module provides the styles for Graupl's focus state.
4
+ //
5
+ // The focus state is applied to an element when it is focused by the user.
6
+ //
7
+ // The following classes are generated by default:
8
+ // - `.focus`: The focus state class.
9
+ //
10
+ // The following custom properties control the generated classes:
11
+ // - `--graupl-focus-width`: The width of the focus outline.
12
+ // - `--graupl-focus-outline-color`: The color of the focus outline.
13
+ // - `--graupl-focus-outline-width`: The width of the focus outline.
14
+ // - `--graupl-focus-outline-style`: The style of the focus outline.
15
+ // - `--graupl-focus-outline-offset`: The offset of the focus outline.
16
+ // - `--graupl-focus-box-shadow-color`: The color of the focus box shadow.
17
+ // - `--graupl-focus-box-shadow-style`: The style of the focus box shadow.
18
+ // - `--graupl-focus-box-shadow`: The box shadow of the focus state.
19
+ //
20
+ // The following variables control the generated classes:
21
+ // - `$focus-outline-style`: The style of the focus outline.
22
+ // - `$focus-box-shadow-style`: The style of the focus box shadow.
23
+ //
24
+ // Note: This focus styles are also applied to the `:focus-visible` pseudo-class by default.
25
+ //
26
+ // @example
27
+ // <button class="focus">Focus</button>
28
+
29
+ @use "variables" as *;
30
+ @use "../../mixins/layer" as *;
31
+ @use "mixins" as *;
32
+ @use "../../defaults" as root-defaults;
33
+ @use "sass:map";
34
+
35
+ @include layer(state) {
36
+ @each $state in map.get(root-defaults.$state-selectors, focus) {
37
+ // e.g. *.focus or *:focus-visible
38
+ *#{$state} {
39
+ @include apply-focus;
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,13 @@
1
+ // @graupl/core focus state mixins.
2
+
3
+ @use "variables" as *;
4
+ @use "../../defaults" as root-defaults;
5
+ @use "sass:map";
6
+
7
+ /// Applies the focus state.
8
+ @mixin apply-focus() {
9
+ border-color: $focus-border-color;
10
+ outline: $focus-outline;
11
+ outline-offset: $focus-outline-offset;
12
+ box-shadow: $focus-box-shadow;
13
+ }
@@ -0,0 +1,50 @@
1
+ // @graupl/core focus state variables.
2
+ //
3
+ // These values are to be used to directly style components and provide a
4
+ // cleaner way to reference custom properties.
5
+
6
+ @use "../../variables" as root-variables;
7
+ @use "defaults";
8
+ @use "../../defaults" as root-defaults;
9
+ @use "../../theme/color/variables" as color;
10
+
11
+ $focus-width: var(
12
+ --#{root-defaults.$prefix}focus-width,
13
+ #{root-variables.$border-width}
14
+ );
15
+ $focus-outline-color: var(
16
+ --#{root-defaults.$prefix}focus-outline-color,
17
+ #{color.$color}
18
+ );
19
+ $focus-outline-width: var(
20
+ --#{root-defaults.$prefix}focus-outline-width,
21
+ #{$focus-width}
22
+ );
23
+ $focus-outline-style: var(
24
+ --#{root-defaults.$prefix}focus-outline-style,
25
+ #{defaults.$focus-outline-style}
26
+ );
27
+ $focus-outline: var(
28
+ --#{root-defaults.$prefix}focus-outline,
29
+ #{$focus-outline-width} #{$focus-outline-style} #{$focus-outline-color}
30
+ );
31
+ $focus-outline-offset: var(
32
+ --#{root-defaults.$prefix}focus-outline-offset,
33
+ calc(-1 * #{$focus-outline-width})
34
+ );
35
+ $focus-box-shadow-color: var(
36
+ --#{root-defaults.$prefix}focus-box-shadow-color,
37
+ #{color.$background}
38
+ );
39
+ $focus-border-color: var(
40
+ --#{root-defaults.$prefix}focus-border-color,
41
+ #{color.$background}
42
+ );
43
+ $focus-box-shadow: var(
44
+ --#{root-defaults.$prefix}focus-box-shadow,
45
+ 0 0 0 #{$focus-width} inset #{$focus-box-shadow-color}
46
+ );
47
+ $focus-box-shadow-bordered: var(
48
+ --#{root-defaults.$prefix}focus-box-shadow-bordered,
49
+ 0 0 0 #{$focus-width} #{$focus-box-shadow-color}
50
+ );
@@ -0,0 +1,4 @@
1
+ // @graupl/core theme styles.
2
+
3
+ @forward "color";
4
+ @forward "typography";
@@ -0,0 +1,143 @@
1
+ // @graupl/core color theme default values.
2
+ //
3
+ // Generally, these should not be used directly when styling components unless a static value is needed.
4
+ // They are mainly used to provide class selectors, fallbacks for custom properties, or loop values.
5
+ //
6
+ // They should not be used to define direct property values (i.e. font-size, color, etc.).
7
+ // Those should be defined as custom properties in the `_variables.scss` file.
8
+
9
+ @use "sass:map";
10
+ @use "sass:list";
11
+
12
+ $theme-selector-prefix: "." !default;
13
+ $theme-selector-suffix: "-mode" !default;
14
+
15
+ // The site will have colours, defaulting to primary, secondary, and tertiary.
16
+ // Each colour will have a shade mapping, defaulting to 100-900.
17
+ // Users can add custom colours/overrides for both colours and shades.
18
+
19
+ // The site will use themes, defaulting to light and dark.
20
+ // Users can add custom themes/overrides.
21
+
22
+ // Each theme will have a mapping of colours, defaulting to cover all colours and shades.
23
+ // Users can add custom mappings/overrides.
24
+
25
+ // The combinations of colours, themes, and shades will be combined into a giant map.
26
+ // It will be sorted by theme > color > shade where each shade is derived from the mapping.
27
+ // Users can override any part of this giant map, allowing for fine-tuned control of theme colours.
28
+
29
+ // Colours.
30
+ $default-colors: (
31
+ primary: (
32
+ 100: hsl(219deg 100% 95%),
33
+ 200: hsl(219deg 90% 80%),
34
+ 300: hsl(219deg 80% 65%),
35
+ 400: hsl(219deg 75% 55%),
36
+ 500: hsl(219deg 75% 50%),
37
+ 600: hsl(219deg 75% 45%),
38
+ 700: hsl(219deg 80% 35%),
39
+ 800: hsl(219deg 90% 20%),
40
+ 900: hsl(219deg 100% 10%),
41
+ ),
42
+ secondary: (
43
+ 100: hsl(235deg 40% 95%),
44
+ 200: hsl(235deg 30% 80%),
45
+ 300: hsl(235deg 20% 65%),
46
+ 400: hsl(235deg 15% 55%),
47
+ 500: hsl(235deg 15% 50%),
48
+ 600: hsl(235deg 15% 45%),
49
+ 700: hsl(235deg 20% 35%),
50
+ 800: hsl(235deg 30% 20%),
51
+ 900: hsl(235deg 40% 10%),
52
+ ),
53
+ tertiary: (
54
+ 100: hsl(340deg 85% 95%),
55
+ 200: hsl(340deg 75% 80%),
56
+ 300: hsl(340deg 65% 65%),
57
+ 400: hsl(340deg 60% 55%),
58
+ 500: hsl(340deg 60% 50%),
59
+ 600: hsl(340deg 60% 45%),
60
+ 700: hsl(340deg 65% 35%),
61
+ 800: hsl(340deg 75% 20%),
62
+ 900: hsl(340deg 85% 10%),
63
+ ),
64
+ );
65
+ $custom-colors: () !default;
66
+ $colors: map.deep-merge($default-colors, $custom-colors);
67
+
68
+ // Themes.
69
+ $default-themes: (light, dark);
70
+ $custom-themes: () !default;
71
+ $themes: list.join($default-themes, $custom-themes);
72
+ $default-theme: light !default;
73
+
74
+ // Theme mappings.
75
+ $default-theme-mappings: (
76
+ light: (
77
+ 100: 100,
78
+ 200: 200,
79
+ 300: 300,
80
+ 400: 400,
81
+ 500: 500,
82
+ 600: 600,
83
+ 700: 700,
84
+ 800: 800,
85
+ 900: 900,
86
+ ),
87
+ dark: (
88
+ 100: 900,
89
+ 200: 800,
90
+ 300: 700,
91
+ 400: 600,
92
+ 500: 500,
93
+ 600: 400,
94
+ 700: 300,
95
+ 800: 200,
96
+ 900: 100,
97
+ ),
98
+ );
99
+ $custom-theme-mappings: () !default;
100
+ $theme-mappings: map.deep-merge(
101
+ $default-theme-mappings,
102
+ $custom-theme-mappings
103
+ );
104
+
105
+ // Theme map.
106
+ $default-theme-map: ();
107
+
108
+ @each $theme in $themes {
109
+ $theme-map: ();
110
+
111
+ @each $color-name, $color-map in $colors {
112
+ $color-theme-map: ();
113
+
114
+ @each $shade, $value in $color-map {
115
+ $color-theme-map: map.merge(
116
+ $color-theme-map,
117
+ (
118
+ $shade: (
119
+ color: $color-name,
120
+ shade: map.get($theme-mappings, $theme, $shade),
121
+ ),
122
+ )
123
+ );
124
+ }
125
+
126
+ $theme-map: map.merge(
127
+ $theme-map,
128
+ (
129
+ $color-name: $color-theme-map,
130
+ )
131
+ );
132
+ }
133
+
134
+ $default-theme-map: map.merge(
135
+ $default-theme-map,
136
+ (
137
+ $theme: $theme-map,
138
+ )
139
+ );
140
+ }
141
+
142
+ $custom-theme-map: () !default;
143
+ $theme-map: map.deep-merge($default-theme-map, $custom-theme-map);
@@ -0,0 +1,42 @@
1
+ // @graupl/core color theme styles.
2
+
3
+ @use "../../defaults" as root-defaults;
4
+ @use "../../mixins/layer" as *;
5
+ @use "../../mixins/theme";
6
+ @use "defaults";
7
+ @use "sass:map";
8
+ @use "variables" as *;
9
+
10
+ @include layer(theme) {
11
+ :root {
12
+ background: $root-background;
13
+ color: $root-color;
14
+
15
+ // Generate the default colour properties.
16
+ @each $color, $map in defaults.$colors {
17
+ @each $shade, $value in $map {
18
+ --#{root-defaults.$prefix}#{$color}--#{$shade}: #{$value};
19
+ }
20
+ }
21
+
22
+ // Generate the active theme properties.
23
+ @each $color, $map in map.get($themes, defaults.$default-theme) {
24
+ @each $shade, $value in $map {
25
+ --#{root-defaults.$prefix}theme-active--#{$color}--#{$shade}: #{$value};
26
+ }
27
+ }
28
+ }
29
+
30
+ // Generate the available theme properties.
31
+ @each $theme-name, $theme in $themes {
32
+ @include theme.theme($theme-name) {
33
+ @each $color, $map in $theme {
34
+ @each $shade, $value in $map {
35
+ --#{root-defaults.$prefix}theme-active--#{$color}--#{$shade}: #{$value};
36
+ }
37
+ }
38
+
39
+ color-scheme: #{$theme-name};
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,133 @@
1
+ // @graupl/core color theme variables.
2
+ //
3
+ // These values are to be used to directly style components and provide a
4
+ // cleaner way to reference custom properties.
5
+
6
+ @use "defaults";
7
+ @use "../../defaults" as root-defaults;
8
+ @use "sass:map";
9
+
10
+ // A colour map of base colours and their shades.
11
+ $colors: ();
12
+
13
+ // Create a map for each colour.
14
+ @each $color, $map in defaults.$colors {
15
+ // A map for the current colour.
16
+ $color-map: ();
17
+
18
+ @each $shade, $value in $map {
19
+ // Set the custom prop name and fallback value.
20
+ $color-property: var(
21
+ --#{root-defaults.$prefix}#{$color}--#{$shade},
22
+ $value
23
+ );
24
+
25
+ // Add the custom prop to the map.
26
+ $color-map: map.merge(
27
+ $color-map,
28
+ (
29
+ $shade: $color-property,
30
+ )
31
+ );
32
+ }
33
+
34
+ // Merge the colour map with the existing colours.
35
+ $colors: map.merge(
36
+ $colors,
37
+ (
38
+ $color: $color-map,
39
+ )
40
+ );
41
+ }
42
+
43
+ $themes: (
44
+ active: (),
45
+ );
46
+
47
+ // Generate all of the theme properties.
48
+ @each $theme-name, $theme-map in defaults.$theme-map {
49
+ $theme: ();
50
+
51
+ @each $color-name, $map in $theme-map {
52
+ $color-map: ();
53
+
54
+ @each $shade, $value in $map {
55
+ $color-property: var(
56
+ --#{root-defaults.$prefix}theme-#{$theme-name}--#{$color-name}--#{$shade},
57
+ #{map.get($colors, map.get($value, color), map.get($value, shade))}
58
+ );
59
+ $color-map: map.merge(
60
+ $color-map,
61
+ (
62
+ $shade: $color-property,
63
+ )
64
+ );
65
+ }
66
+
67
+ $theme: map.merge(
68
+ $theme,
69
+ (
70
+ $color-name: $color-map,
71
+ )
72
+ );
73
+ }
74
+
75
+ $themes: map.merge(
76
+ $themes,
77
+ (
78
+ $theme-name: $theme,
79
+ )
80
+ );
81
+ }
82
+
83
+ // Generate the active theme properties.
84
+ @each $color-name, $map in map.get($themes, defaults.$default-theme) {
85
+ $color-map: ();
86
+
87
+ @each $shade, $value in $map {
88
+ $color-property: var(
89
+ --#{root-defaults.$prefix}theme-active--#{$color-name}--#{$shade},
90
+ #{$value}
91
+ );
92
+ $color-map: map.merge(
93
+ $color-map,
94
+ (
95
+ $shade: $color-property,
96
+ )
97
+ );
98
+ }
99
+
100
+ $themes: map.merge(
101
+ $themes,
102
+ (
103
+ active: map.merge(
104
+ map.get($themes, active),
105
+ (
106
+ $color-name: $color-map,
107
+ )
108
+ ),
109
+ )
110
+ );
111
+ }
112
+
113
+ // Colour properties.
114
+ $root-color: var(--#{root-defaults.$prefix}root-color);
115
+ $root-background: var(--#{root-defaults.$prefix}root-background);
116
+
117
+ @if map.has-key($themes, active, primary, 900) {
118
+ $root-color: var(
119
+ --#{root-defaults.$prefix}root-color,
120
+ #{map.get(map.get(map.get($themes, active), primary), 900)}
121
+ );
122
+ }
123
+
124
+ @if map.has-key($themes, active, primary, 100) {
125
+ $root-background: var(
126
+ --#{root-defaults.$prefix}root-background,
127
+ #{map.get(map.get(map.get($themes, active), primary), 100)}
128
+ );
129
+ }
130
+
131
+ $color: var(--#{root-defaults.$prefix}color, #{$root-color});
132
+ $background: var(--#{root-defaults.$prefix}background, #{$root-background});
133
+ $border-color: var(--#{root-defaults.$prefix}border-color, #{$color});