@ulu/frontend 0.0.23 → 0.1.0-beta.1

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 (212) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/deprecated/js/drupal-programmatic-modal.js +91 -0
  3. package/{js/ui/modals.js → deprecated/js/micromodal-modals.js} +41 -67
  4. package/dist/ulu-frontend.min.css +1 -1
  5. package/dist/ulu-frontend.min.js +70 -1
  6. package/index.js +6 -1
  7. package/js/events/index.js +58 -7
  8. package/js/index.js +3 -7
  9. package/js/{helpers/css-breakpoint.js → ui/breakpoints.js} +9 -11
  10. package/js/ui/collapsible.js +195 -0
  11. package/js/ui/dialog.js +157 -0
  12. package/js/ui/dialog.todo +37 -0
  13. package/js/ui/flipcard.js +55 -11
  14. package/js/ui/grid.js +2 -47
  15. package/js/ui/index.js +21 -0
  16. package/js/ui/modal-builder.js +197 -0
  17. package/js/ui/overflow-scroller-pager.js +1 -1
  18. package/js/ui/overflow-scroller.js +8 -5
  19. package/js/ui/page.js +14 -0
  20. package/js/ui/popover.js +135 -0
  21. package/js/ui/print-details.js +44 -0
  22. package/js/ui/print.js +67 -0
  23. package/js/ui/programmatic-modal.js +79 -81
  24. package/js/ui/proxy-click.js +80 -0
  25. package/js/ui/resizer.js +3 -3
  26. package/js/ui/scroll-slider.js +56 -0
  27. package/js/ui/scrollpoint.js +300 -0
  28. package/js/ui/slider.js +72 -10
  29. package/js/ui/tabs.js +85 -58
  30. package/js/ui/theme-toggle.js +129 -0
  31. package/js/ui/tooltip.js +268 -67
  32. package/js/utils/{logger.js → class-logger.js} +6 -5
  33. package/js/utils/dom.js +122 -0
  34. package/js/utils/file-save.js +67 -0
  35. package/js/utils/floating-ui.js +83 -0
  36. package/js/utils/id.js +22 -0
  37. package/js/utils/index.js +7 -0
  38. package/js/{helpers → utils}/pause-youtube-video.js +1 -1
  39. package/package.json +33 -13
  40. package/resources/drupal/twig-macros/accordion.twig +99 -0
  41. package/resources/drupal/twig-macros/dropdown.twig +44 -0
  42. package/resources/drupal/twig-macros/flipcard.twig +69 -0
  43. package/resources/drupal/twig-macros/image.twig +30 -0
  44. package/resources/drupal/twig-macros/layout.twig +338 -0
  45. package/resources/drupal/twig-macros/slider.twig +214 -0
  46. package/resources/drupal/twig-macros/tabs.twig +84 -0
  47. package/scss/README.md +13 -1
  48. package/scss/_breakpoint.scss +69 -26
  49. package/scss/_button.scss +148 -57
  50. package/scss/_color.scss +46 -28
  51. package/scss/_cssvar.scss +103 -12
  52. package/scss/_element.scss +84 -67
  53. package/scss/_index.scss +0 -3
  54. package/scss/_layout.scss +57 -26
  55. package/scss/_path.scss +2 -2
  56. package/scss/_selector.scss +20 -11
  57. package/scss/_typography.scss +115 -82
  58. package/scss/_units.scss +14 -13
  59. package/scss/_utils.scss +280 -18
  60. package/scss/base/_color.scss +2 -1
  61. package/scss/base/_elements.scss +61 -35
  62. package/scss/base/_index.scss +60 -23
  63. package/scss/base/_keyframes.scss +115 -16
  64. package/scss/base/_layout.scss +10 -6
  65. package/scss/base/_normalize.scss +6 -122
  66. package/scss/base/_print.scss +49 -0
  67. package/scss/base/_root.scss +28 -0
  68. package/scss/base/_typography.scss +4 -1
  69. package/scss/components/_accordion.scss +217 -0
  70. package/scss/components/_adaptive-spacing.scss +148 -0
  71. package/scss/components/_badge.scss +17 -14
  72. package/scss/components/_button-verbose.scss +138 -0
  73. package/scss/components/_button.scss +9 -4
  74. package/scss/components/_callout.scss +175 -0
  75. package/scss/components/_captioned-figure.scss +173 -0
  76. package/scss/components/_card-grid.scss +75 -0
  77. package/scss/components/_card.scss +420 -0
  78. package/scss/components/_css-icon.scss +433 -0
  79. package/scss/{_grid.scss → components/_data-grid.scss} +100 -68
  80. package/scss/components/_data-table.scss +180 -0
  81. package/scss/components/_fill-context.scss +20 -22
  82. package/scss/components/_flipcard-grid.scss +66 -0
  83. package/scss/components/_flipcard.scss +304 -0
  84. package/scss/components/_form-theme.scss +633 -0
  85. package/scss/components/_hero.scss +183 -0
  86. package/scss/components/_horizontal-rule.scss +51 -0
  87. package/scss/components/_image-grid.scss +71 -0
  88. package/scss/components/_index.scss +276 -38
  89. package/scss/components/_links.scss +1 -1
  90. package/scss/components/_list-lines.scss +14 -3
  91. package/scss/components/_list-ordered.scss +3 -1
  92. package/scss/components/_list-unordered.scss +3 -1
  93. package/scss/components/_menu-stack.scss +245 -0
  94. package/scss/components/_modal.scss +495 -0
  95. package/scss/components/_nav-strip.scss +148 -0
  96. package/scss/components/_overlay-section.scss +122 -0
  97. package/scss/components/_pager.scss +168 -0
  98. package/scss/components/_placeholder-block.scss +121 -0
  99. package/scss/components/_popover.scss +263 -0
  100. package/scss/components/_pull-quote.scss +111 -0
  101. package/scss/components/_ratio-box.scss +64 -0
  102. package/scss/components/_rule.scss +12 -9
  103. package/scss/components/_scroll-slider.scss +204 -0
  104. package/scss/components/_skip-link.scss +92 -0
  105. package/scss/components/_slider.scss +241 -0
  106. package/scss/components/_spoke-spinner.scss +193 -0
  107. package/scss/components/_tabs.scss +179 -0
  108. package/scss/components/_tag.scss +156 -0
  109. package/scss/components/_tile-button.scss +131 -0
  110. package/scss/components/_tile-grid-overlay.scss +132 -0
  111. package/scss/components/_tile-grid.scss +172 -0
  112. package/scss/components/_vignette.scss +65 -0
  113. package/scss/components/_wysiwyg.scss +94 -0
  114. package/scss/helpers/_color.scss +1 -0
  115. package/scss/helpers/_display.scss +2 -1
  116. package/scss/helpers/_index.scss +45 -22
  117. package/scss/helpers/_print.scss +20 -43
  118. package/scss/helpers/_typography.scss +3 -0
  119. package/scss/helpers/_units.scss +10 -13
  120. package/scss/helpers/_utilities.scss +5 -1
  121. package/scss/stylesheets/base-styles.scss +7 -0
  122. package/scss/stylesheets/component-styles.scss +7 -0
  123. package/scss/stylesheets/helper-styles.scss +7 -0
  124. package/types/events/index.d.ts +1 -1
  125. package/types/events/index.d.ts.map +1 -1
  126. package/types/index.d.ts +2 -2
  127. package/types/{helpers/css-breakpoint.d.ts → ui/breakpoints.d.ts} +3 -3
  128. package/types/ui/breakpoints.d.ts.map +1 -0
  129. package/types/ui/collapsible.d.ts +67 -0
  130. package/types/ui/collapsible.d.ts.map +1 -0
  131. package/types/ui/dialog.d.ts +42 -0
  132. package/types/ui/dialog.d.ts.map +1 -0
  133. package/types/ui/flipcard.d.ts +8 -1
  134. package/types/ui/flipcard.d.ts.map +1 -1
  135. package/types/ui/grid.d.ts +0 -11
  136. package/types/ui/grid.d.ts.map +1 -1
  137. package/types/ui/index.d.ts +23 -0
  138. package/types/ui/index.d.ts.map +1 -0
  139. package/types/ui/modal-builder.d.ts +54 -0
  140. package/types/ui/modal-builder.d.ts.map +1 -0
  141. package/types/ui/overflow-scroller-pager.d.ts +1 -1
  142. package/types/ui/overflow-scroller-pager.d.ts.map +1 -1
  143. package/types/ui/overflow-scroller.d.ts +3 -1
  144. package/types/ui/overflow-scroller.d.ts.map +1 -1
  145. package/types/ui/page.d.ts +5 -0
  146. package/types/ui/page.d.ts.map +1 -0
  147. package/types/ui/popover.d.ts +40 -0
  148. package/types/ui/popover.d.ts.map +1 -0
  149. package/types/ui/print-details.d.ts +10 -0
  150. package/types/ui/print-details.d.ts.map +1 -0
  151. package/types/ui/print.d.ts +10 -0
  152. package/types/ui/print.d.ts.map +1 -0
  153. package/types/ui/programmatic-modal.d.ts +19 -1
  154. package/types/ui/programmatic-modal.d.ts.map +1 -1
  155. package/types/ui/proxy-click.d.ts +18 -0
  156. package/types/ui/proxy-click.d.ts.map +1 -0
  157. package/types/ui/resizer.d.ts +1 -1
  158. package/types/ui/resizer.d.ts.map +1 -1
  159. package/types/ui/scroll-slider.d.ts +13 -0
  160. package/types/ui/scroll-slider.d.ts.map +1 -0
  161. package/types/ui/scrollpoint.d.ts +133 -0
  162. package/types/ui/scrollpoint.d.ts.map +1 -0
  163. package/types/ui/slider.d.ts +14 -2
  164. package/types/ui/slider.d.ts.map +1 -1
  165. package/types/ui/tabs.d.ts +22 -0
  166. package/types/ui/tabs.d.ts.map +1 -1
  167. package/types/ui/theme-toggle.d.ts +14 -0
  168. package/types/ui/theme-toggle.d.ts.map +1 -0
  169. package/types/ui/tooltip.d.ts +92 -10
  170. package/types/ui/tooltip.d.ts.map +1 -1
  171. package/types/utils/{logger.d.ts → class-logger.d.ts} +1 -1
  172. package/types/utils/class-logger.d.ts.map +1 -0
  173. package/types/utils/dom.d.ts +48 -0
  174. package/types/utils/dom.d.ts.map +1 -0
  175. package/types/utils/file-save.d.ts +64 -0
  176. package/types/utils/file-save.d.ts.map +1 -0
  177. package/types/utils/floating-ui.d.ts +19 -0
  178. package/types/utils/floating-ui.d.ts.map +1 -0
  179. package/types/utils/id.d.ts +10 -0
  180. package/types/utils/id.d.ts.map +1 -0
  181. package/types/utils/index.d.ts +9 -0
  182. package/types/utils/index.d.ts.map +1 -0
  183. package/types/utils/pause-youtube-video.d.ts.map +1 -0
  184. package/js/helpers/file-save.js +0 -52
  185. package/js/helpers/scrollbar-width-property.js +0 -14
  186. package/project.todo +0 -22
  187. package/scss/_calculate.scss +0 -64
  188. package/scss/_utility.scss +0 -12
  189. package/types/helpers/css-breakpoint.d.ts.map +0 -1
  190. package/types/helpers/file-save.d.ts +0 -17
  191. package/types/helpers/file-save.d.ts.map +0 -1
  192. package/types/helpers/node-data-manager.d.ts +0 -45
  193. package/types/helpers/node-data-manager.d.ts.map +0 -1
  194. package/types/helpers/pause-youtube-video.d.ts.map +0 -1
  195. package/types/helpers/scrollbar-width-property.d.ts +0 -11
  196. package/types/helpers/scrollbar-width-property.d.ts.map +0 -1
  197. package/types/ui/modals.d.ts +0 -27
  198. package/types/ui/modals.d.ts.map +0 -1
  199. package/types/utils/logger.d.ts.map +0 -1
  200. package/vite.config.js +0 -36
  201. /package/{js/deprecated → deprecated/js}/doc-ready.js +0 -0
  202. /package/{js/deprecated → deprecated/js}/jquery-prototypes.js +0 -0
  203. /package/{js/deprecated → deprecated/js}/mini-collapsible-popper-positioning.js +0 -0
  204. /package/{js/deprecated → deprecated/js}/mini-collapsible.js +0 -0
  205. /package/{js/helpers → deprecated/js}/node-data-manager.js +0 -0
  206. /package/{js/deprecated → deprecated/js}/script-loader.js +0 -0
  207. /package/{js/deprecated → deprecated/js}/waypoints/README.md +0 -0
  208. /package/{js/deprecated → deprecated/js}/waypoints/anchor-menu.js +0 -0
  209. /package/{js/deprecated → deprecated/js}/waypoints/element-waypoint.js +0 -0
  210. /package/{js/deprecated → deprecated/js}/waypoints/examples/page-link-menu.md +0 -0
  211. /package/{js/deprecated → deprecated/js}/waypoints/state-in-attribute.js +0 -0
  212. /package/types/{helpers → utils}/pause-youtube-video.d.ts +0 -0
package/scss/_utils.scss CHANGED
@@ -1,5 +1,6 @@
1
1
  ////
2
2
  /// @group utils
3
+ /// Basic utility functions/mixins used throughout system
3
4
  ////
4
5
 
5
6
  @use "sass:map";
@@ -10,33 +11,38 @@
10
11
 
11
12
  /// Module Settings
12
13
  /// @type Map
13
- /// @prop {Boolean} $config.debug-maps Debugs include map print outs
14
- /// @prop {Boolean} $config.file-header-comments Remove comment headers if you'd like
14
+ /// @prop {Boolean} debug-maps [true] Enable or disable debug map output
15
+ /// @prop {Boolean} file-header-comments [true] Enable or disable module/file header comments
16
+ /// @prop {Number} responsive-change [0.5vw] Default responsive amount to modify items using responsive-property mixin
17
+ /// @prop {Number} pixel-em-base [16px] Default base pixel font size for pixel-to-em
15
18
 
16
19
  $config: (
17
20
  "debug-maps": true,
18
- "file-header-comments": true
21
+ "file-header-comments": true,
22
+ "responsive-change": 0.5vw,
23
+ "pixel-em-base" : 16px
19
24
  ) !default;
20
25
 
21
26
  /// Change modules $config
22
27
  /// @param {Map} $changes Map of changes
23
- /// @example scss - General example, replace module-name with module's name
24
- /// @include module-name.set(( "property" : value ));
28
+ /// @example scss - General example
29
+ /// @include ulu.utils-set(( "property" : value ));
30
+
25
31
  @mixin set($changes) {
26
32
  $config: map.merge($config, $changes) !global;
27
33
  }
28
34
 
29
35
  /// Get a config option
30
36
  /// @param {Map} $name Name of property
31
- /// @example scss - General example, replace module-name with module's name
32
- /// @include module-name.get("property");
37
+ /// @example scss - General example
38
+ /// @include ulu.utils-get("property");
33
39
 
34
40
  @function get($name) {
35
41
  @return require-map-get($config, $name, 'utils');
36
42
  }
37
43
 
38
44
  /// Get a required value from a map, throw an error if not found
39
- /// - Remeber that that maps cannot intentionally use null (use false instead, if trying to avoid output if unconfigured)
45
+ /// - Remember that that maps cannot intentionally use null (use false instead, if trying to avoid output if not configured)
40
46
  /// @param {Map} $map The map to get the value from
41
47
  /// @param {String} $key The key in the map to get value from
42
48
  /// @param {String} $context The context of using this function for debugging help
@@ -58,21 +64,29 @@ $config: (
58
64
  /// @param {List} $list The map to get the value from
59
65
  /// @param {String} $value The value to search for in the list
60
66
  /// @param {String} $context The context of using this function for debugging help
67
+ /// @param {String} $warn Display warning instead of throwing error
61
68
 
62
- @mixin require-list-has($list, $value, $context: "unknown") {
63
- $index: list.index($list, $value) != null;
69
+ @mixin require-list-has($list, $value, $context: "unknown", $warn: false) {
70
+ $index: list.index($list, $value);
64
71
  @if ($index == null) {
65
- @error 'ULU: Unable to find item "#{ $value }" in #{ $context } list.';
72
+ $message: 'ULU: Unable to find item "#{ $value }" in #{ $context } list.';
73
+ @if ($warn) {
74
+ @warn $message;
75
+ } @else {
76
+ @error $message;
77
+ }
66
78
  }
67
79
  }
68
80
 
69
81
  /// Require that the list only is only made up of allowed items
70
82
  /// @param {List} $allowed The list of allowed items
71
83
  /// @param {String} $list The list to test allowed against
84
+ /// @param {String} $context The context of using this function for debugging help
85
+ /// @param {String} $warn Display warning instead of throwing error
72
86
 
73
- @mixin require-list-contains($allowed, $list, $context: "unknown") {
87
+ @mixin require-list-contains($allowed, $list, $context: "unknown", $warn: false) {
74
88
  @each $item in $list {
75
- @include require-list-has($allowed, $item, $context);
89
+ @include require-list-has($allowed, $item, $context, $warn);
76
90
  }
77
91
  }
78
92
 
@@ -148,8 +162,20 @@ $config: (
148
162
  }
149
163
  }
150
164
 
165
+ /// Returns true/false if map has property
166
+ /// @param {Map} $map Source map
167
+ /// @param {String} $key Property to check for
168
+ /// @return {Boolean}
169
+
170
+ @function map-has($map, $key) {
171
+ @if (meta.type-of($map) != "map") {
172
+ @error "map-has(): Incorrect type for $map (should be map)";
173
+ }
174
+ @return map.get($map, $key) != null;
175
+ }
176
+
151
177
  /// Repeatable pattern in core
152
- /// @deprecated Left in for compatability, will be removed, use map-merge with mode
178
+ /// @deprecated Left in for compatibility, will be removed, use map-merge with mode
153
179
 
154
180
  @function map-merge-or-overwrite($original, $changes, $deep: false, $overwrite: false) {
155
181
  $mode: null;
@@ -184,6 +210,33 @@ $config: (
184
210
  @return null;
185
211
  }
186
212
 
213
+
214
+ /// Checks if a map contains one or more of the keys
215
+ /// @param {Map} $map The map to check
216
+ /// @param {List} $keys The list of keys to check for
217
+ /// @param {List} $options Options for how this behaves
218
+ /// @param {List} $options.with-value Requires that at least one of the map entries from the list has a value other than null
219
+ @function map-contains-any($map, $keys, $options: ()) {
220
+ @if (meta.type-of($map) != "map") {
221
+ @error "map-contains-any(): Incorrect type for $map (should be map)";
222
+ }
223
+ @if (meta.type-of($keys) != "list") {
224
+ @error "map-contains-any(): Incorrect type for $keys (should be list)";
225
+ }
226
+ @each $key in $keys {
227
+ @if map.has-key($map, $key) {
228
+ @if map.get($options, "with-value") {
229
+ @if map.get($map, $key) != null {
230
+ @return true;
231
+ }
232
+ } @else {
233
+ @return true;
234
+ }
235
+ }
236
+ }
237
+ @return false;
238
+ }
239
+
187
240
  /// Helps in providing a dynamic fallback for modules whose defaults should come from another
188
241
  /// @param {String} $prop Property trying to get fallback for
189
242
  /// @param {*} $value The value that may need the fallback
@@ -191,17 +244,34 @@ $config: (
191
244
  /// @return {*} The user's original value, or if the value is true get the default value from the provided function
192
245
 
193
246
  @function function-fallback($prop, $value, $lookup) {
247
+ $arguments: null;
194
248
  // If there was already a value return it else resolve through passed function
195
249
  @if ($value == true) {
196
- $fn: map.get($lookup, $prop);
197
- @if ($fn) {
198
- @return meta.call($fn, $prop);
250
+ $function: map.get($lookup, $prop);
251
+ // Allow user to pass a nested map to route to another property
252
+ @if (meta.type-of($function) == "map") {
253
+ $functionMap: $function;
254
+ $function: map.get($functionMap, "function");
255
+ $prop: map.get($functionMap, "property");
256
+ // Arguments will override everything (allow calling functions with args)
257
+ $arguments: map.get($functionMap, "arguments");
258
+ }
259
+ @if ($function) {
260
+ @if ($arguments) {
261
+ @if (meta.type-of($arguments) == "list") {
262
+ @return meta.call($function, $arguments...);
263
+ } @else {
264
+ @error "Arguments must be a list, use single list for single argument ie '(3,)'";
265
+ }
266
+ } @else {
267
+ @return meta.call($function, $prop);
268
+ }
199
269
  }
200
270
  }
201
271
  @return $value;
202
272
  }
203
273
 
204
- /// Replaces all or one occurence of a string within a string
274
+ /// Replaces all or one occurrence of a string within a string
205
275
  /// @param {String} $string String to operate on
206
276
  /// @param {String} $find String to find within string
207
277
  /// @param {String} $replace String to replace found strings
@@ -224,3 +294,195 @@ $config: (
224
294
  @return $string;
225
295
  }
226
296
  }
297
+
298
+ /// Remove an item from a list (not map)
299
+ /// - Used for excluding things or as general utility
300
+ /// @param {List} $list String to operate on
301
+ /// @param {*} $remove Element in the list to remove
302
+ /// @return {List} New list with item removed
303
+
304
+ @function list-remove($list, $remove) {
305
+ $new-list: ();
306
+ @each $item in $list {
307
+ @if $item != $remove {
308
+ $new-list: list.append($new-list, $item);
309
+ }
310
+ }
311
+ @return $new-list;
312
+ }
313
+
314
+ /// Remove an item from a list (not map)
315
+ /// - Used for excluding things or as general utility
316
+ /// @param {List} $list String to operate on
317
+ /// @param {List} $remove List elements that should each be removed
318
+ /// @return {List} New list with item removed
319
+
320
+ @function list-without($list, $removal-list) {
321
+ $new-list: ();
322
+ @each $item in $list {
323
+ @if not list.index($removal-list, $item) {
324
+ $new-list: list.append($new-list, $item);
325
+ }
326
+ }
327
+ @return $new-list;
328
+ }
329
+
330
+ /// Join a list with a separator
331
+ /// @param {List} $list List to join
332
+ /// @param {String} $separator [", "] Separator to use
333
+ /// @param {Boolean} $to-string [true] The resulting list with join separator will be converted to a string (false will return new list with separators added between original items
334
+ /// @return {String|List} If separator was +, the result would be "value1 + value2" or (value1, "+", value2) depending on $to-string argument
335
+
336
+ @function list-join($list, $separator: ", ", $to-string: true) {
337
+ $joined: ();
338
+ $length: list.length($list);
339
+ @for $i from 1 through $length {
340
+ $item: list.nth($list, $i);
341
+ $joined: list.append($joined, $item);
342
+ @if $i < $length {
343
+ $joined: list.append($joined, $separator);
344
+ }
345
+ }
346
+ @if ($to-string) {
347
+ @return #{ $joined };
348
+ } @else {
349
+ @return $joined;
350
+ }
351
+ }
352
+
353
+ /// Resolve spacing info (ie. margin/padding like arguments)
354
+ /// - Will normalize the argument that may be shorthand or single value
355
+ /// - Used for programmatic things with single value config options for padding/margin
356
+ ///
357
+ /// @param {Number|List} $value The value to resolve (usually a config option)
358
+ /// @example scss Example of getting left value
359
+ /// $user-padding: (1em, 2em, 4em);
360
+ /// $spacing: get-spacing($user-padding);
361
+ /// // $spacing ("top" : 1em, "right" : 2em, "bottom" : 4em, "left" : 2em);
362
+ ///
363
+ /// .example {
364
+ /// left: map.get($spacing, "left");
365
+ /// // left = 2em
366
+ /// }
367
+ /// @return {Map} Map with spacing info for each side (top, right, bottom, left)
368
+ /// @throw If the list length > 4 (incorrect syntax for shorthand)
369
+
370
+ @function get-spacing($value) {
371
+ $is-list: meta.type-of($value) == "list";
372
+ $length: if($is-list, list.length($value), 1);
373
+ $single: $length == 1;
374
+ $top: if($is-list, list.nth($value, 1), $value); // Top is always the same
375
+
376
+ @if ($length > 4) {
377
+ @error "Spacing has more than 4 arguments (not correct shorthand)";
378
+ }
379
+
380
+ @return (
381
+ "top" : $top,
382
+ "right" : if($single, $top, list.nth($value, 2)),
383
+ "bottom" : if($single, $top, list.nth($value, if($length >= 3, 3, 1))),
384
+ "left" : if($single, $top, list.nth($value, if($length == 4, 4, 2)))
385
+ );
386
+ }
387
+
388
+ /// Resolve the top spacing value for margin/padding like arguments
389
+ /// @param {Number|List} $value The value to resolve (usually a config option)
390
+ /// @example scss Example of getting top value
391
+ /// $user-padding: (1em, 2em, 4em);
392
+ ///
393
+ /// .example {
394
+ /// top: get-spacing-top($user-padding);
395
+ /// // top = 2em
396
+ /// }
397
+ /// @return {Number}
398
+
399
+ @function get-spacing-top($value) {
400
+ @return map.get(get-spacing($value), "top");
401
+ }
402
+
403
+ /// Resolve the right spacing value for margin/padding like arguments
404
+ /// @param {Number|List} $value The value to resolve (usually a config option)
405
+ /// @example scss Example of getting right value
406
+ /// $user-padding: (1em, 2em, 4em);
407
+ ///
408
+ /// .example {
409
+ /// right: get-spacing-right($user-padding);
410
+ /// // right = 2em
411
+ /// }
412
+ /// @return {Number}
413
+
414
+ @function get-spacing-right($value) {
415
+ @return map.get(get-spacing($value), "right");
416
+ }
417
+
418
+ /// Resolve the bottom spacing value for margin/padding like arguments
419
+ /// @param {Number|List} $value The value to resolve (usually a config option)
420
+ /// @example scss Example of getting bottom value
421
+ /// $user-padding: (1em, 2em, 4em);
422
+ ///
423
+ /// .example {
424
+ /// bottom: get-spacing-bottom($user-padding);
425
+ /// // bottom = 2em
426
+ /// }
427
+ /// @return {Number}
428
+
429
+ @function get-spacing-bottom($value) {
430
+ @return map.get(get-spacing($value), "bottom");
431
+ }
432
+
433
+ /// Resolve the left spacing value for margin/padding like arguments
434
+ /// @param {Number|List} $value The value to resolve (usually a config option)
435
+ /// @example scss Example of getting left value
436
+ /// $user-padding: (1em, 2em, 4em);
437
+ ///
438
+ /// .example {
439
+ /// left: get-spacing-left($user-padding);
440
+ /// // left = 2em
441
+ /// }
442
+ /// @return {Number}
443
+
444
+ @function get-spacing-left($value) {
445
+ @return map.get(get-spacing($value), "left");
446
+ }
447
+
448
+ /// Strips the unit from the number
449
+ /// - Normally this shouldn't be needed
450
+ /// @link https://stackoverflow.com/questions/12328259/how-do-you-strip-the-unit-from-any-number-in-sass/12335841#12335841 Original source (Miriam Suzanne)
451
+
452
+ @function strip-unit($value) {
453
+ @return math.div($value, ($value * 0 + 1));
454
+ }
455
+
456
+ /// Calculate the size of something at a given scale (percentage/exponential)
457
+ /// @param {Number} $base The number the scale starts at
458
+ /// @param {Number} $ratio The amount the scale changes over one set
459
+ /// @param {Number} $sizes The number of steps in the scale
460
+ /// @param {Number} $size The step you are trying to calculate
461
+ /// @return {Number}
462
+
463
+ @function ratio-scale-size($base, $ratio, $sizes, $size) {
464
+ @return $base * math.pow($ratio, math.div($size, $sizes));
465
+ }
466
+
467
+ /// Convert from pixel to em
468
+ /// @param {Number} $pixels The number the scale starts at
469
+ /// @param {Number} $base How many pixels equal 1em
470
+ /// @return {Number} Em Conversion
471
+
472
+ @function pixel-to-em($pixels, $base: get("pixel-em-base")) {
473
+ @return math.div($pixels, $base) + 1em;
474
+ }
475
+
476
+ /// Provides user with a fallback for a calc that's just an enhancement
477
+ /// @param {String} $property The CSS property to set
478
+ /// @param {*} $value The value to set on the property
479
+ /// @param {Css} $responsive-change The amount to change (vw or vh units) (combined with unit past)
480
+
481
+ @mixin responsive-property(
482
+ $property,
483
+ $value,
484
+ $responsive-change: get("responsive-change")
485
+ ) {
486
+ #{ $property } : $value;
487
+ #{ $property } : calc(#{ $value } + #{ $responsive-change });
488
+ }
@@ -1,11 +1,12 @@
1
1
  ////
2
2
  /// @group color
3
+ /// Outputs color base classes
3
4
  ////
4
5
 
5
6
  @use "../utils";
6
7
  @use "../color";
7
8
 
8
- /// Prints color-context styles as base classes (top of stylesheet)
9
+ /// Outputs color-context styles as base classes (top of stylesheet)
9
10
 
10
11
  @mixin styles {
11
12
  @include utils.file-header('base', 'color');
@@ -1,5 +1,6 @@
1
1
  ////
2
2
  /// @group elements
3
+ /// Outputs general HTML element styles (body, a, etc)
3
4
  ////
4
5
 
5
6
  @use "sass:map";
@@ -14,32 +15,36 @@
14
15
 
15
16
  /// Module Settings
16
17
  /// @type Map
17
- /// @prop {Number} $config.links-state-styling Just color/defaults vs hover/visited/active
18
+ /// @prop {CssValue} details-animation [(UluFadeInDown 350ms ease-in-out)] Animation for the details element when toggled.
19
+ /// @prop {Boolean} link [true] Enables link styling.
20
+ /// @prop {Boolean} link-hover [true] Enables link hover and focus styling.
21
+ /// @prop {Boolean} link-visited [true] Enables visited link styling.
18
22
 
19
23
  $config: (
24
+ "details-animation" : (UluFadeInDown 350ms ease-in-out),
20
25
  "link" : true,
21
- "link:hover" : true,
22
- "link:visited" : false
26
+ "link-hover" : true,
27
+ "link-visited" : false,
23
28
  ) !default;
24
29
 
25
30
  /// Change modules $config
26
31
  /// @param {Map} $changes Map of changes
27
- /// @example scss - General example, replace module-name with module's name
28
- /// @include module-name.set(( "property" : value ));
32
+ /// @example scss - General example
33
+ /// @include ulu.base-elements-set(( "property" : value ));
29
34
  @mixin set($changes) {
30
35
  $config: map.merge($config, $changes) !global;
31
36
  }
32
37
 
33
38
  /// Get a config option
34
39
  /// @param {Map} $name Name of property
35
- /// @example scss - General example, replace module-name with module's name
36
- /// @include module-name.get("property");
40
+ /// @example scss - General example
41
+ /// @include ulu.base-elements-get("property");
37
42
 
38
43
  @function get($name) {
39
44
  @return utils.require-map-get($config, $name, "element [config]");
40
45
  }
41
46
 
42
- /// Prints elements base styles
47
+ /// Output the elements base styles
43
48
  /// @name base-elements-styles
44
49
  /// @example scss
45
50
  /// @include ulu.base-elements-styles();
@@ -47,7 +52,6 @@ $config: (
47
52
  @mixin styles {
48
53
 
49
54
  @include utils.file-header('base', 'elements');
50
-
51
55
  *,
52
56
  ::before,
53
57
  ::after {
@@ -60,15 +64,7 @@ $config: (
60
64
  }
61
65
  }
62
66
  body {
63
- color: color.get('type');
64
- background-color: color.get("background");
65
- font-family: typography.get("font-family");
66
- margin: 0;
67
- // Note we are using relative units here instead of setting a
68
- // pixel base like we use to on the HTML
69
- // This will allow the user preference in font size
70
- // Useful for accessibility
71
- @include typography.size("base");
67
+ @include styles-body();
72
68
  @include breakpoint.embed-for-scripts();
73
69
  }
74
70
  h1,
@@ -118,6 +114,9 @@ $config: (
118
114
  form {
119
115
  width: 100%;
120
116
  }
117
+ video {
118
+ display: block;
119
+ }
121
120
  code,
122
121
  kbd,
123
122
  samp,
@@ -147,33 +146,30 @@ $config: (
147
146
  border-style: none;
148
147
  }
149
148
  // Not styling ordered lists because they are used in navigation and other UI components
150
- ul {
149
+ // - Would rather explicitly style numbered lists so menus and things
150
+ // don't have to reset. Usually there's only a few type of in content
151
+ // numbered lists and those are styled via classes or wysiwyg
152
+ ul,
153
+ ol {
151
154
  list-style: none;
152
155
  }
153
- // Style ordered lists since we don't use them much in the UI components
154
- ol {
155
- list-style: none;
156
- }
157
-
158
156
  a {
159
157
  // User can disable link styling if they want to add more specific styling
160
158
  // and omit this in element base
161
159
  @if (get("link")) {
162
160
  @include element.link-defaults(
163
- $hover: get("link:hover"),
164
- $visited: get("link:visited"),
161
+ $hover: get("link-hover"),
162
+ $visited: get("link-visited"),
165
163
  );
166
164
  }
167
165
  }
168
- // button,
169
- // [type="button"],
170
- // [type="reset"],
171
- // [type="submit"] {
172
- // @include button.reset();
173
- // }
174
- // For accessible tabs
175
- [role="tab"] {
176
- cursor: pointer;
166
+ [disabled],
167
+ :disabled {
168
+ opacity: 0.5;
169
+ cursor: not-allowed;
170
+ }
171
+ button[disabled] {
172
+ pointer-events: none;
177
173
  }
178
174
  dt {
179
175
  font-weight: bold;
@@ -185,4 +181,34 @@ $config: (
185
181
  blockquote {
186
182
  margin: 0;
187
183
  }
184
+ @if get("details-animation") {
185
+ details {
186
+ &[open] {
187
+ summary {
188
+ ~ * {
189
+ // Prevent issues with opening these programmatically on firefox
190
+ // - Animation would not be complete in the clone on firefox (looks empty)
191
+ @media screen {
192
+ animation: get("details-animation");
193
+ }
194
+ }
195
+ }
196
+ }
197
+ }
198
+ }
199
+ audio {
200
+ display: block;
201
+ margin: 1rem 0;
202
+ }
203
+ }
204
+
205
+ @mixin styles-body() {
206
+ color: color.get('type');
207
+ background-color: color.get("background");
208
+ font-family: typography.get("font-family");
209
+ // Note we are using relative units here instead of setting a
210
+ // pixel base like we use to on the HTML
211
+ // This will allow the user preference in font size
212
+ // Useful for accessibility
213
+ @include typography.size("base");
188
214
  }
@@ -1,62 +1,99 @@
1
1
  ////
2
- /// @group all
2
+ /// @group index
3
+ /// Output all base styles
3
4
  ////
4
5
 
6
+ @forward "root" as root-*;
5
7
  @forward "normalize" as normalize-*;
8
+ @forward "print" as print-*;
9
+ @forward "color" as color-*;
6
10
  @forward "elements" as elements-*;
7
11
  @forward "keyframes" as keyframes-*;
8
12
  @forward "typography" as typography-*;
9
13
  @forward "layout" as layout-*;
10
14
 
11
- @use "sass:map";
15
+ @use "sass:list";
16
+
12
17
  @use "../utils";
13
18
  @use "normalize";
14
- @use "typography";
19
+ @use "root";
15
20
  @use "elements";
21
+ @use "print";
22
+ @use "typography";
16
23
  @use "color";
17
24
  @use "keyframes";
18
25
  @use "layout";
19
26
 
20
- // Used to check against user's includes
27
+ /// Default includes, all modules
28
+ /// @type List
21
29
 
22
- $-all-includes: (
23
- "normalize" : true,
24
- "elements" : true,
25
- "keyframes" : true,
26
- "typography" : true,
27
- "color" : true,
28
- "layout" : true
30
+ $all-includes: (
31
+ "normalize",
32
+ "root"
33
+ "elements,"
34
+ "print",
35
+ "elements",
36
+ "keyframes",
37
+ "typography",
38
+ "color",
39
+ "layout"
29
40
  );
30
41
 
42
+ /// Current included modules (for output when using styles), defaults to all
43
+ /// @type List
44
+
45
+ $current-includes: $all-includes;
46
+
47
+ /// Change default includes (when user prints modules)
48
+ /// - This available as configuration so that it can be configured (to allow easily copying configuration)
49
+ /// @param {List} $includes List of modules by name to be included when styles are printed
50
+
51
+ @mixin set-includes($includes) {
52
+ @include utils.require-list-contains($all-includes, $includes, "base.set-includes", true);
53
+ $current-includes: $includes !global;
54
+ }
55
+
56
+ /// Exclude certain items from includes
57
+ /// @param {List} $excludes List of item names
58
+
59
+ @mixin set-excludes($excludes) {
60
+ $current-includes: utils.list-without($current-includes, $excludes) !global;
61
+ }
62
+
31
63
  /// Prints all Base styles
32
64
  /// @name base-styles
33
- /// @param {List} $includes A list of changes to this module's includes
65
+ /// @param {List} $includes [$all-includes] A list of components to include (defaults to current)
34
66
  /// @example scss
35
67
  /// @include ulu.base-styles();
36
68
 
37
- @mixin styles($includes: null) {
69
+ @mixin styles($includes: $current-includes) {
38
70
  @include utils.file-header("base");
39
- @if $includes {
40
- @include utils.require-list-contains($-all-includes, $includes);
41
- $-all-includes: map.merge($-all-includes, $includes) !global;
42
- }
43
- @if (map.get($-all-includes, "normalize")) {
71
+
72
+ @include utils.require-list-contains($all-includes, $includes, "base.$includes", true);
73
+
74
+ @if (list.index($includes, "normalize")) {
44
75
  @include normalize.styles;
45
76
  }
46
- @if (map.get($-all-includes, "elements")) {
77
+ @if (list.index($includes, "root")) {
78
+ @include root.styles;
79
+ }
80
+ @if (list.index($includes, "elements")) {
47
81
  @include elements.styles;
48
82
  }
49
- @if (map.get($-all-includes, "keyframes")) {
83
+ @if (list.index($includes, "keyframes")) {
50
84
  @include keyframes.styles;
51
85
  }
52
- @if (map.get( $-all-includes, "typography")) {
86
+ @if (list.index($includes, "typography")) {
53
87
  @include typography.styles;
54
88
  }
55
- @if (map.get($-all-includes, "color")) {
89
+ @if (list.index($includes, "color")) {
56
90
  @include color.styles;
57
91
  }
58
- @if (map.get($-all-includes, "layout")) {
92
+ @if (list.index($includes, "layout")) {
59
93
  @include layout.styles;
60
94
  }
95
+ @if (list.index($includes, "print")) {
96
+ @include normalize.styles;
97
+ }
61
98
  }
62
99