@ulu/frontend 0.1.0-beta.109 → 0.1.0-beta.110

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 (52) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/ulu-frontend.min.css +1 -1
  3. package/docs-dev/changelog/index.html +7 -0
  4. package/docs-dev/demos/accordion/index.html +4 -18
  5. package/docs-dev/demos/card/index.html +16 -16
  6. package/docs-dev/demos/data-table/index.html +100 -100
  7. package/docs-dev/demos/progress-circle/index.html +44 -44
  8. package/docs-dev/javascript/events/index.html +477 -1407
  9. package/docs-dev/javascript/settings/index.html +4 -380
  10. package/docs-dev/javascript/ui-breakpoints/index.html +0 -540
  11. package/docs-dev/javascript/ui-collapsible/index.html +472 -1252
  12. package/docs-dev/javascript/ui-details-group/index.html +0 -540
  13. package/docs-dev/javascript/ui-dialog/index.html +472 -1252
  14. package/docs-dev/javascript/ui-flipcard/index.html +331 -2703
  15. package/docs-dev/javascript/ui-grid/index.html +342 -2534
  16. package/docs-dev/javascript/ui-modal-builder/index.html +327 -2489
  17. package/docs-dev/javascript/ui-overflow-scroller/index.html +342 -2534
  18. package/docs-dev/javascript/ui-overflow-scroller-pager/index.html +4 -380
  19. package/docs-dev/javascript/ui-page/index.html +4 -380
  20. package/docs-dev/javascript/ui-popover/index.html +4 -380
  21. package/docs-dev/javascript/ui-print/index.html +4 -380
  22. package/docs-dev/javascript/ui-print-details/index.html +4 -380
  23. package/docs-dev/javascript/ui-programmatic-modal/index.html +4 -380
  24. package/docs-dev/javascript/ui-proxy-click/index.html +4 -380
  25. package/docs-dev/javascript/ui-resizer/index.html +4 -380
  26. package/docs-dev/javascript/ui-scroll-slider/index.html +4 -380
  27. package/docs-dev/javascript/ui-scrollpoint/index.html +4 -380
  28. package/docs-dev/javascript/ui-slider/index.html +4 -380
  29. package/docs-dev/javascript/ui-tabs/index.html +4 -380
  30. package/docs-dev/javascript/ui-theme-toggle/index.html +4 -380
  31. package/docs-dev/javascript/ui-tooltip/index.html +4 -380
  32. package/docs-dev/javascript/utils-class-logger/index.html +4 -380
  33. package/docs-dev/javascript/utils-css/index.html +4 -380
  34. package/docs-dev/javascript/utils-dom/index.html +4 -380
  35. package/docs-dev/javascript/utils-file-save/index.html +4 -380
  36. package/docs-dev/javascript/utils-floating-ui/index.html +4 -380
  37. package/docs-dev/javascript/utils-id/index.html +4 -380
  38. package/docs-dev/javascript/utils-pause-youtube-video/index.html +4 -380
  39. package/docs-dev/javascript/utils-system/index.html +4 -380
  40. package/docs-dev/sass/base/elements/index.html +4 -380
  41. package/docs-dev/sass/base/normalize/index.html +4 -380
  42. package/docs-dev/sass/components/accordion/index.html +97 -63
  43. package/docs-dev/sass/core/typography/index.html +78 -27
  44. package/docs-dev/sass/helpers/color/index.html +4 -380
  45. package/docs-dev/sass/helpers/display/index.html +4 -380
  46. package/docs-dev/sass/helpers/index/index.html +4 -380
  47. package/docs-dev/sass/helpers/typography/index.html +4 -380
  48. package/docs-dev/sass/helpers/units/index.html +4 -380
  49. package/docs-dev/sass/helpers/utilities/index.html +4 -380
  50. package/package.json +1 -1
  51. package/scss/_typography.scss +13 -0
  52. package/scss/components/_accordion.scss +144 -113
@@ -3,75 +3,93 @@
3
3
  /// Outputs accordion component stylesheet, which can be used with <details> or custom disclosure components
4
4
  ////
5
5
 
6
- // Internal note: We don't require the content to be wrapped, this is so that this can be used on details elements outside of our control. So we use negative margins
7
-
8
6
  @use "sass:map";
7
+ @use "sass:meta";
9
8
  @use "sass:math";
10
9
 
11
10
  @use "../selector";
12
11
  @use "../utils";
13
12
  @use "../color";
14
13
  @use "../typography";
14
+ @use "../element";
15
+
16
+
17
+ // Used for function fallback
18
+ $-fallbacks: (
19
+ "border-radius" : (
20
+ "function" : meta.get-function("get", false, "element"),
21
+ "property" : "border-radius"
22
+ ),
23
+ );
15
24
 
16
25
  /// Module Settings
17
26
  /// @type Map
18
- /// @prop {Color} background-color [accordion-background] This is the background color of the accordion before it is expanded.
19
- /// @prop {Color} background-color-open [accordion-background-open] This is the background color of the accordion before it is expanded. This will change the background color of the accordion's summary as well as the details.
20
- /// @prop {String} border-color ["rule"]
21
- /// @prop {Number} border-radius [0] This applies a rounding of edges for the accordion. If there are multiple accordions in a stack, this will only apply to the top of the first accordion and the bottom of the last accordion.
22
- /// @prop {Dimension} border-width [1px] The width of the borders of the accordions
23
- /// @prop {CssValue} box-shadow [none] Adds a box shadow to accordion container
24
- /// @prop {Dimension} margin [3rem] text This is the margin above and below the accordion. Multiple Accordions will stack. See margin-between below.
27
+ /// @prop {Color} background-color [background] This is the background color of the accordion before it is expanded.
28
+ /// @prop {Color} background-color-open [white] This is the background color of the accordion when it is expanded. This will change the background color of the accordion's summary as well as the details.
29
+ /// @prop {String} border-color ["rule-light"] The color of the accordion border.
30
+ /// @prop {Boolean|Number} border-radius [true] This applies a rounding of edges for the accordion. If there are multiple accordions in a stack, this will only apply to the top of the first accordion and the bottom of the last accordion.
31
+ /// @prop {Dimension} border-width [1px] The width of the borders of the accordions.
32
+ /// @prop {CssValue} box-shadow [none] Adds a box shadow to accordion container.
33
+ /// @prop {Dimension} margin [(1.5em 0)] This is the margin above and below the accordion. Multiple Accordions will stack. See margin-between below.
25
34
  /// @prop {Dimension} margin-between [0] This adds a margin between adjacent accordions. By default, accordions do not have any net margin between each other.
26
- /// @prop {Dimension} padding-x [1.5em] Singular value for the left and right padding
27
- /// @prop {Dimension} padding-y [1.5em] Singular value for the top and bottom padding
35
+ /// @prop {Dimension} padding-x [1.5em] Singular value for the left and right padding.
36
+ /// @prop {Dimension} padding-y [1.5em] Singular value for the top and bottom padding.
28
37
  /// @prop {Color} icon-background-color [transparent] The background color of the icon.
29
38
  /// @prop {Color} icon-background-color-hover [transparent] The background color of the icon when hovered or focused.
30
39
  /// @prop {Number} icon-border-radius [50%] The border-radius of the icon.
31
40
  /// @prop {String} icon-color [link] Color of the icon. This uses color.scss, so the value of this option should be a color variable from color.scss.
32
41
  /// @prop {String} icon-color-hover [link-hover] Color of the icon when hovered or focused on. This uses color.scss, so the value of this options should be a color variable from color.scss.
33
- /// @prop {Dimension} icon-font-size [1.5rem] The font-size of the icon.
42
+ /// @prop {Dimension} icon-font-size [1em] The font-size of the icon.
43
+ /// @prop {Dimension} icon-margin [1em] The margin to the left of the icon.
34
44
  /// @prop {Dimension} icon-size [auto] The size of the icon. Used as the base in the flex property.
35
- /// @prop {Dimension} icon-stroke-width [0.15em]
36
- /// @prop {Color} summary-background-color [null] The background color for the summary (toggle button) of the accordion
45
+ /// @prop {Dimension} icon-stroke-width [0.15em] The stroke width of the icon.
46
+ /// @prop {Color} summary-background-color [#f6f6f6] The background color for the summary (toggle button) of the accordion.
47
+ /// @prop {Color} summary-background-color-hover [null] The background color for the summary (toggle button) of the accordion when hovered.
37
48
  /// @prop {Color} summary-color [null] The color of the text in the accordion summary.
38
49
  /// @prop {Color} summary-color-hover [null] The color of the text in the accordion summary when hovering or focusing on it.
39
50
  /// @prop {Dimension} summary-line-height [null] Adjusts the line height of the summary element.
40
- /// @prop {Dimension} summary-padding-y [1rem] The vertical padding of the summary.
41
- /// @prop {Dimension} summary-type-size [false] The size of the text in the accordion summary.
42
- /// @prop {Dimension} transparent-padding-y [1em] The upper and lower padding of the transparent summary.
43
- /// @prop {Dimension} transparent-padding-x [0] The upper and lower padding of the transparent summary.
44
- /// @prop {Dimension} borderless-margin-between [0.5rem] Margin between accordions when using no-border modiifier
51
+ /// @prop {Dimension} summary-padding-y [1em] The vertical padding of the summary.
52
+ /// @prop {String|Boolean} summary-type-size ["large"] The typography size of the text in the accordion summary. Can be a boolean to disable.
53
+ /// @prop {Boolean} summary-border-enabled [true] Whether the summary has a border when the accordion is open.
54
+ /// @prop {Color} summary-border-color [rule-light] The color of the summary border.
55
+ /// @prop {Dimension} summary-border-width [1px] The width of the summary border.
56
+ /// @prop {Dimension} transparent-content-padding [(0.25em 0)] The padding of the content area for transparent accordions.
57
+ /// @prop {Dimension} borderless-margin-between [0.5em] Margin between accordions when using no-border modifier.
58
+ /// @prop {String} active-selector ['.is-active'] The selector used for the active state of a non-<details> accordion.
45
59
 
46
60
  $config: (
47
- "background-color": "background",
48
- "background-color-open": white,
49
- "border-color": "rule-light",
50
- "border-radius": 0,
51
- "border-width": 1px,
52
- "box-shadow": none,
53
- "margin": 3rem,
54
- "margin-between": 0,
55
- "padding-x": 1.5em,
56
- "padding-y": 1.5em,
57
- "icon-background-color": transparent,
58
- "icon-background-color-hover": transparent,
59
- "icon-border-radius": 50%,
60
- "icon-color": "link",
61
- "icon-color-hover": "link-hover",
62
- "icon-font-size": 1.5rem,
63
- "icon-size": auto,
64
- "icon-stroke-width": 0.15em,
65
- "summary-background-color": #f6f6f6,
66
- "summary-color": null,
61
+ "background-color": "background",
62
+ "background-color-open": white,
63
+ "border-color": "rule-light",
64
+ "border-radius": true,
65
+ "border-width": 1px,
66
+ "box-shadow": none,
67
+ "margin": (1.5em 0),
68
+ "margin-between": 0,
69
+ "padding-x": 1.25em,
70
+ "padding-y": 1.25em,
71
+ "icon-background-color": transparent,
72
+ "icon-background-color-hover": transparent,
73
+ "icon-border-radius": 50%,
74
+ "icon-color": "link",
75
+ "icon-color-hover": "link-hover",
76
+ "icon-font-size": 1em,
77
+ "icon-margin": 1em,
78
+ "icon-size": auto,
79
+ "icon-stroke-width": 0.15em,
80
+ "summary-background-color": #f6f6f6,
81
+ "summary-color": null,
67
82
  "summary-background-color-hover": null,
68
- "summary-color-hover": null,
69
- "summary-line-height": null,
70
- "summary-padding-y": 1rem,
71
- "summary-type-size": false,
72
- "transparent-padding-x": 0,
73
- "transparent-padding-y": 1em,
74
- "borderless-margin-between" : 0.5rem
83
+ "summary-color-hover": null,
84
+ "summary-line-height": null,
85
+ "summary-padding-y": 1em,
86
+ "summary-type-size": false,
87
+ "summary-border-enabled": true,
88
+ "summary-border-color": "rule-light",
89
+ "summary-border-width": 1px,
90
+ "transparent-content-padding": (0.25em 0),
91
+ "borderless-margin-between": 0.5em,
92
+ "active-selector": ".is-active"
75
93
  ) !default;
76
94
 
77
95
  /// Change modules $config
@@ -89,7 +107,8 @@ $config: (
89
107
  /// @include ulu.component-accordion-get("property");
90
108
 
91
109
  @function get($name) {
92
- @return utils.require-map-get($config, $name, "accordion [config]");
110
+ $value: utils.require-map-get($config, $name, "accordion [config]");
111
+ @return utils.function-fallback($name, $value, $-fallbacks);
93
112
  }
94
113
 
95
114
  /// Prints component styles
@@ -99,74 +118,76 @@ $config: (
99
118
 
100
119
  @mixin styles {
101
120
  $prefix: selector.class("accordion");
121
+ $active-selector: get("active-selector");
102
122
  $padding-x: get("padding-x");
103
- $padding-x-double: get("padding-x") * 2;
104
123
  $border: get("border-width") solid color.get(get("border-color"));
105
124
 
106
125
  // When not one of our custom classed details components
107
126
  #{ $prefix } {
108
- position: relative; // For active border
109
- border-radius: 0;
110
- padding-left: $padding-x;
111
- padding-right: $padding-x;
112
- margin-top: get("margin");
113
- margin-bottom: get("margin");
127
+ padding: 0;
128
+ margin: get("margin");
114
129
  border: $border;
115
130
  background-color: color.get(get("background-color"));
116
131
  box-shadow: get("box-shadow");
117
- &:first-of-type {
118
- border-top-left-radius: get("border-radius");
119
- border-top-right-radius: get("border-radius");
120
- }
121
- &:last-of-type {
122
- border-bottom-left-radius: get("border-radius");
123
- border-bottom-right-radius: get("border-radius");
124
- }
132
+ border-radius: get("border-radius");
133
+
134
+ // Sibling before sets the gap
125
135
  & + #{ $prefix } {
126
- $gap: -(get("margin") - get("margin-between"));
127
- margin-top: $gap;
128
- margin-top: calc($gap - get("border-width"));
136
+ margin-top: 0;
137
+ }
138
+
139
+ // If no space get rid of border radiuses
140
+ @if (get("margin-between") == 0) {
141
+ &:has(+ #{ $prefix }) {
142
+ border-bottom-left-radius: 0;
143
+ border-bottom-right-radius: 0;
144
+ margin-bottom: 0;
145
+ }
146
+ & + #{ $prefix } {
147
+ border-top-left-radius: 0;
148
+ border-top-right-radius: 0;
149
+ margin-top: -(get("border-width")); // Pull border over top
150
+ }
151
+ } @else {
152
+ &:has(+ #{ $prefix }) {
153
+ margin-bottom: get("margin-between");
154
+ }
129
155
  }
156
+
130
157
  &[open],
131
- &.is-active {
158
+ &#{ $active-selector } {
132
159
  background-color: color.get(get("background-color-open"));
133
- padding-bottom: get("padding-y");
134
- z-index: 2; // Above child details
160
+ z-index: 2; // Above other details/accordions
135
161
  > #{ $prefix }__summary {
136
- margin-bottom: get("padding-y");
137
162
  border-bottom-left-radius: 0;
138
163
  border-bottom-right-radius: 0;
139
- border-bottom: $border;
164
+ @if (get("summary-border-enabled")) {
165
+ border-bottom: get("summary-border-width") solid color.get(get("summary-border-color"));
166
+ }
140
167
  }
141
168
  }
142
169
  }
143
170
  #{ $prefix }__summary {
171
+ display: flex;
172
+ list-style: none; // Remove the default arrow (old safari?)
144
173
  background-color: color.get(get("summary-background-color"));
145
174
  color: color.get(get("summary-color"));
146
- margin-left: -($padding-x);
147
- margin-right: -($padding-x);
148
175
  line-height: get("summary-line-height");
149
176
  padding: get("summary-padding-y") $padding-x;
150
- vertical-align: top;
177
+ border-radius: get("border-radius");
151
178
  font-weight: bold;
152
179
  cursor: pointer;
153
180
  align-items: center;
154
- width: calc(100% + $padding-x-double); // To fix if using <button>
155
-
156
- &:has(#{ $prefix }__icon) {
157
- display: flex;
158
- list-style: none; // Remove the default arrow (old safari?)
159
- &::-webkit-details-marker,
160
- &::marker {
161
- display: none;
162
- content: "";
163
- }
164
- }
165
-
166
- @if (get("summary-type-size")) {
167
- @include typography.size(get("summary-type-size"));
181
+
182
+ @include typography.optional-size(get("summary-type-size"), $only-font-size: true);
183
+
184
+ &::-webkit-details-marker,
185
+ &::marker {
186
+ display: none;
187
+ content: "";
168
188
  }
169
- &:hover {
189
+ &:hover,
190
+ &:focus {
170
191
  background-color: color.get(get("summary-background-color-hover"));
171
192
  color: color.get(get("summary-color-hover"));
172
193
  #{ $prefix }__icon {
@@ -176,54 +197,64 @@ $config: (
176
197
  }
177
198
  }
178
199
  #{ $prefix }__icon {
200
+ display: flex;
201
+ align-items: center;
202
+ justify-content: center;
179
203
  flex: 0 0 get("icon-size");
180
204
  color: color.get(get("icon-color"));
181
205
  margin-left: auto;
182
- padding-left: 0.5em;
206
+ padding-left: get("icon-margin");
183
207
  background-color: color.get(get("icon-background-color"));
184
208
  border-radius: get("icon-border-radius");
185
209
  width: get("icon-size");
186
210
  height: get("icon-size");
187
211
  font-size: get("icon-font-size");
188
212
  line-height: 1;
189
- display: flex;
190
- align-items: center;
191
- justify-content: center;
192
- text-align: center;
213
+ }
214
+ #{ $prefix }__content {
215
+ padding: get("padding-y") $padding-x;
216
+ border-bottom-left-radius: get("border-radius");
217
+ border-bottom-right-radius: get("border-radius");
193
218
  }
194
219
  #{ $prefix }--transparent {
195
220
  border-left: none;
196
221
  border-right: none;
197
222
  background-color: transparent;
198
- padding-left: get("transparent-padding-x");
199
- padding-right: get("transparent-padding-x");
200
- > #{ $prefix }__summary {
201
- margin-left: -(get("transparent-padding-x"));
202
- margin-right: -(get("transparent-padding-x"));
203
- width: 100%;
204
- padding: get("transparent-padding-y") get("transparent-padding-x");
205
- background-color: transparent;
206
- border: none;
207
- }
208
- &[open],
209
- &.is-active {
210
- background-color: transparent;
211
- > #{ $prefix }__summary{
212
- border-bottom: none;
223
+ border-radius: 0;
224
+
225
+ // Transparent always collapses space
226
+ @if (get("margin-between") != 0) {
227
+ &:has(+ #{ $prefix }) {
213
228
  margin-bottom: 0;
214
229
  }
230
+ & + #{ $prefix } {
231
+ margin-top: -(get("border-width")); // Pull border over top
232
+ }
233
+ }
234
+ > #{ $prefix }__summary,
235
+ > #{ $prefix }__content {
236
+ padding-left: 0;
237
+ padding-right: 0;
238
+ background-color: transparent;
239
+ border: none !important;
240
+ border-radius: 0 !important;
241
+ }
242
+ > #{ $prefix }__content {
243
+ padding: get("transparent-content-padding");
215
244
  }
216
245
  }
217
246
  #{ $prefix }--borderless {
218
247
  border: none;
248
+ &:has(+ #{ $prefix }) {
249
+ margin-bottom: 0;
250
+ }
219
251
  & + #{ $prefix }--borderless {
220
- $gap: -(get("margin") - get("borderless-margin-between"));
221
- margin-top: $gap;
222
- margin-top: calc($gap - get("border-width"));
252
+ margin-top: calc(get("borderless-margin-between") - get("border-width"));
223
253
  }
224
254
  &[open],
225
- &.is-active {
226
- & > .accordion__summary {
255
+ &#{ $active-selector } {
256
+ & > #{ $prefix }__summary {
257
+ border-radius: get("border-radius");
227
258
  border-bottom: none;
228
259
  }
229
260
  }