@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,633 @@
1
+ ////
2
+ /// @group form-theme
3
+ /// A container for content that highlights important information, provides context, or guides user attention within an interface
4
+ ////
5
+
6
+ @use "sass:map";
7
+ @use "sass:meta";
8
+ @use "sass:math";
9
+ @use "sass:list";
10
+ @use "../selector";
11
+ @use "../utils";
12
+ @use "../color";
13
+ @use "../element";
14
+ @use "../typography";
15
+
16
+ /// Module Settings
17
+ /// @type Map
18
+ /// @prop {} color [inherit]
19
+ /// @prop {} color-placeholder ["type-tertiary"]
20
+ /// @prop {} drupal [false]
21
+ /// @prop {} error-color ["error"]
22
+ /// @prop {} error-highlight-color [rgb(251, 242, 242)]
23
+ /// @prop {} error-selector [".is-danger"]
24
+ /// @prop {} file-button-style [true]
25
+ /// @prop {} font-weight-label [bold]
26
+ /// @prop {} font-weight-legend [bold]
27
+ /// @prop {} font-weight-placeholder [normal]
28
+ /// @prop {} font-weight-input [null]
29
+ /// @prop {} font-weight-textarea [null]
30
+ /// @prop {} font-weight-select [null]
31
+ /// @prop {} input-border [element.get-rule-style()]
32
+ /// @prop {} input-border-radius [0]
33
+ /// @prop {} input-margin-y [0.75em]
34
+ /// @prop {} input-padding-x [0.5em]
35
+ /// @prop {} input-padding-y [0.25em]
36
+ /// @prop {} input-min-width [10em]
37
+ /// @prop {} input-background-color [white]
38
+ /// @prop {} item-border-radius [null]
39
+ /// @prop {} item-highlight-width [6px]
40
+ /// @prop {} required-color ["error"]
41
+ /// @prop {} text-input-margin-bottom [0.5em]
42
+ /// @prop {} text-input-margin-top [1em]
43
+ /// @prop {} warning-color ["warning"]
44
+ /// @prop {} warning-highlight-color [rgb(255, 249, 237)]
45
+ /// @prop {} warning-selector [".is-warning"]
46
+ /// @prop {} check-input-color [currentColor]
47
+ /// @prop {} check-input-size [1.15em]
48
+ /// @prop {} check-input-touch-size [2em]
49
+ /// @prop {} check-input-background-color [white]
50
+ /// @prop {} check-input-background-color-checked [white]
51
+ /// @prop {} check-input-background-color-hover [white]
52
+ /// @prop {} check-input-background-color-indeterminate [white]
53
+ /// @prop {} check-input-border [null]
54
+ /// @prop {} check-input-border-color-hover [null]
55
+ /// @prop {} check-input-border-color-checked [null]
56
+ /// @prop {} check-input-border-color-indeterminate [null]
57
+ /// @prop {} check-input-border-color-focus [null]
58
+ /// @prop {} check-input-outline [null]
59
+ /// @prop {} check-input-outline-hover [null]
60
+ /// @prop {} check-input-outline-checked [null]
61
+ /// @prop {} check-input-outline-focus [1px solid white]
62
+ /// @prop {} check-input-touch-color-hover [#e8e8e8]
63
+ /// @prop {} check-input-touch-color-focus [null]
64
+ /// @prop {} check-input-radio-size [0.3em]
65
+ /// @prop {} check-input-checkmark-width [0.38em]
66
+ /// @prop {} check-input-checkmark-height [0.68em]
67
+ /// @prop {} check-input-checkmark-offset-y [-0.2em]
68
+ /// @prop {} check-input-checkmark-stroke-size [0.18em]
69
+ /// @prop {} check-input-mark-color [currentColor]
70
+ /// @prop {} check-input-mark-color-hover [null]
71
+ /// @prop {} check-input-mark-color-focus [null]
72
+ /// @prop {} check-input-mark-color-checked [null]
73
+ /// @prop {} check-input-mark-color-indeterminate [null]
74
+ /// @prop {} check-input-disabled-opacity [0.6]
75
+ /// @prop {} check-input-border-radius [null]
76
+ /// @prop {} description-color [false]
77
+ /// @prop {} description-margin [(0.25em 0)]
78
+ /// @prop {} description-max-width [25em]
79
+ /// @prop {} fieldset-background [transparent]
80
+ /// @prop {} fieldset-border [none]
81
+ /// @prop {} fieldset-margin-bottom [1rem]
82
+ /// @prop {} fieldset-margin-top [1rem]
83
+ /// @prop {} fieldset-padding [0]
84
+ /// @prop {} fieldset-margin-compact [0]
85
+ /// @prop {} fieldset-border-radius [0]
86
+ /// @prop {} fieldset-legend-color [inherit]
87
+ /// @prop {} fieldset-legend-border-bottom [null]
88
+ /// @prop {} select-border-radius [4px]
89
+ /// @prop {} select-background-color [null]
90
+ /// @prop {} select-border [null]
91
+ /// @prop {} select-padding-x [null]
92
+ /// @prop {} select-padding-y [null]
93
+ /// @prop {} select-image [null]
94
+ /// @prop {} select-image-size [0.9em]
95
+ /// @prop {} select-image-offset [0.7em]
96
+ /// @prop {} select-image-margin [0.65em]
97
+
98
+ $config: (
99
+ "color" : inherit,
100
+ "color-placeholder" : "type-tertiary",
101
+ "drupal" : false,
102
+ "error-color" : "error",
103
+ "error-highlight-color" : rgb(251, 242, 242),
104
+ "error-selector" : ".is-danger",
105
+ "file-button-style" : true,
106
+ "font-weight-label" : bold,
107
+ "font-weight-legend" : bold,
108
+ "font-weight-placeholder" : normal,
109
+ "font-weight-input" : null,
110
+ "font-weight-textarea" : null,
111
+ "font-weight-select" : null,
112
+ "input-border" : element.get-rule-style(),
113
+ "input-border-radius" : 0,
114
+ "input-margin-y" : 0.75em,
115
+ "input-padding-x" : 0.5em,
116
+ "input-padding-y" : 0.25em,
117
+ "input-min-width" : 10em,
118
+ "input-background-color" : white,
119
+ "item-border-radius" : null,
120
+ "item-highlight-width" : 6px,
121
+ "required-color" : "error",
122
+ "text-input-margin-bottom" : 0.5em,
123
+ "text-input-margin-top" : 1em,
124
+ "warning-color" : "warning",
125
+ "warning-highlight-color" : rgb(255, 249, 237),
126
+ "warning-selector" : ".is-warning",
127
+ "check-input-color" : currentColor,
128
+ "check-input-size" : 1.15em,
129
+ "check-input-touch-size" : 2em,
130
+ "check-input-background-color" : white,
131
+ "check-input-background-color-checked" : white,
132
+ "check-input-background-color-hover" : white,
133
+ "check-input-background-color-indeterminate": white,
134
+ "check-input-border" : null,
135
+ "check-input-border-color-hover" : null,
136
+ "check-input-border-color-checked" : null,
137
+ "check-input-border-color-indeterminate" : null,
138
+ "check-input-border-color-focus" : null,
139
+ "check-input-outline" : null,
140
+ "check-input-outline-hover" : null,
141
+ "check-input-outline-checked" : null,
142
+ "check-input-outline-focus" : 1px solid white,
143
+ "check-input-touch-color-hover" : #e8e8e8,
144
+ "check-input-touch-color-focus" : null,
145
+ "check-input-radio-size" : 0.3em,
146
+ "check-input-checkmark-width" : 0.38em,
147
+ "check-input-checkmark-height" : 0.68em,
148
+ "check-input-checkmark-offset-y" : -0.2em,
149
+ "check-input-checkmark-stroke-size" : 0.18em,
150
+ "check-input-mark-color" : currentColor,
151
+ "check-input-mark-color-hover" : null,
152
+ "check-input-mark-color-focus" : null,
153
+ "check-input-mark-color-checked" : null,
154
+ "check-input-mark-color-indeterminate" : null,
155
+ "check-input-disabled-opacity" : 0.6,
156
+ "check-input-border-radius" : null,
157
+ "description-color" : false,
158
+ "description-margin" : (0.25em 0),
159
+ "description-max-width" : 25em,
160
+ "fieldset-background" : transparent,
161
+ "fieldset-border" : none,
162
+ "fieldset-margin-bottom" : 1rem,
163
+ "fieldset-margin-top" : 1rem,
164
+ "fieldset-padding" : 0,
165
+ "fieldset-margin-compact" : 0,
166
+ "fieldset-border-radius" : 0,
167
+ "fieldset-legend-color" : inherit,
168
+ "fieldset-legend-border-bottom" : null,
169
+ "select-border-radius" : 4px,
170
+ "select-background-color" : null,
171
+ "select-border" : null,
172
+ "select-padding-x" : null,
173
+ "select-padding-y" : null,
174
+ "select-image" : null,
175
+ "select-image-size" : 0.9em,
176
+ "select-image-offset" : 0.7em,
177
+ "select-image-margin" : 0.65em,
178
+ ) !default;
179
+
180
+ /// Change modules $config
181
+ /// @param {Map} $changes Map of changes
182
+ /// @example
183
+ /// @include ulu.component-form-theme-set(( "property" : value ));
184
+
185
+ @mixin set($changes) {
186
+ $config: map.merge($config, $changes) !global;
187
+ }
188
+
189
+ /// Get a config option
190
+ /// @param {Map} $name Name of property
191
+ /// @example
192
+ /// @include ulu.component-form-theme-get("property");
193
+
194
+ @function get($name) {
195
+ @return utils.require-map-get($config, $name, "component-form-theme [config]");
196
+ }
197
+
198
+ @function -fallback($op1, $op2) {
199
+ @return utils.map-fallback($config, $op1, $op2);
200
+ }
201
+
202
+ /// Output component stylesheet
203
+ /// @example scss
204
+ /// @include ulu.component-form-theme-styles();
205
+
206
+ @mixin styles() {
207
+ $prefix: selector.class("form-theme");
208
+
209
+ // Shared element styles
210
+ #{ $prefix } {
211
+ @include form-element-styles();
212
+ }
213
+
214
+ // Print styles differently for standard vs Drupal
215
+ // - Has different elements (ie. .form-item)
216
+ @if (get("drupal")) {
217
+ @include drupal-layout-element-styles();
218
+ } @else {
219
+ @include layout-element-styles();
220
+ }
221
+
222
+ // Modifiers
223
+ #{ $prefix }--full-width {
224
+ [type="text"],
225
+ [type="email"],
226
+ [type="password"] {
227
+ width: 100%;
228
+ }
229
+ textarea {
230
+ width: 100%;
231
+ }
232
+ }
233
+ #{ $prefix }--full-width-select {
234
+ select {
235
+ width: 100%;
236
+ }
237
+ }
238
+ #{ $prefix }--hide-labels {
239
+ label {
240
+ @include element.hidden-visually();
241
+ }
242
+ }
243
+ }
244
+
245
+ @mixin form-element-styles() {
246
+ $errorColor: color.get(get("error-color"));
247
+ $selectError: get("error-selector");
248
+ $warningColor: color.get(get("warning-color"));
249
+ $selectWarning: get("warning-selector");
250
+ $input-touch-size: get("check-input-touch-size");
251
+ $input-size: get("check-input-size");
252
+ $input-touch-margin: math.div($input-touch-size - $input-size, 2);
253
+ $input-touch-margin-neg: -($input-touch-margin);
254
+ $file-button-style: get("file-button-style");
255
+
256
+ input:not([type="submit"]),
257
+ select,
258
+ textarea,
259
+ label,
260
+ legend {
261
+ color: get("color");
262
+ font-size: 1em;
263
+ max-width: 100%;
264
+ line-height: typography.get("line-height-dense");
265
+ box-sizing: border-box;
266
+ flex-shrink: 0;
267
+ &::placeholder {
268
+ color: color.get(get("color-placeholder"));
269
+ font-weight: get("font-weight-placeholder");
270
+ }
271
+ }
272
+ input:not([type="submit"]) {
273
+ font-weight: get("font-weight-input");
274
+ }
275
+ textarea {
276
+ font-weight: get("font-weight-textarea");
277
+ }
278
+ select,
279
+ textarea,
280
+ [type="text"],
281
+ [type="tel"],
282
+ [type="time"],
283
+ [type="url"],
284
+ [type="date"],
285
+ [type="email"],
286
+ [type="month"],
287
+ [type="week"],
288
+ [type="number"],
289
+ [type="search"],
290
+ [type="datetime-local"],
291
+ [type="password"],
292
+ [type="file"] {
293
+ padding: get("input-padding-y") get("input-padding-x");
294
+ background-color: get("input-background-color");
295
+ border-radius: get("input-border-radius");
296
+ transition: border linear 0.2s;
297
+ border: get("input-border");
298
+ min-width: get("input-min-width");
299
+ margin: 0;
300
+ // &:focus {
301
+ // outline: none;
302
+ // border: 1px solid color-get("focus");
303
+ // box-shadow: element-get("box-shadow");
304
+ // }
305
+ }
306
+ select {
307
+ font-weight: get("font-weight-select");
308
+ border: get("select-border");
309
+ border-radius: get("select-border-radius");
310
+ background-color: get("select-background-color");
311
+ padding: -fallback("select-padding-y", "input-padding-y") -fallback("select-padding-x", "input-padding-x");
312
+ border: -fallback("select-border", "input-border");
313
+ @if get("select-image") {
314
+ // Hide default arrow and extend padding so text doesn't overlap the icon
315
+ appearance: none;
316
+ background-image: url(get("select-image"));
317
+ background-repeat: no-repeat;
318
+ background-position: center right get("select-image-offset");
319
+ background-size: get("select-image-size");
320
+ padding-right: get("select-image-offset") + get("select-image-size") + get("select-image-margin");
321
+ }
322
+ }
323
+ // Replace Native Inputs with CSS styled one
324
+ [type="checkbox"],
325
+ [type="radio"] {
326
+ appearance: none;
327
+ margin: 0;
328
+ display: inline-block;
329
+ width: $input-touch-size; // Touchable surface
330
+ height: $input-touch-size;
331
+ margin: $input-touch-margin-neg 0 $input-touch-margin-neg $input-touch-margin-neg; // Optical alignment
332
+ padding: 0.5em;
333
+ background-color: transparent;
334
+ border-radius: 50%;
335
+ display: inline-flex;
336
+ align-items: center;
337
+ justify-content: center;
338
+ position: relative;
339
+ transition: background-color 220ms ease-in-out;
340
+ flex: 0 0 $input-touch-size; // When used in flex container
341
+ // Box / Circle (centered absolute)
342
+ &:before {
343
+ content: '';
344
+ display: block;
345
+ position: absolute;
346
+ width: $input-size;
347
+ height: $input-size;
348
+ outline: get("check-input-outline");
349
+ border: -fallback("check-input-border", "input-border");
350
+ border-radius: 50%;
351
+ transition-timing-function: ease-out;
352
+ transition-duration: 150ms;
353
+ transition-property: background-color, border-color;
354
+ background-color: -fallback("check-input-background-color", "input-background-color");
355
+ top: 50%;
356
+ left: 50%;
357
+ transform: translate(-50%, -50%);
358
+ }
359
+ // Checkmark/ radio
360
+ &:after {
361
+ content: '';
362
+ display: block;
363
+ position: relative;
364
+ z-index: 2;
365
+ opacity: 0;
366
+ transform: rotate(45deg);
367
+ transition: opacity ease-out 150ms;
368
+ border: get("check-input-radio-size") solid get("check-input-mark-color");
369
+ border-radius: 50%;
370
+ }
371
+ &:focus {
372
+ background-color: get("check-input-touch-color-focus");
373
+ &:before {
374
+ border-color: get("check-input-border-color-focus");
375
+ outline: get("check-input-outline-focus");
376
+ }
377
+ &:after {
378
+ border-color: get("check-input-mark-color-focus");
379
+ }
380
+ }
381
+ &:hover {
382
+ background-color: get("check-input-touch-color-hover");
383
+ &:before {
384
+ outline: get("check-input-outline-hover");
385
+ background-color: get("check-input-background-color-hover");
386
+ border-color: get("check-input-border-color-hover");
387
+ }
388
+ &:after {
389
+ border-color: get("check-input-mark-color-hover");
390
+ }
391
+ }
392
+ &:checked {
393
+ &:before {
394
+ background-color: get("check-input-background-color-checked");
395
+ border-color: get("check-input-border-color-checked");
396
+ outline: get("check-input-outline-checked");
397
+ }
398
+ &:after {
399
+ opacity: 1;
400
+ border-color: get("check-input-mark-color-checked");
401
+ }
402
+ }
403
+
404
+ &:disabled,
405
+ &[aria-disabled="true"],
406
+ &[disabled] {
407
+ &,
408
+ & + label {
409
+ opacity: get("check-input-disabled-opacity");
410
+ }
411
+ }
412
+ }
413
+ [type="checkbox"] {
414
+ &:before {
415
+ border-radius: -fallback("check-input-border-radius", "input-border-radius");
416
+ }
417
+ &:after {
418
+ border-radius: 0;
419
+ width: get("check-input-checkmark-width");
420
+ height: get("check-input-checkmark-height");
421
+ transform: rotate(45deg);
422
+ margin-top: get("check-input-checkmark-offset-y");
423
+ border-top: none;
424
+ border-left: none;
425
+ border-bottom-width: get("check-input-checkmark-stroke-size");
426
+ border-right-width: get("check-input-checkmark-stroke-size");
427
+ }
428
+ &:indeterminate,
429
+ &[aria-checked=mixed] {
430
+ &:before {
431
+ background-color: get("check-input-background-color-indeterminate");
432
+ border-color: get("check-input-border-color-indeterminate");
433
+ }
434
+ &:after {
435
+ border-right: none;
436
+ transform: translatey(50%);
437
+ opacity: 1;
438
+ height: get("check-input-checkmark-stroke-size");
439
+ border-color: get("check-input-mark-color-indeterminate");
440
+ }
441
+ }
442
+ }
443
+
444
+ fieldset {
445
+ display: block;
446
+ width: 0;
447
+ min-width: 100%;
448
+ box-sizing: border-box;
449
+ margin-top: get("fieldset-margin-top");
450
+ margin-bottom: get("fieldset-margin-bottom");
451
+ border: get("fieldset-border");
452
+ background-color: get("fieldset-background");
453
+ border-radius: get("fieldset-border-radius");
454
+ padding: get("fieldset-padding");
455
+
456
+ > legend {
457
+ font-weight: get("font-weight-legend");
458
+ display: block;
459
+ margin: 0 0 0.5em 0;
460
+ border: 0;
461
+ padding: 0;
462
+ width: 100%;
463
+ float: left;
464
+ > span {
465
+ display: block;
466
+ margin-bottom: 1rem;
467
+ padding-bottom: 0.5em;
468
+ padding-top: 0.5em;
469
+ border-bottom: get("fieldset-legend-border-bottom");
470
+ color: get("fieldset-legend-color");
471
+ }
472
+ & ~ * {
473
+ clear: left;
474
+ }
475
+ }
476
+ &#{ $selectError } {
477
+ > legend {
478
+ color: $errorColor;
479
+ }
480
+ }
481
+ &#{ $selectWarning } {
482
+ > legend {
483
+ color: $warningColor;
484
+ }
485
+ }
486
+ }
487
+ }
488
+
489
+ /// Required Character styles (ie. "*")
490
+ @mixin element-required-char() {
491
+ color: color.get(get("required-color"));
492
+ font-size: 110%;
493
+ font-weight: bold;
494
+ &:last-child {
495
+ margin-left: 0.15em;
496
+ }
497
+ }
498
+
499
+ /// Help text / Description
500
+ @mixin element-help-text() {
501
+ margin: get("description-margin");
502
+ font-style: italic;
503
+ @include typography.size("small", null, true);
504
+ max-width: get("description-max-width");
505
+ color: get("description-color");
506
+ }
507
+
508
+ /// Styles for form item that should have label as block and text input
509
+ @mixin element-form-item-block() {
510
+ display: block;
511
+ label {
512
+ font-weight: get("font-weight-label");
513
+ display: block;
514
+ margin-bottom: get("text-input-margin-bottom");
515
+ margin-top: get("text-input-margin-top");
516
+ }
517
+ input {
518
+ border-radius: get("input-border-radius");
519
+ }
520
+ }
521
+
522
+ /// Footer of form (with button for example)
523
+ @mixin element-form-actions() {
524
+ display: flex;
525
+ margin: 1rem 0;
526
+ }
527
+
528
+ /// Footer of form (with button for example)
529
+ @mixin element-form-actions-right() {
530
+ justify-content: flex-end;
531
+ }
532
+
533
+ /// Layout styling for static/app sites
534
+ @mixin layout-element-styles() {
535
+ $prefix: selector.class("form-theme");
536
+ $errorColor: color.get(get("error-color"));
537
+ $selectError: get("error-selector");
538
+ $warningColor: color.get(get("warning-color"));
539
+ $selectWarning: get("warning-selector");
540
+
541
+ #{ $prefix }__required-char {
542
+ @include element-required-char();
543
+ }
544
+ #{ $prefix }__description {
545
+ @include element-help-text();
546
+ }
547
+ #{ $prefix }__item {
548
+ display: flex;
549
+ align-items: center;
550
+ margin-bottom: get("input-margin-y");
551
+ border-radius: get("item-border-radius");
552
+ flex-shrink: 0; // Cannot be smaller than content within
553
+ @include -form-item-state($selectError, $errorColor, get("error-highlight-color"));
554
+ @include -form-item-state($selectWarning, $warningColor, get("warning-highlight-color"));
555
+ }
556
+ #{ $prefix }__item--align-top {
557
+ align-items: flex-start;
558
+ }
559
+ #{ $prefix }__item--text,
560
+ #{ $prefix }__item--file,
561
+ #{ $prefix }__item--select,
562
+ #{ $prefix }__item--textarea {
563
+ @include element-form-item-block();
564
+ }
565
+ #{ $prefix }__items-inline {
566
+ display: flex;
567
+ flex-wrap: wrap;
568
+ > #{ $prefix }__item {
569
+ margin-right: 1.5em;
570
+ }
571
+ }
572
+ #{ $prefix }__actions {
573
+ @include element-form-actions();
574
+ }
575
+ #{ $prefix }--actions-right {
576
+ #{ $prefix }__actions {
577
+ @include element-form-actions-right();
578
+ }
579
+ }
580
+ #{ $prefix }__error {
581
+ color: $errorColor;
582
+ }
583
+ #{ $prefix }__warning {
584
+ color: $warningColor;
585
+ }
586
+ }
587
+
588
+ /// Layout styles but using drupal form structures
589
+ @mixin drupal-layout-element-styles() {
590
+ $prefix: selector.class("form-theme");
591
+ #{ $prefix } {
592
+ .form-required-character {
593
+ @include element-required-char();
594
+ }
595
+ .description {
596
+ @include element-help-text();
597
+ }
598
+ .form-item:not(fieldset) {
599
+ margin-bottom: 1rem;
600
+ }
601
+ [class*="form-type-textarea"],
602
+ [class*="form-type-password"],
603
+ [class*="form-type-email"],
604
+ [class*="form-type-tel"],
605
+ [class*="form-type-number"],
606
+ [class*="form-type-select"],
607
+ [class*="form-type-textfield"] {
608
+ @include element-form-item-block();
609
+ }
610
+ .form-actions {
611
+ @include element-form-actions();
612
+ }
613
+ }
614
+ #{ $prefix }--actions-right .form-actions {
615
+ @include element-form-actions-right();
616
+ }
617
+ }
618
+
619
+ @mixin -form-item-state($selector, $color, $highlightColor) {
620
+ &#{ $selector } {
621
+ background-color: $highlightColor;
622
+ // outline: get("item-outline-width") solid $highlightColor;
623
+ box-shadow: 0 0 0 get("item-highlight-width") $highlightColor;
624
+ label {
625
+ color: $color;
626
+ }
627
+ select,
628
+ textarea,
629
+ input:not([type="checkbox"]):not([type="radio"]) {
630
+ border-color: $color;
631
+ }
632
+ }
633
+ }