@ulu/frontend 0.1.0-beta.26 → 0.1.0-beta.27

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.
@@ -29,7 +29,8 @@ $-fallbacks: (
29
29
 
30
30
  /// Module Settings
31
31
  /// @type Map
32
- /// @prop {Dimension} arrow-size [16px] size of the dropdown arrow.
32
+ /// @prop {Dimension} arrow-size [16px] Size of the dropdown arrow.
33
+ /// @prop {Dimension} arrow-mask-overlap [4px] Size that the mask extends beyond the arrow size (which covers up the arrow box shadow inside the popover content). This should be adjusted based on the size of the box-shadow being used)
33
34
  /// @prop {Color} background-color [white] Background color of the popover.
34
35
  /// @prop {Dimension} border-radius [6px] Border radius of the popover.
35
36
  /// @prop {Color} color [inherit] Text color of the popover.
@@ -61,6 +62,7 @@ $-fallbacks: (
61
62
 
62
63
  $config: (
63
64
  "arrow-size" : 16px,
65
+ "arrow-mask-overlap" : 4px,
64
66
  "background-color" : white,
65
67
  "border-radius" : 6px,
66
68
  "color" : inherit,
@@ -70,7 +72,6 @@ $config: (
70
72
  "padding-large" : 2rem,
71
73
  "type-size" : null,
72
74
  "z-index" : true,
73
-
74
75
  "box-shadow" : true,
75
76
  "box-shadow-footer" : 0 0 4px,
76
77
  "box-shadow-footer-color" : "box-shadow",
@@ -117,39 +118,9 @@ $config: (
117
118
 
118
119
  @mixin styles {
119
120
  $prefix: selector.class("popover");
120
- $arrow-size-half: math.div(get("arrow-size"), 2);
121
121
 
122
122
  @if (get("arrow-size")) {
123
- #{ $prefix }__arrow {
124
- display: block;
125
- visibility: hidden;
126
- z-index: 1;
127
- &,
128
- &:before {
129
- position: absolute;
130
- width: get("arrow-size");
131
- height: get("arrow-size");
132
- background: inherit;
133
- }
134
- &:before {
135
- visibility: visible;
136
- content: '';
137
- transform: rotate(45deg);
138
- // box-shadow: $box-shadow;
139
- }
140
- [data-placement^='top'] > & {
141
- bottom: -($arrow-size-half);
142
- }
143
- [data-placement^='bottom'] > & {
144
- top: -($arrow-size-half);
145
- }
146
- [data-placement^='left'] > & {
147
- right: -($arrow-size-half);
148
- }
149
- [data-placement^='right'] > & {
150
- left: -($arrow-size-half);
151
- }
152
- }
123
+ @include -arrow-styles();
153
124
  }
154
125
  // Default position is on the right of the container (Popper handles positioning)
155
126
  #{ $prefix } {
@@ -260,4 +231,66 @@ $config: (
260
231
  }
261
232
  }
262
233
  }
234
+ }
235
+
236
+ @mixin -arrow-styles() {
237
+ $prefix: selector.class("popover");
238
+ $size: get("arrow-size");
239
+ $half: math.div($size, 2);
240
+ $size-info: utils.number-info($size);
241
+ $unitless: map.get($size-info, "value");
242
+ $unit: map.get($size-info, "unit");
243
+ $hypotenuse: utils.hypotenuse($unitless, $unitless);
244
+ $hypotenuse-half: math.div($hypotenuse, 2);
245
+ $overlap: utils.strip-unit(get("arrow-mask-overlap"));
246
+ $mask-height: utils.add-unit($hypotenuse-half + $overlap, $unit);
247
+ $mask-width: utils.add-unit($hypotenuse + $overlap, $unit);
248
+
249
+ #{ $prefix }__arrow {
250
+ visibility: hidden;
251
+ z-index: 1;
252
+ &,
253
+ &:before,
254
+ &:after {
255
+ display: block;
256
+ position: absolute;
257
+ width: $size;
258
+ height: $size;
259
+ background: inherit;
260
+ }
261
+ &:before,
262
+ &:after {
263
+ visibility: visible;
264
+ content: '';
265
+ }
266
+ &:before {
267
+ box-shadow: get("box-shadow");
268
+ transform: rotate(45deg);
269
+ }
270
+ // Masking shape
271
+ &:after {
272
+ background: inherit;
273
+ background: inherit;
274
+ top: 50%;
275
+ left: 50%;
276
+ transform: translateX(-50%);
277
+ height: $mask-height;
278
+ width: $mask-width;
279
+ }
280
+ [data-placement^='top'] > & {
281
+ bottom: -($half);
282
+ transform: rotate(180deg); // Rotate w. mask
283
+ }
284
+ [data-placement^='bottom'] > & {
285
+ top: -($half);
286
+ }
287
+ [data-placement^='left'] > & {
288
+ right: -($half);
289
+ transform: rotate(90deg); // Rotate w. mask
290
+ }
291
+ [data-placement^='right'] > & {
292
+ left: -($half);
293
+ transform: rotate(-90deg); // Rotate w. mask
294
+ }
295
+ }
263
296
  }
@@ -1 +1 @@
1
- {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../js/ui/popover.js"],"names":[],"mappings":"AA6BA;;GAEG;AACH,6BAGC;AAED;;;;GAIG;AACH,8BAWC;AAED;;GAEG;AACH;;;;;;;;;EAkBC;AAKD,uDAmBC;AA5FD;;GAEG;AACH,4BAAqC;AA4FrC;;GAEG;AACH;IACE,8DAIC;IADC,qBAA4C;IAa9C,+BAIC;IADC,0BAA+E;IAEjF,gCAKC;CACF;4BAhI2B,kBAAkB"}
1
+ {"version":3,"file":"popover.d.ts","sourceRoot":"","sources":["../../js/ui/popover.js"],"names":[],"mappings":"AA6BA;;GAEG;AACH,6BAGC;AAED;;;;GAIG;AACH,8BAWC;AAED;;GAEG;AACH;;;;;;;;;EAkBC;AAKD,uDAmBC;AA5FD;;GAEG;AACH,4BAAqC;AA4FrC;;GAEG;AACH;IACE,8DAIC;IADC,qBAA4C;IAa9C,+BAKC;IADC,0BAA+E;IAEjF,gCAKC;CACF;4BAjI2B,kBAAkB"}