@ulu/frontend 0.0.22 → 0.1.0-beta.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 (212) hide show
  1. package/CHANGELOG.md +4 -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 +32 -11
  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 +71 -37
  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 +142 -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
@@ -0,0 +1,433 @@
1
+ ////
2
+ /// @group css-icon
3
+ /// Simple icons that only require CSS selectors, used for defaults (JS, etc). Not meant to be replacement for complete icon library. Note the selectors currently can't be modified.
4
+ ////
5
+
6
+ // Notes:
7
+ // - Using this to avoid having coupled image in base, can easily switch
8
+ // to font awesome in production
9
+ // - Can't use clip-path with svg clipPath without it being loaded in document (more coupling/setup)
10
+ // - Can't use mask-image until it's more universal (could create icons the
11
+ // old way and export and use the masks in the future (complex shapes)
12
+
13
+ // Note: File size is 7kb (1kb gzip) (2024-09-25)(
14
+ // Benchmarks:
15
+ // - 2024/09/25 - 1.3kb - File size (7kb unzipped)
16
+ // - 2024/10/14 - 1.3kb - Tested after adding active icons and using attribute selectors
17
+
18
+ @use "sass:map";
19
+ @use "sass:math";
20
+
21
+ @use "../utils";
22
+
23
+ /// Module Settings
24
+ /// @type Map
25
+ /// @prop {String} active-selector [details[open] > summary &, &.is-active] The active selector for css-icon.
26
+ /// @prop {Color} color [currentColor] The color of the css-icon.
27
+ /// @prop {CssValue} font-family [('Courier New', monospace)]
28
+ /// @prop {CssValue} margin [(0 0.15em)] The icon's margin
29
+ /// @prop {Dimension} size [1.1em] The width, height and font size of the css-icon.
30
+ /// @prop {Dimension} stroke-border-radius [1px] The rounding of the strokes for css-icon.
31
+ /// @prop {Dimension} stroke-width [0.15em] The stroke width of the css-icon.
32
+ /// @prop {Dimension} text-offset [0.05em] When using an icon with text, adds a margin to match the text height.
33
+ /// @prop {Dimension} text-size [1em] font-size of the icon when using text.
34
+ /// @prop {Dimension} vertical-align [-0.2em] Vertical-align for css-icon
35
+ /// @prop {Time} transition-duration [200ms] The duration length for the transition.
36
+ /// @prop {CssValue} transition-timing-function [ease-in] The timing function for the transition.
37
+ /// @prop {Map} stroke-sizes [Map] Modifiers to adjust stroke sizes for the icons.
38
+
39
+ $config: (
40
+ "active-selector" : "details[open] > summary &, &.is-active",
41
+ "color" : currentColor,
42
+ "font-family" : ('Courier New', monospace),
43
+ "margin" : (0 0.15em),
44
+ "size" : 1.15em,
45
+ "stroke-border-radius" : null,
46
+ "stroke-width" : 3px,
47
+ "text-offset" : 0.05em,
48
+ "text-size" : 1em,
49
+ "vertical-align" : -0.25em,
50
+ "transition-duration" : 200ms,
51
+ "transition-timing-function" : ease-in,
52
+ "stroke-sizes" : (
53
+ "large" : (
54
+ "stroke-width" : 5px,
55
+ "stroke-border-radius" : 2px
56
+ )
57
+ )
58
+ );
59
+
60
+ /// Change modules $config
61
+ /// @param {Map} $changes Map of changes
62
+ /// @example
63
+ /// @include ulu.component-css-icon-set(( "property" : value ));
64
+
65
+ @mixin set($changes) {
66
+ $config: map.merge($config, $changes) !global;
67
+ }
68
+
69
+ /// Get a config option
70
+ /// @param {Map} $name Name of property
71
+ /// @example
72
+ /// @include ulu.component-css-icon-get("property");
73
+
74
+ @function get($name) {
75
+ @return utils.require-map-get($config, $name, "css-icon [config]");
76
+ }
77
+
78
+ /// Used to style active icons
79
+ /// - Probably only useful for extending this component and matching active selector
80
+ /// - Used internally in module
81
+
82
+ @mixin when-active() {
83
+ #{ get("active-selector") } {
84
+ @content;
85
+ }
86
+ }
87
+
88
+ @mixin for-each-stroke() {
89
+ @each $name, $props in get("stroke-sizes") {
90
+ $stroke-width: map.get($props, "stroke-width");
91
+ $stroke-border-radius: map.get($props, "stroke-width");
92
+ .css-icon--stroke-#{ $name } {
93
+ @content($stroke-width, $stroke-border-radius);
94
+ }
95
+ }
96
+ }
97
+
98
+ /// Output CSS icon component stylesheet
99
+ /// @example scss
100
+ /// @include ulu.component-css-icon-styles();
101
+
102
+ @mixin styles {
103
+ $border: get("stroke-width") solid get("color");
104
+ $size: get("size");
105
+ $stroke-width: get("stroke-width");
106
+ $half-height: math.div(get("size"), 2);
107
+ $half-stroke-width: math.round(math.div(get("stroke-width"), 2));
108
+
109
+
110
+ .css-icon {
111
+ display: inline-block;
112
+ position: relative;
113
+ width: get("size");
114
+ height: get("size");
115
+ transform-origin: center;
116
+ vertical-align: get("vertical-align");
117
+ font-variant: normal;
118
+ text-rendering: auto;
119
+ line-height: 1;
120
+ margin: get("margin");
121
+ -moz-osx-font-smoothing: grayscale;
122
+ -webkit-font-smoothing: antialiased;
123
+ // Icons that share pseudos for strokes
124
+ &:before,
125
+ &:after {
126
+ // content: "";
127
+ display: block;
128
+ position: absolute;
129
+ width: 100%;
130
+ height: $stroke-width;
131
+ top: 50%;
132
+ left: 50%;
133
+ background-color: get("color");
134
+ transform: translateX(-50%);
135
+ margin-top: -($half-stroke-width);
136
+ border-radius: get("stroke-border-radius");
137
+ }
138
+ }
139
+ @include for-each-stroke() using ($alt-width, $alt-border-radius) {
140
+ &::before,
141
+ &::after {
142
+ height: $alt-width;
143
+ margin-top: -(math.div($alt-width, 2));
144
+ border-radius: $alt-border-radius;
145
+ }
146
+ }
147
+ .css-icon--plus,
148
+ .css-icon--plus-to-minus,
149
+ .css-icon--minus,
150
+ .css-icon--close {
151
+ &::before,
152
+ &::after {
153
+ content: "";
154
+ }
155
+ }
156
+
157
+
158
+ // Solid icons
159
+ [class*="css-icon--circle"],
160
+ [class*="css-icon--square"] {
161
+ background-color: get("color");
162
+ }
163
+ [class*="css-icon--circle"] {
164
+ border-radius: 50%;
165
+ }
166
+
167
+ .css-icon--square {
168
+ transform: scale(0.9);
169
+ }
170
+ .css-icon--square,
171
+ .css-icon--circle,
172
+ .css-icon--circle-outline,
173
+ .css-icon--square-outline {
174
+ &::before,
175
+ &::after {
176
+ content: none;
177
+ }
178
+ }
179
+ .css-icon--circle-outline,
180
+ .css-icon--square-outline {
181
+ background-color: transparent;
182
+ border: $border;
183
+ }
184
+
185
+
186
+ .css-icon--circle-info,
187
+ .css-icon--circle-question {
188
+ &:before {
189
+ content: "i";
190
+ text-align: center;
191
+ font-size: get("text-size");
192
+ font-family: get("font-family");
193
+ font-weight: bold;
194
+ margin-top: get("text-offset");
195
+ color: get("color");
196
+ height: auto;
197
+ left: 0;
198
+ right: 0;
199
+ background-color: transparent;
200
+ filter: invert(1) brightness(1.5);
201
+ transform: translateY(-50%);
202
+ }
203
+ &::after {
204
+ content: none;
205
+ }
206
+ }
207
+ .css-icon--circle-question {
208
+ &:before {
209
+ content: "?";
210
+ }
211
+ }
212
+
213
+ [class*="css-icon--arrow"] {
214
+ &::before,
215
+ &::after {
216
+ content: "";
217
+ transform: translateY(-50%);
218
+ margin-top: 0;
219
+ }
220
+ }
221
+
222
+ // Arrow uses same equilateral triangle
223
+ [class*="css-icon--triangle"],
224
+ [class*="css-icon--arrow"]::after {
225
+ background-color: get("color");
226
+ clip-path: polygon(10% 10%, 90% 50%, 10% 90%);
227
+ }
228
+ [class*="css-icon--arrow"] {
229
+ &:before {
230
+ content: "";
231
+ width: 70%;
232
+ left: 0;
233
+ }
234
+ // Note triangle clip-path is defined above with the solid triangle
235
+ &:after {
236
+ content: "";
237
+ border-radius: 0;
238
+ height: 100%;
239
+ width: 55%;
240
+ right: 0;
241
+ left: auto;
242
+ }
243
+ }
244
+ [class*="css-icon--angle"] {
245
+ transform: rotate(135deg);
246
+ &:before,
247
+ &:after {
248
+ content: "";
249
+ top: 30%;
250
+ left: 30%;
251
+ width: 70%;
252
+ transform: none;
253
+ margin-top: 0;
254
+ }
255
+ &:after {
256
+ width: $stroke-width;
257
+ height: 70%;
258
+ }
259
+ }
260
+ @include for-each-stroke() using ($alt-width, $alt-border-radius) {
261
+ &[class*="css-icon--angle"] {
262
+ &:after {
263
+ width: $alt-width;
264
+ }
265
+ }
266
+ }
267
+ .css-icon--angle-left,
268
+ .css-icon--arrow-left {
269
+ transform: rotate(315deg);
270
+ }
271
+ .css-icon--angle-up,
272
+ .css-icon--angle-up-to-down {
273
+ transform: rotate(45deg);
274
+ }
275
+ .css-icon--angle-down,
276
+ .css-icon--angle-down-to-up {
277
+ transform: rotate(225deg);
278
+ }
279
+
280
+ // Centered pseudos offset by half of stroke before transform
281
+ // Icons with centered pseudos
282
+
283
+ .css-icon--plus,
284
+ .css-icon--plus-to-minus {
285
+ &:before {
286
+ transform: translateX(-50%) rotate(90deg);
287
+ }
288
+ &:after {
289
+ transform: translateX(-50%);
290
+ }
291
+ }
292
+ .css-icon--minus {
293
+ &:before {
294
+ content: none;
295
+ }
296
+ &:after {
297
+ transform: translateX(-50%);
298
+ }
299
+ }
300
+ .css-icon--close {
301
+ &:before {
302
+ transform: translate(-50%) rotate(45deg);
303
+ }
304
+ &:after {
305
+ transform: translate(-50%) rotate(-45deg);
306
+ }
307
+ }
308
+ [class*="css-icon--drag"] {
309
+ &::before {
310
+ content: "";
311
+ // Make up for margin-top by default
312
+ margin-top: -($stroke-width + $stroke-width);
313
+ }
314
+ &::after {
315
+ content: "";
316
+ margin-top: $stroke-width;
317
+ }
318
+ }
319
+
320
+ @include for-each-stroke() using ($alt-width, $alt-border-radius) {
321
+ &[class*="css-icon--drag"] {
322
+ &::before {
323
+ margin-top: -($alt-width + $alt-width);
324
+ }
325
+ &::after {
326
+ margin-top: $alt-width;
327
+ }
328
+ }
329
+ }
330
+ // For the menu icon the blocks are stacked with box shadow being the
331
+ // third bar
332
+ .css-icon--menu,
333
+ .css-icon--menu-to-close {
334
+ display: inline-flex;
335
+ align-items: center;
336
+ flex-direction: column;
337
+ justify-content: center;
338
+ vertical-align: middle;
339
+ &::before,
340
+ &::after {
341
+ content: "";
342
+ position: static;
343
+ transform: none;
344
+ margin-top: 0;
345
+ }
346
+ &::before {
347
+ box-shadow: 0px ($stroke-width * 2 + 1px) get("color");
348
+ margin-bottom: ($stroke-width * 3) + 2px;
349
+ }
350
+ }
351
+ @include for-each-stroke() using ($alt-width, $alt-border-radius) {
352
+ &.css-icon--menu,
353
+ &.css-icon--menu-to-close {
354
+ &::before {
355
+ box-shadow: 0px ($alt-width * 2 + 1px) get("color");
356
+ margin-bottom: ($alt-width * 3) + 2px;
357
+ }
358
+ }
359
+ }
360
+
361
+ // Rotations
362
+ .css-icon--triangle-left,
363
+ .css-icon--arrow-left {
364
+ transform: rotate(180deg);
365
+ }
366
+ .css-icon--drag-x,
367
+ .css-icon--triangle-up,
368
+ .css-icon--arrow-up {
369
+ transform: rotate(270deg);
370
+ }
371
+ .css-icon--triangle-down,
372
+ .css-icon--arrow-down {
373
+ transform: rotate(90deg);
374
+ }
375
+
376
+ // Active icons
377
+ .css-icon--plus-to-minus {
378
+ &,
379
+ &::before,
380
+ &::after {
381
+ transition: get("transition-duration") get("transition-timing-function");
382
+ transition-property: opacity, transform;
383
+ }
384
+ @include when-active() {
385
+ &::before {
386
+ opacity: 0;
387
+ transform: translateX(-50%) rotate(180deg);
388
+ }
389
+ }
390
+ }
391
+
392
+ .css-icon--angle-right-to-down,
393
+ .css-icon--angle-up-to-down,
394
+ .css-icon--angle-down-to-up {
395
+ @include when-active() {
396
+ transition-duration: get("transition-duration");
397
+ transition-property: transform;
398
+ }
399
+ }
400
+ .css-icon--angle-right-to-down,
401
+ .css-icon--angle-up-to-down {
402
+ @include when-active() {
403
+ transform: rotate(225deg);
404
+ }
405
+ }
406
+ .css-icon--angle-down-to-up {
407
+ @include when-active() {
408
+ transform: rotate(45deg);
409
+ }
410
+ }
411
+ .css-icon--angle-up-to-down,
412
+ .css-icon--angle-down-to-up {
413
+ @include when-active() {
414
+ transition-duration: get("transition-duration") * 2;
415
+ }
416
+ }
417
+ .css-icon--menu-to-close {
418
+ @include when-active() {
419
+ animation: UluScaleIn get("transition-duration") get("transition-timing-function") forwards;
420
+ &::before,
421
+ &::after {
422
+ position: absolute;
423
+ top: 50%;
424
+ transition: none;
425
+ transform: translate(-50%) rotate(-45deg);
426
+ }
427
+ &:before {
428
+ box-shadow: none;
429
+ transform: translate(-50%) rotate(45deg);
430
+ }
431
+ }
432
+ }
433
+ }
@@ -1,71 +1,80 @@
1
1
  ////
2
- /// @group grid
2
+ /// @group data-grid
3
+ /// A page grid layout component that uses data attribute instead of class names, for brevity and readability
3
4
  ////
4
- /// Layout grid that uses attributes instead of classes
5
- /// - See the core layout module for changing defaults
6
-
7
-
8
- /// HTML Attribute to use for selecting
9
- /// @example markup
10
- /// <!-- instead it styles like: -->
11
- /// <div data-grid="columns: 12, gutters: true">
12
- /// <div data-grid-item="width: 4, width-medium: 6, offset-medium: 3">
13
- /// </div>
14
- /// </div>
15
- ///
16
- /// <!-- or if using container -->
17
- /// <div data-grid-container>
18
- /// <div data-grid="columns: 12, gutters: true">
19
- /// <div data-grid-item="width: 4, width-medium: 6, offset-medium: 3">
20
- /// </div>
21
- /// </div>
22
- /// </div>
5
+
6
+ /// Content Block
7
+ /// @demo data-grid
23
8
 
24
9
  @use "sass:map";
25
10
  @use "sass:math";
26
- @use "breakpoint";
27
- @use "color";
28
- @use "element";
29
- @use "layout";
30
- @use "utils";
11
+
12
+ @use "../breakpoint";
13
+ @use "../color";
14
+ @use "../element";
15
+ @use "../layout";
16
+ @use "../selector";
17
+ @use "../typography";
18
+ @use "../utils";
31
19
 
32
20
  /// Module Settings
33
21
  /// @type Map
34
- /// @prop {Number} $config.columns Default for grid mixin
35
- /// @prop {String} $config.attribute Default attribute to use for grid mixin
36
- /// @prop {Number} $config.gutter Default gutter for grid mixin
37
- /// @prop {Map} $config.extra-breakpoints Default extra breakpoints for grid mixin
38
- /// @prop {MaStringp} $config.position-class-column-first Classname for position system (JS) grid uses to display rules (layout can flow, script will update classes)
39
- /// @prop {String} $config.position-class-column-last See definition above
40
- /// @prop {String} $config.position-class-row-first See definition above
41
- /// @prop {String} $config.position-class-row-last See definition above
22
+ /// @prop {String} attribute [data-grid] Default attribute to use for grid mixin.
23
+ /// @prop {String} attribute-container [data-grid-container] Default attribute to use for grid's container.
24
+ /// @prop {Number} columns [12] Default for grid mixin.
25
+ /// @prop {Number} gutter [14px] Default gutter for grid mixin.
26
+ /// @prop {String} position-class-column-first [position-column-first] Classname for position system (JS) grid uses to display rules (layout can flow, script will update classes)
27
+ /// @prop {String} position-class-column-last [position-column-last] See definition above
28
+ /// @prop {String} position-class-row-first [position-row-first] See definition above
29
+ /// @prop {String} position-class-row-last [position-row-last] See definition above
30
+ /// @prop {Dimension} sticky-bottom [var(--ulu-sticky-bottom-offset, 0)] When a column is sticky bottom this is the value for the sticky offset, set to --ulu-sticky-bottom-offset by default
31
+ /// @prop {Dimension} sticky-top [var(--ulu-sticky-top-offset, 0)] When a column is sticky top this is the value for the sticky offset, set to --ulu-sticky-top-offset by default
32
+ /// @prop {String} rule-color ["rule"] The color of the rule. This uses color.scss, so the value of this option should be a color variable from color.scss.
33
+ /// @prop {Dimension} rule-size [1px] The width of the rule
34
+ /// @prop {Map} extra-breakpoints [Map] Default extra breakpoints for grid mixin
35
+ /// @prop {Map} extra-gutter-scales [Map] Extra options for gutter scales.
36
+ /// @prop {Map} extra-rule-styles [Map] Extra options for rule styles.
42
37
 
43
38
  $config: (
44
- "columns": 12,
45
- "attribute": "data-grid",
46
- "attribute-container" : "data-grid-container",
47
- "gutter": 14px,
48
- "breakpoint" : false, // Fallback to default
49
- "extra-breakpoints" : (
39
+ "attribute": "data-grid",
40
+ "attribute-container": "data-grid-container",
41
+ "breakpoint": false, // Fallback to default
42
+ "columns": 12,
43
+ "gutter": 14px,
44
+ "position-class-column-first": "position-column-first",
45
+ "position-class-column-last": "position-column-last",
46
+ "position-class-row-first": "position-row-first",
47
+ "position-class-row-last": "position-row-last",
48
+ "sticky-bottom": var(--ulu-sticky-bottom-offset, 0),
49
+ "sticky-top": var(--ulu-sticky-top-offset, 0),
50
+ "rule-color" : "rule",
51
+ "rule-size" : 1px,
52
+ "extra-breakpoints": (
50
53
  "medium" : (
51
- "breakpoint" : "medium",
52
- "gutter" : 15px
54
+ "breakpoint": "medium",
55
+ "gutter": 15px
53
56
  ),
54
57
  "large" : (
55
- "breakpoint" : "large",
56
- "gutter" : 20px
58
+ "breakpoint": "large",
59
+ "gutter": 20px
60
+ )
61
+ ),
62
+ "extra-gutter-scales" : (
63
+ "small": 0.6
64
+ ),
65
+ "extra-rule-styles" : (
66
+ "light" : (
67
+ "size" : 1px,
68
+ "color": "rule-light"
57
69
  )
58
70
  ),
59
- "position-class-column-first": "position-column-first",
60
- "position-class-column-last": "position-column-last",
61
- "position-class-row-first": "position-row-first",
62
- "position-class-row-last": "position-row-last"
63
71
  ) !default;
64
72
 
73
+
65
74
  /// Change modules $config
66
75
  /// @param {Map} $changes Map of changes
67
- /// @example scss
68
- /// @include module-name.set(( "property" : value ));
76
+ /// @example
77
+ /// @include ulu.component-data-grid-set(( "property" : value ));
69
78
 
70
79
  @mixin set($changes) {
71
80
  $config: map.merge($config, $changes) !global;
@@ -73,17 +82,16 @@ $config: (
73
82
 
74
83
  /// Get a config option
75
84
  /// @param {Map} $name Name of property
76
- /// @example scss
77
- /// @include module-name.get("property");
85
+ /// @example
86
+ /// @include ulu.component-data-grid-get("property");
78
87
 
79
88
  @function get($name) {
80
- @return utils.require-map-get($config, $name, "grid [config]");
89
+ @return utils.require-map-get($config, $name, "data-grid [config]");
81
90
  }
82
91
 
83
- /// Returns gutter size for grid breakpoint map, defaults to the config's values
84
- /// Pass custom map to get gutter values from it
85
- /// @param {String} $name The name of the "grid breakpoint" (could be a different name than the actual breakpoint name it maps too)
86
- /// @param {Map} $custom-map Provide custom map of grid breakpoints to get the gutter from (defaults to the grid module's defaults 'extra-breakpoints')
92
+ /// Output component stylesheet
93
+ /// @example scss
94
+ /// @include ulu.component-data-grid-styles();
87
95
 
88
96
  @function get-gutter($name: null, $custom-map: null) {
89
97
  @if (not $name) {
@@ -95,6 +103,8 @@ $config: (
95
103
  }
96
104
  }
97
105
 
106
+ /// Get the default breakpoint for the grid (when it starts to be a grid (vs stacked/mobile)
107
+
98
108
  @function get-default-breakpoint() {
99
109
  $breakpoint: get("breakpoint");
100
110
  @if ($breakpoint) {
@@ -104,31 +114,43 @@ $config: (
104
114
  }
105
115
  }
106
116
 
107
- /// Creates grid css (variation of original data-grid)
117
+ /// Prints default grid styles, if you want to customize further please use the create mixin
118
+ /// @demo data-grid#align
119
+ /// @example scss
120
+ /// @include ulu.component-data-grid-styles();
121
+
122
+ @mixin styles() {
123
+ @include create();
124
+ }
125
+
126
+ /// Output data grid styles
127
+ /// - Can be used instead of styles() to have full control over options or for alternate grids (grids with different settings/column count)
108
128
  /// @param {Number} $columns Columns in grid
109
129
  /// @param {Number} $breakpoint Breakpoint key for starting the grid
110
- /// @param {Map} $extra-breakpoints Map with other breakpoints to add (map of breakpoint and gutter see config.extra-breakpoints for an example (smalles to largest)
130
+ /// @param {Map} $extra-breakpoints Map with other breakpoints to add (map of breakpoint and gutter see config.extra-breakpoints for an example (smallest to largest)
111
131
  /// @param {Number} $gutter Size in pixels for the gutters
112
132
  /// @param {Boolean} $include-rules Print styles for including rules
113
- /// @param {Number} $rule-size Size of the rule (border/seperator)
133
+ /// @param {Number} $rule-size Size of the rule (border/separator)
114
134
  /// @param {Map} $extra-rule-styles Map of other rule styles to add (map of maps of size, and color), key is the styles name ("name": ("size" : 4px, "color" : "color name" || color))
115
135
  /// @param {String} $extra-gutter-scales A map of gutter scales used like `data-grid="gutter-scale: large`, configuration map property becomes scale name and value is the amount (multiplier) to apply to the grid's gutter ie `( "large" : 2.25 )`
116
136
  /// @param {Map} $attribute Attribute to use for selecting grid and children. Children attribute get's "-item" as a suffix ("ie. data-grid, data-grid-item")
117
137
 
118
138
  @mixin create(
119
- $columns: 12,
139
+ $columns: get("columns"),
120
140
  $breakpoint: get-default-breakpoint(),
121
141
  $extra-breakpoints: if(breakpoint.exists("large"), get("extra-breakpoints"), false),
122
142
  $gutter: get("gutter"),
123
143
  $include-rules: false,
124
- $rule-size: 1px,
125
- $rule-color: color.get("rule"),
126
- $extra-rule-styles: null,
127
- $extra-gutter-scales: null,
144
+ $rule-size: get("rule-size"),
145
+ $rule-color: get("rule-color"),
146
+ $extra-rule-styles: get("extra-rule-styles"),
147
+ $extra-gutter-scales: get("extra-gutter-scales"),
128
148
  $attribute: get("attribute"),
129
149
  $include-container: true,
130
150
  $container-attribute: get("attribute-container"),
131
- $container-gutter-scales: true
151
+ $container-gutter-scales: true,
152
+ $sticky-top: get("sticky-top"),
153
+ $sticky-bottom: get("sticky-bottom")
132
154
  ) {
133
155
  $attribute-item: "#{ $attribute }-item";
134
156
  $select-grid: '[#{ $attribute }*="columns: #{ $columns }"]';
@@ -286,7 +308,7 @@ $config: (
286
308
  // For removing the rule per row (via equal heights for now)
287
309
  &.#{ $position-class-row-last } {
288
310
  &#{ $select-rule-row } {
289
- content: none;
311
+ content: none !important;
290
312
  }
291
313
  }
292
314
  }
@@ -372,6 +394,16 @@ $config: (
372
394
  padding-left: $gutter;
373
395
  padding-right: $gutter;
374
396
  }
397
+ > #{'[#{ $attribute-item }*="sticky: top"]'} {
398
+ position: sticky;
399
+ align-self: start;
400
+ top: $sticky-top;
401
+ }
402
+ > #{'[#{ $attribute-item }*="sticky: bottom"]'} {
403
+ position: sticky;
404
+ align-self: end;
405
+ bottom: $sticky-bottom;
406
+ }
375
407
 
376
408
  @if $extra-gutter-scales {
377
409
  @each $scale, $amount in $extra-gutter-scales {
@@ -516,7 +548,7 @@ $config: (
516
548
  &#{'[#{ $attribute }*="rules-row-style: #{ $name }"]'} {
517
549
  > #{ $select-item } {
518
550
  &#{ $select-rule-row } {
519
- background-color: $color;
551
+ background-color: color.get($color);
520
552
  height: $size;
521
553
  }
522
554
  }
@@ -690,7 +722,7 @@ $config: (
690
722
  &#{'[#{ $attribute }*="rules-row: #{ $key }"]'} {
691
723
  > #{ $select-item } {
692
724
  &#{ $select-rule-row } {
693
- content: $size;
725
+ content: "";
694
726
  #{ $position }: math.floor(math.div($size, 2)) * -1;
695
727
  }
696
728
  }