@ulu/frontend 0.0.23 → 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 (211) hide show
  1. package/deprecated/js/drupal-programmatic-modal.js +91 -0
  2. package/{js/ui/modals.js → deprecated/js/micromodal-modals.js} +41 -67
  3. package/dist/ulu-frontend.min.css +1 -1
  4. package/dist/ulu-frontend.min.js +70 -1
  5. package/index.js +6 -1
  6. package/js/events/index.js +58 -7
  7. package/js/index.js +3 -7
  8. package/js/{helpers/css-breakpoint.js → ui/breakpoints.js} +9 -11
  9. package/js/ui/collapsible.js +195 -0
  10. package/js/ui/dialog.js +157 -0
  11. package/js/ui/dialog.todo +37 -0
  12. package/js/ui/flipcard.js +55 -11
  13. package/js/ui/grid.js +2 -47
  14. package/js/ui/index.js +21 -0
  15. package/js/ui/modal-builder.js +197 -0
  16. package/js/ui/overflow-scroller-pager.js +1 -1
  17. package/js/ui/overflow-scroller.js +8 -5
  18. package/js/ui/page.js +14 -0
  19. package/js/ui/popover.js +135 -0
  20. package/js/ui/print-details.js +44 -0
  21. package/js/ui/print.js +67 -0
  22. package/js/ui/programmatic-modal.js +79 -81
  23. package/js/ui/proxy-click.js +80 -0
  24. package/js/ui/resizer.js +3 -3
  25. package/js/ui/scroll-slider.js +56 -0
  26. package/js/ui/scrollpoint.js +300 -0
  27. package/js/ui/slider.js +72 -10
  28. package/js/ui/tabs.js +85 -58
  29. package/js/ui/theme-toggle.js +129 -0
  30. package/js/ui/tooltip.js +268 -67
  31. package/js/utils/{logger.js → class-logger.js} +6 -5
  32. package/js/utils/dom.js +122 -0
  33. package/js/utils/file-save.js +67 -0
  34. package/js/utils/floating-ui.js +83 -0
  35. package/js/utils/id.js +22 -0
  36. package/js/utils/index.js +7 -0
  37. package/js/{helpers → utils}/pause-youtube-video.js +1 -1
  38. package/package.json +32 -11
  39. package/resources/drupal/twig-macros/accordion.twig +99 -0
  40. package/resources/drupal/twig-macros/dropdown.twig +44 -0
  41. package/resources/drupal/twig-macros/flipcard.twig +69 -0
  42. package/resources/drupal/twig-macros/image.twig +30 -0
  43. package/resources/drupal/twig-macros/layout.twig +338 -0
  44. package/resources/drupal/twig-macros/slider.twig +214 -0
  45. package/resources/drupal/twig-macros/tabs.twig +84 -0
  46. package/scss/README.md +13 -1
  47. package/scss/_breakpoint.scss +69 -26
  48. package/scss/_button.scss +148 -57
  49. package/scss/_color.scss +46 -28
  50. package/scss/_cssvar.scss +103 -12
  51. package/scss/_element.scss +84 -67
  52. package/scss/_index.scss +0 -3
  53. package/scss/_layout.scss +57 -26
  54. package/scss/_path.scss +2 -2
  55. package/scss/_selector.scss +20 -11
  56. package/scss/_typography.scss +115 -82
  57. package/scss/_units.scss +14 -13
  58. package/scss/_utils.scss +280 -18
  59. package/scss/base/_color.scss +2 -1
  60. package/scss/base/_elements.scss +61 -35
  61. package/scss/base/_index.scss +60 -23
  62. package/scss/base/_keyframes.scss +115 -16
  63. package/scss/base/_layout.scss +10 -6
  64. package/scss/base/_normalize.scss +6 -122
  65. package/scss/base/_print.scss +49 -0
  66. package/scss/base/_root.scss +28 -0
  67. package/scss/base/_typography.scss +4 -1
  68. package/scss/components/_accordion.scss +217 -0
  69. package/scss/components/_adaptive-spacing.scss +148 -0
  70. package/scss/components/_badge.scss +17 -14
  71. package/scss/components/_button-verbose.scss +138 -0
  72. package/scss/components/_button.scss +9 -4
  73. package/scss/components/_callout.scss +175 -0
  74. package/scss/components/_captioned-figure.scss +173 -0
  75. package/scss/components/_card-grid.scss +75 -0
  76. package/scss/components/_card.scss +420 -0
  77. package/scss/components/_css-icon.scss +433 -0
  78. package/scss/{_grid.scss → components/_data-grid.scss} +100 -68
  79. package/scss/components/_data-table.scss +180 -0
  80. package/scss/components/_fill-context.scss +20 -22
  81. package/scss/components/_flipcard-grid.scss +66 -0
  82. package/scss/components/_flipcard.scss +304 -0
  83. package/scss/components/_form-theme.scss +633 -0
  84. package/scss/components/_hero.scss +183 -0
  85. package/scss/components/_horizontal-rule.scss +51 -0
  86. package/scss/components/_image-grid.scss +71 -0
  87. package/scss/components/_index.scss +276 -38
  88. package/scss/components/_links.scss +1 -1
  89. package/scss/components/_list-lines.scss +14 -3
  90. package/scss/components/_list-ordered.scss +3 -1
  91. package/scss/components/_list-unordered.scss +3 -1
  92. package/scss/components/_menu-stack.scss +245 -0
  93. package/scss/components/_modal.scss +495 -0
  94. package/scss/components/_nav-strip.scss +148 -0
  95. package/scss/components/_overlay-section.scss +122 -0
  96. package/scss/components/_pager.scss +168 -0
  97. package/scss/components/_placeholder-block.scss +121 -0
  98. package/scss/components/_popover.scss +263 -0
  99. package/scss/components/_pull-quote.scss +111 -0
  100. package/scss/components/_ratio-box.scss +64 -0
  101. package/scss/components/_rule.scss +12 -9
  102. package/scss/components/_scroll-slider.scss +204 -0
  103. package/scss/components/_skip-link.scss +92 -0
  104. package/scss/components/_slider.scss +241 -0
  105. package/scss/components/_spoke-spinner.scss +193 -0
  106. package/scss/components/_tabs.scss +179 -0
  107. package/scss/components/_tag.scss +142 -0
  108. package/scss/components/_tile-button.scss +131 -0
  109. package/scss/components/_tile-grid-overlay.scss +132 -0
  110. package/scss/components/_tile-grid.scss +172 -0
  111. package/scss/components/_vignette.scss +65 -0
  112. package/scss/components/_wysiwyg.scss +94 -0
  113. package/scss/helpers/_color.scss +1 -0
  114. package/scss/helpers/_display.scss +2 -1
  115. package/scss/helpers/_index.scss +45 -22
  116. package/scss/helpers/_print.scss +20 -43
  117. package/scss/helpers/_typography.scss +3 -0
  118. package/scss/helpers/_units.scss +10 -13
  119. package/scss/helpers/_utilities.scss +5 -1
  120. package/scss/stylesheets/base-styles.scss +7 -0
  121. package/scss/stylesheets/component-styles.scss +7 -0
  122. package/scss/stylesheets/helper-styles.scss +7 -0
  123. package/types/events/index.d.ts +1 -1
  124. package/types/events/index.d.ts.map +1 -1
  125. package/types/index.d.ts +2 -2
  126. package/types/{helpers/css-breakpoint.d.ts → ui/breakpoints.d.ts} +3 -3
  127. package/types/ui/breakpoints.d.ts.map +1 -0
  128. package/types/ui/collapsible.d.ts +67 -0
  129. package/types/ui/collapsible.d.ts.map +1 -0
  130. package/types/ui/dialog.d.ts +42 -0
  131. package/types/ui/dialog.d.ts.map +1 -0
  132. package/types/ui/flipcard.d.ts +8 -1
  133. package/types/ui/flipcard.d.ts.map +1 -1
  134. package/types/ui/grid.d.ts +0 -11
  135. package/types/ui/grid.d.ts.map +1 -1
  136. package/types/ui/index.d.ts +23 -0
  137. package/types/ui/index.d.ts.map +1 -0
  138. package/types/ui/modal-builder.d.ts +54 -0
  139. package/types/ui/modal-builder.d.ts.map +1 -0
  140. package/types/ui/overflow-scroller-pager.d.ts +1 -1
  141. package/types/ui/overflow-scroller-pager.d.ts.map +1 -1
  142. package/types/ui/overflow-scroller.d.ts +3 -1
  143. package/types/ui/overflow-scroller.d.ts.map +1 -1
  144. package/types/ui/page.d.ts +5 -0
  145. package/types/ui/page.d.ts.map +1 -0
  146. package/types/ui/popover.d.ts +40 -0
  147. package/types/ui/popover.d.ts.map +1 -0
  148. package/types/ui/print-details.d.ts +10 -0
  149. package/types/ui/print-details.d.ts.map +1 -0
  150. package/types/ui/print.d.ts +10 -0
  151. package/types/ui/print.d.ts.map +1 -0
  152. package/types/ui/programmatic-modal.d.ts +19 -1
  153. package/types/ui/programmatic-modal.d.ts.map +1 -1
  154. package/types/ui/proxy-click.d.ts +18 -0
  155. package/types/ui/proxy-click.d.ts.map +1 -0
  156. package/types/ui/resizer.d.ts +1 -1
  157. package/types/ui/resizer.d.ts.map +1 -1
  158. package/types/ui/scroll-slider.d.ts +13 -0
  159. package/types/ui/scroll-slider.d.ts.map +1 -0
  160. package/types/ui/scrollpoint.d.ts +133 -0
  161. package/types/ui/scrollpoint.d.ts.map +1 -0
  162. package/types/ui/slider.d.ts +14 -2
  163. package/types/ui/slider.d.ts.map +1 -1
  164. package/types/ui/tabs.d.ts +22 -0
  165. package/types/ui/tabs.d.ts.map +1 -1
  166. package/types/ui/theme-toggle.d.ts +14 -0
  167. package/types/ui/theme-toggle.d.ts.map +1 -0
  168. package/types/ui/tooltip.d.ts +92 -10
  169. package/types/ui/tooltip.d.ts.map +1 -1
  170. package/types/utils/{logger.d.ts → class-logger.d.ts} +1 -1
  171. package/types/utils/class-logger.d.ts.map +1 -0
  172. package/types/utils/dom.d.ts +48 -0
  173. package/types/utils/dom.d.ts.map +1 -0
  174. package/types/utils/file-save.d.ts +64 -0
  175. package/types/utils/file-save.d.ts.map +1 -0
  176. package/types/utils/floating-ui.d.ts +19 -0
  177. package/types/utils/floating-ui.d.ts.map +1 -0
  178. package/types/utils/id.d.ts +10 -0
  179. package/types/utils/id.d.ts.map +1 -0
  180. package/types/utils/index.d.ts +9 -0
  181. package/types/utils/index.d.ts.map +1 -0
  182. package/types/utils/pause-youtube-video.d.ts.map +1 -0
  183. package/js/helpers/file-save.js +0 -52
  184. package/js/helpers/scrollbar-width-property.js +0 -14
  185. package/project.todo +0 -22
  186. package/scss/_calculate.scss +0 -64
  187. package/scss/_utility.scss +0 -12
  188. package/types/helpers/css-breakpoint.d.ts.map +0 -1
  189. package/types/helpers/file-save.d.ts +0 -17
  190. package/types/helpers/file-save.d.ts.map +0 -1
  191. package/types/helpers/node-data-manager.d.ts +0 -45
  192. package/types/helpers/node-data-manager.d.ts.map +0 -1
  193. package/types/helpers/pause-youtube-video.d.ts.map +0 -1
  194. package/types/helpers/scrollbar-width-property.d.ts +0 -11
  195. package/types/helpers/scrollbar-width-property.d.ts.map +0 -1
  196. package/types/ui/modals.d.ts +0 -27
  197. package/types/ui/modals.d.ts.map +0 -1
  198. package/types/utils/logger.d.ts.map +0 -1
  199. package/vite.config.js +0 -36
  200. /package/{js/deprecated → deprecated/js}/doc-ready.js +0 -0
  201. /package/{js/deprecated → deprecated/js}/jquery-prototypes.js +0 -0
  202. /package/{js/deprecated → deprecated/js}/mini-collapsible-popper-positioning.js +0 -0
  203. /package/{js/deprecated → deprecated/js}/mini-collapsible.js +0 -0
  204. /package/{js/helpers → deprecated/js}/node-data-manager.js +0 -0
  205. /package/{js/deprecated → deprecated/js}/script-loader.js +0 -0
  206. /package/{js/deprecated → deprecated/js}/waypoints/README.md +0 -0
  207. /package/{js/deprecated → deprecated/js}/waypoints/anchor-menu.js +0 -0
  208. /package/{js/deprecated → deprecated/js}/waypoints/element-waypoint.js +0 -0
  209. /package/{js/deprecated → deprecated/js}/waypoints/examples/page-link-menu.md +0 -0
  210. /package/{js/deprecated → deprecated/js}/waypoints/state-in-attribute.js +0 -0
  211. /package/types/{helpers → utils}/pause-youtube-video.d.ts +0 -0
@@ -0,0 +1,180 @@
1
+ ////
2
+ /// @group data-table
3
+ /// For tabular data in native HTML tables. Note, this component can be used with the Vue sticky table plugin.
4
+ ////
5
+
6
+ @use "sass:map";
7
+ @use "sass:math";
8
+ @use "sass:meta";
9
+ @use "sass:selector" as sassSelector;
10
+
11
+ @use "../selector";
12
+ @use "../color";
13
+ @use "../utils";
14
+ @use "../typography";
15
+
16
+ // Used for function fallback
17
+ $-fallbacks: (
18
+ // // Example mapping fallback to another modules config value
19
+ "line-height" : (
20
+ "function" : meta.get-function("get", false, "typography"),
21
+ "property" : "line-height-dense"
22
+ ),
23
+ );
24
+
25
+ /// Module Settings
26
+ /// @type Map
27
+
28
+ $config: (
29
+ "cell-padding" : (0.5em,),
30
+ "text-align" : left,
31
+ "type-size" : "small",
32
+ "background-color" : white,
33
+ "header-background-color" : #eeeeee,
34
+ "body-background-color" : white,
35
+ "footer-background-color" : #f3f3f3,
36
+ "color" : "type-secondary",
37
+ "line-height" : true,
38
+ "column-min-width" : 6em,
39
+ "first-column-large-min-width" : 15em,
40
+ "border-width" : 1px,
41
+ "border-color" : #dddddd,
42
+ "striped-row-background-color" : #eeeeee,
43
+ "muted-row-background-color" : #ccc,
44
+ "muted-row-border-color" : null,
45
+ "highlighted-row-background-color" : #ccc,
46
+ "highlighted-row-border-color" : null,
47
+ "large-header-cell-padding-y" : 1em,
48
+ "caption-type-size" : "large",
49
+ "caption-font-weight" : bold,
50
+ "caption-margin" : (0 0 1em 0),
51
+ "caption-padding" : (0,),
52
+ "extra-selector" : ".wysiwyg table"
53
+ ) !default;
54
+
55
+ /// Change modules $config
56
+ /// @param {Map} $changes Map of changes
57
+ /// @example
58
+ /// @include ulu.component-data-table-set(( "property" : value ));
59
+
60
+ @mixin set($changes) {
61
+ $config: map.merge($config, $changes) !global;
62
+ }
63
+
64
+ /// Get a config option
65
+ /// @param {Map} $name Name of property
66
+ /// @example
67
+ /// @include ulu.component-data-table-get("property");
68
+
69
+ @function get($name) {
70
+ $value: utils.require-map-get($config, $name, "data-table [config]");
71
+ @return utils.function-fallback($name, $value, $-fallbacks);
72
+ }
73
+
74
+ /// Output component stylesheet
75
+ /// @example scss
76
+ /// @include ulu.component-data-table-styles();
77
+
78
+ @mixin styles {
79
+ $prefix: selector.class("data-table");
80
+ $border: get("border-width") solid color.get(get("border-color"));
81
+
82
+ $selector-table: sassSelector.parse("#{ $prefix } table, table#{ $prefix }");
83
+ $selector-inner: sassSelector.parse($prefix);
84
+ $extra-selector: get("extra-selector");
85
+
86
+ // Allow this to work with wysiwyg class, or as "table" for editor stylesheet
87
+ @if ($extra-selector) {
88
+ $selector-table: sassSelector.parse("#{ $selector-table }, #{ $extra-selector }");
89
+ $selector-inner: sassSelector.parse("#{ $selector-inner }, #{ $extra-selector }");
90
+ }
91
+
92
+ // Selector can be on table or wrapping table for convenience
93
+ #{ $selector-table } {
94
+ background-color: color.get(get("background-color"));
95
+ border-collapse: collapse;
96
+ border: $border;
97
+ color: color.get(get("color"));
98
+ }
99
+ #{ $selector-inner } {
100
+ @if (get("type-size") and typography.has-size(get("type-size"))) {
101
+ @include typography.size(get("type-size"), $only-font-size: true);
102
+ }
103
+ line-height: get("line-height");
104
+
105
+ caption {
106
+ @if (get("caption-type-size") and typography.has-size(get("caption-type-size"))) {
107
+ @include typography.size(get("caption-type-size"));
108
+ }
109
+ font-weight: get("caption-font-weight");
110
+ text-align: left;
111
+ margin: get("caption-margin");
112
+ padding: get("caption-padding");
113
+ }
114
+ th,
115
+ tr,
116
+ td {
117
+ text-align: get("text-align");
118
+ }
119
+ th {
120
+ min-width: get("column-min-width");
121
+ }
122
+ td:not(:last-child),
123
+ th:not(:last-child) {
124
+ border-right: $border;
125
+ }
126
+ // This makes it work for nested headers last child that aren't the last in the table
127
+ th:not(:first-child) {
128
+ border-left: $border;
129
+ }
130
+ tr + tr {
131
+ border-top: $border;
132
+ }
133
+ thead tr {
134
+ background-color: color.get(get("header-background-color"));
135
+ }
136
+ tbody tr {
137
+ background-color: color.get(get("body-background-color"));
138
+ }
139
+ tfoot tr {
140
+ background-color: color.get(get("footer-background-color"));
141
+ }
142
+ th,
143
+ td {
144
+ padding: get("cell-padding");
145
+ }
146
+ }
147
+ #{ $prefix }__row-muted {
148
+ background-color: color.get(get("muted-row-background-color"));
149
+ td {
150
+ border-color: color.get(get("muted-row-border-color"));
151
+ }
152
+ }
153
+ #{ $prefix }__row-highlighted {
154
+ background-color: color.get(get("highlighted-row-background-color"));
155
+ td {
156
+ border-color: color.get(get("highlighted-row-border-color"));
157
+ }
158
+ }
159
+ #{ $prefix }--striped {
160
+ tbody tr:nth-child(even) {
161
+ background-color: color.get(get("striped-row-background-color"));
162
+ }
163
+ }
164
+ #{ $prefix }--large-first {
165
+ thead tr:first-child th:first-child,
166
+ tbody td:first-child {
167
+ min-width: get("first-column-large-min-width");
168
+ }
169
+ }
170
+ #{ $prefix }--large-header {
171
+ thead th {
172
+ padding-top: get("large-header-cell-padding-y");
173
+ padding-bottom: get("large-header-cell-padding-y");
174
+ }
175
+ }
176
+ #{ $prefix }--no-border table,
177
+ table#{ $prefix }--no-border {
178
+ border: none;
179
+ }
180
+ }
@@ -3,14 +3,16 @@
3
3
  ////
4
4
  /// Setup images or videos to behave like background images (object-fit).
5
5
 
6
-
7
- @use "../grid";
6
+ @use "data-grid";
8
7
  @use "../breakpoint";
8
+ @use "../selector";
9
9
 
10
-
11
- /// Use the parent selector '.fill-context' on the element that should be the
12
- /// frame for the child object (img,video). Can be used within the grid with
13
- /// modifier (see in example below).
10
+ /// Output component stylesheet
11
+ /// - Use the parent selector '.fill-context' on the element that should be the
12
+ /// frame for the child object (img,video).
13
+ /// - Can be used within the grid with modifier (see in example below).
14
+ /// @example scss
15
+ /// @include ulu.component-fill-context-styles();
14
16
  /// @example html {preview}
15
17
  /// <div class="fill-context">
16
18
  /// <img class="fill-context__object" src="background.jpg">
@@ -24,37 +26,33 @@
24
26
  /// <div data-grid-item="width: 6" class="fill-context fill-context--in-grid fill-context--contain">
25
27
  /// <img src="background.jpg">
26
28
  /// </div>
27
- ///
28
-
29
-
30
- /// Prints fill context styles
31
- /// @example scss
32
- /// @include ulu.component-fill-context-styles();
33
29
 
34
30
  @mixin styles {
35
- .fill-context {
31
+ $prefix: selector.class("fill-context");
32
+
33
+ #{ $prefix } {
36
34
  position: relative;
37
35
  }
38
- .fill-context__object,
39
- .fill-context--auto img {
36
+ #{ $prefix }__object,
37
+ #{ $prefix }--auto img {
40
38
  position: absolute;
41
39
  width: 100%;
42
40
  height: 100%;
43
41
  object-fit: cover;
44
42
  }
45
43
 
46
- .fill-context--contain {
47
- &.fill-context--auto img,
48
- .fill-context__object {
44
+ #{ $prefix }--contain {
45
+ &#{ $prefix }--auto img,
46
+ #{ $prefix }__object {
49
47
  object-fit: contain;
50
48
  }
51
49
  }
52
50
 
53
- .fill-context--in-grid {
54
- $breakpoint: grid.get-default-breakpoint();
51
+ #{ $prefix }--in-grid {
52
+ $breakpoint: data-grid.get-default-breakpoint();
55
53
  @include breakpoint.max($breakpoint) {
56
- .fill-context__object,
57
- &.fill-context--auto img {
54
+ #{ $prefix }__object,
55
+ &#{ $prefix }--auto img {
58
56
  position: static;
59
57
  height: auto;
60
58
  object-fit: fill;
@@ -0,0 +1,66 @@
1
+ ////
2
+ /// @group flipcard-grid
3
+ ////
4
+ /// Creates adaptive (changing at breakpoints)n between items (vertical/horizontal layout)
5
+
6
+ @use "sass:map";
7
+
8
+ @use "../breakpoint";
9
+ @use "../utils";
10
+ @use "../selector";
11
+
12
+ /// Module Settings
13
+ /// @type Map
14
+ /// @prop {Dimension} gutter [1rem] The gutter between grid items.
15
+ /// @prop {CssValue} grid-template-columns [1fr 1fr] The size ratio of items in the grid.
16
+
17
+
18
+ $config: (
19
+ "gutter" : 1rem,
20
+ "grid-template-columns" : 1fr 1fr,
21
+ "breakpoint" : "small"
22
+ );
23
+
24
+ /// Change modules $config
25
+ /// @param {Map} $changes Map of changes
26
+ /// @example
27
+ /// @include ulu.component-flipcard-grid-set(( "property" : value ));
28
+
29
+ @mixin set($changes) {
30
+ $config: map.merge($config, $changes) !global;
31
+ }
32
+
33
+ /// Get a config option
34
+ /// @param {Map} $name Name of property
35
+ /// @example
36
+ /// @include ulu.component-flipcard-grid-get("property");
37
+
38
+ @function get($name) {
39
+ @return utils.require-map-get($config, $name, "flipcard-grid [config]");
40
+ }
41
+
42
+ /// Output component stylesheet
43
+ /// @example scss
44
+ /// @include ulu.component-flipcard-grid-styles();
45
+
46
+ @mixin styles {
47
+ $prefix: selector.class("flipcard-grid");
48
+
49
+ #{ $prefix } {
50
+ display: grid;
51
+ grid-template-columns: 1fr;
52
+ grid-auto-rows: 1fr;
53
+ justify-items: stretch;
54
+ gap: get("gutter");
55
+ list-style: none !important; // B/c in Editor
56
+ padding: 0 !important; // B/c in Editor
57
+ @if (breakpoint.exists(get("breakpoint"))) {
58
+ @include breakpoint.min(get("breakpoint")) {
59
+ grid-template-columns: get("grid-template-columns");
60
+ }
61
+ }
62
+ }
63
+ #{ $prefix }__item {
64
+ margin: 0 !important; // B/c in Editor
65
+ }
66
+ }
@@ -0,0 +1,304 @@
1
+
2
+ ////
3
+ /// @group flipcard
4
+ ////
5
+ /// Creates adaptive (changing at breakpoints)n between items (vertical/horizontal layout)
6
+
7
+ @use "sass:map";
8
+ @use "../utils";
9
+ @use "../selector";
10
+
11
+ /// Module Settings
12
+ /// @type Map
13
+ /// @prop {Color} background-color [white] Background color of the text-only flipcard front.
14
+ /// @prop {Color} background-color-image [rgba(96, 255, 255, 0.89)] Background color of the image flipcard front.
15
+ /// @prop {Number} image-opacity [0.7] Opacity of the image to allow shading from the background color.
16
+ /// @prop {Color} background-color-back [rgb(178, 178, 178)] Background color on the back of the flipcard.
17
+ /// @prop {Color} border [1px solid black] Flipcard border.
18
+ /// @prop {Dimension} border-radius [6px] Border radius for flipcard.
19
+ /// @prop {Color} border-color-hover [black] border color when hovered.
20
+ /// @prop {CssValue} control-button-border-focus [2px solid blue] Border that shows when focused.
21
+ /// @prop {Time} anim-duration [430ms] Animation duration.
22
+ /// @prop {Time} anim-delay [200ms] Animation delay.
23
+ /// @prop {Dimension} padding [1.5rem] Padding for the flipcard.
24
+ /// @prop {Color} title-color [red] Color of the front page text.
25
+ /// @prop {Color} title-color-hover [green] Color of the front page text when hovered or focused.
26
+ /// @prop {Color} icon-color [pink] Color of the icon.
27
+ /// @prop {Color} icon-color-hover [aqua] Color of the icon when hovered or focused.
28
+ /// @prop {Color} icon-color-image [aqua] Color of the icon when using an image.
29
+ /// @prop {Color} icon-color-image-hover [pink] Color of the icon when using an image and hovered or focused.
30
+ /// @prop {Color} title-color-image [black] Color of the front page text when using an image.
31
+ /// @prop {Color} title-color-image-hover [blue] Color of the front page text when using an image and hovered or focused.
32
+ /// @prop {Boolean} bottom-shadow [true] Boolean that enables a bottom shadow to the image flipcard.
33
+
34
+
35
+ $config: (
36
+ "anim-delay" : 200ms,
37
+ "anim-duration" : 430ms,
38
+ "anim-front-close": "FlipcardFrontClose",
39
+ "anim-front-open": "FlipcardFrontOpen",
40
+ "anim-back-open": "FlipcardBackOpen",
41
+ "anim-timing-function": ease-out,
42
+ "background-color" : white,
43
+ "background-color-image" : rgba(96, 255, 255, 0.89),
44
+ "background-color-back" : rgb(178, 178, 178),
45
+ "bottom-shadow" : true,
46
+ "border" : 1px solid black,
47
+ "border-color-hover" : black,
48
+ "border-radius" : 6px,
49
+ "control-button-border-focus" : 2px solid blue,
50
+ "icon-color" : pink,
51
+ "icon-color-hover" : aqua,
52
+ "icon-color-image" : aqua,
53
+ "icon-color-image-hover" : pink,
54
+ "image-opacity" : 0.7,
55
+ "padding" : 1.5rem,
56
+ "title-color" : red,
57
+ "title-color-hover" : green,
58
+ "title-color-image" : black,
59
+ "title-color-image-hover" : blue,
60
+ );
61
+
62
+ /// Change modules $config
63
+ /// @param {Map} $changes Map of changes
64
+ /// @example
65
+ /// @include ulu.component-flipcard-set(( "property" : value ));
66
+
67
+ @mixin set($changes) {
68
+ $config: map.merge($config, $changes) !global;
69
+ }
70
+
71
+ /// Set sizes map
72
+ /// @param {Map} $changes Map of changes
73
+ /// @param {String} $merge-mode Merge mode see utils.map-merge() [null|"deep"|"overwrite"]
74
+
75
+ @mixin set-sizes($changes, $merge-mode: null) {
76
+ $sizes: utils.map-merge($sizes, $changes, $merge-mode) !global;
77
+ }
78
+
79
+ /// Get a config option
80
+ /// @param {Map} $name Name of property
81
+ /// @example
82
+ /// @include ulu.component-flipcard-get("property");
83
+
84
+ @function get($name) {
85
+ @return utils.require-map-get($config, $name, "flipcard [config]");
86
+ }
87
+
88
+ @mixin styles {
89
+ $prefix: selector.class("flipcard");
90
+
91
+ #{ $prefix } {
92
+ height: 100%;
93
+ background-color: get("background-color");
94
+ line-height: 1.4;
95
+ overflow: hidden;
96
+ position: relative;
97
+ border: get("border");
98
+ border-radius: get("border-radius");
99
+ &#{ $prefix }:hover {
100
+ border-color: get("border-color-hover");
101
+ }
102
+ #{ $prefix }__control-button:focus {
103
+ border: get("control-button-border-focus");
104
+ }
105
+ }
106
+ #{ $prefix }__front,
107
+ #{ $prefix }__back {
108
+ display: flex;
109
+ flex-direction: column;
110
+ justify-content: flex-end;
111
+ }
112
+
113
+ #{ $prefix }__front {
114
+ // To lay the image out on top of the text
115
+ display: grid;
116
+ grid-template-columns: 1fr;
117
+ justify-items: stretch;
118
+ grid-template-areas: "flipcard-front";
119
+ &:hover {
120
+ #{ $prefix }__front-image {
121
+ transition-duration: 8000ms;
122
+ transition-delay: 0;
123
+ transform: scale(1.15);
124
+ }
125
+ #{ $prefix }__front-content {
126
+ color: get("title-color-hover");
127
+ }
128
+ #{ $prefix }__icon {
129
+ color: get("icon-color-hover");
130
+ }
131
+ }
132
+ @media (prefers-reduced-motion: no-preference) {
133
+ [data-flipcard-state="open"] & {
134
+ opacity: 0;
135
+ animation: get("anim-front-close") get('anim-duration') get("anim-timing-function") forwards;
136
+ }
137
+ [data-flipcard-state="closed"] & {
138
+ animation: get("anim-front-open") get('anim-duration') get("anim-timing-function") forwards;
139
+ }
140
+ }
141
+ }
142
+ #{ $prefix }--w-image {
143
+ background-color: get("background-color-image");
144
+
145
+ &:hover {
146
+ #{ $prefix }__front-content {
147
+ color: get("title-color-image-hover");
148
+ }
149
+ #{ $prefix }__icon {
150
+ color: get("icon-color-image-hover");
151
+ }
152
+ }
153
+ }
154
+ #{ $prefix }__front-image,
155
+ #{ $prefix }__front-content {
156
+ grid-area: flipcard-front / flipcard-front / flipcard-front / flipcard-front;
157
+ }
158
+ #{ $prefix }__front-image {
159
+ display: block;
160
+ @media (prefers-reduced-motion) {
161
+ transition: transform 1000ms 200ms get("anim-timing-function");
162
+ }
163
+ img {
164
+ object-fit: cover;
165
+ width: 100%;
166
+ height: 100%;
167
+ opacity: get("image-opacity");
168
+ }
169
+ }
170
+ #{ $prefix }__icon {
171
+ color: get('icon-color');
172
+ display: block;
173
+ margin-top: 0.5rem;
174
+ }
175
+ #{ $prefix }__front-content {
176
+ height: 100%;
177
+ display: flex;
178
+ flex-direction: column;
179
+ justify-content: flex-end;
180
+ color: get("title-color");
181
+ position: relative;
182
+ z-index: 2;
183
+ padding: get('padding');
184
+ align-self: end;
185
+ transition: transform 350ms get("anim-timing-function");
186
+ }
187
+ #{ $prefix }--w-image {
188
+ #{ $prefix }__icon {
189
+ color: get("icon-color-image");
190
+ }
191
+ #{ $prefix }__front-content {
192
+ color: get("title-color-image");
193
+ @if(get("bottom-shadow")) {
194
+ // bottom position includes padding so that the shadow
195
+ &:after {
196
+ content: '';
197
+ display: block;
198
+ position: absolute;
199
+ bottom: calc(0rem - get('padding'));
200
+ top: 0;
201
+ left: 0;
202
+ right: 0;
203
+ background-image: linear-gradient(rgba(0,0,0,0), rgba(0,0,0,0.5));
204
+ z-index: -1;
205
+ }
206
+ }
207
+ }
208
+ }
209
+ #{ $prefix }__back {
210
+ background-color: get("background-color-back");
211
+ padding: get('padding');
212
+ justify-content: flex-end;
213
+ [data-flipcard-state="open"] & {
214
+ animation: get("anim-back-open") get('anim-duration') get("anim-timing-function") forwards;
215
+ @media (prefers-reduced-motion) {
216
+ animation: UluFadeIn 430ms get("anim-timing-function");
217
+ }
218
+ }
219
+ }
220
+ @keyframes FlipcardBackOpen {
221
+ 0% {
222
+ opacity: 0;
223
+ transform: translateY(100%);
224
+ }
225
+ 30% {
226
+ opacity: 0;
227
+ transform: translateY(100%);
228
+ }
229
+ 100% {
230
+ opacity: 1;
231
+ transform: translateY(0);
232
+ }
233
+ }
234
+ @keyframes FlipcardFrontClose {
235
+ 0% {
236
+ opacity: 1;
237
+ }
238
+ 80% {
239
+ opacity: 0;
240
+ }
241
+ 100% {
242
+ opacity: 0;
243
+ }
244
+ }
245
+ @keyframes FlipcardFrontOpen {
246
+ 0% {
247
+ opacity: 0;
248
+ }
249
+ 30% {
250
+ opacity: 0;
251
+ }
252
+ 100% {
253
+ opacity: 1;
254
+ }
255
+ }
256
+ #{ $prefix }--center-title {
257
+ #{ $prefix }__front-content {
258
+ justify-content: center;
259
+ align-items: center;
260
+ }
261
+ #{ $prefix }__back-content {
262
+ #{ $prefix }__icon-container {
263
+ display: flex;
264
+ justify-content: center;
265
+ width: 100%;
266
+ }
267
+ }
268
+ }
269
+ #{ $prefix }--bottom-title {
270
+ #{ $prefix }__front-content {
271
+ justify-content: flex-end;
272
+ }
273
+ }
274
+ #{ $prefix }:not(#{ $prefix }--bottom-title, #{ $prefix }--center-title) {
275
+ #{ $prefix }__front-content {
276
+ align-items: center;
277
+ justify-content: center;
278
+ position: relative;
279
+ padding-top: calc(get("padding") + 1.2rem);
280
+ padding-bottom: calc(get("padding") + 1.2rem);
281
+ #{ $prefix }__icon-container {
282
+ position: absolute;
283
+ bottom: get("padding");
284
+ right: get("padding");
285
+ }
286
+ }
287
+ #{ $prefix }__back {
288
+ position: relative;
289
+ padding-top: calc(get("padding") + 1.2rem);
290
+ padding-bottom: calc(get("padding") + 1.2rem);
291
+ #{ $prefix }__icon-container {
292
+ position: absolute;
293
+ bottom: get("padding");
294
+ right: get("padding");
295
+ }
296
+ }
297
+ }
298
+ // modifier for animations
299
+ #{ $prefix }--animation:hover {
300
+ #{ $prefix }__front-content {
301
+ transform: translateY(-(get('padding') * 0.5));
302
+ }
303
+ }
304
+ }