@madj2k/fe-frontend-kit 2.0.21 → 2.0.23
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.
|
@@ -371,15 +371,17 @@ class Madj2kFlyoutMenu {
|
|
|
371
371
|
* Adjusts menu padding based on settings
|
|
372
372
|
*/
|
|
373
373
|
paddingMenu() {
|
|
374
|
+
|
|
374
375
|
if (!this.settings.$paddingReference) return;
|
|
375
376
|
if (this.settings.paddingBehavior === 0) return;
|
|
376
|
-
|
|
377
|
+
// should be re-evaluated on a resize event after re-opening the menu
|
|
378
|
+
// if (this.settings.paddingBehavior === 1 && this.settings.$menuInner.hasAttribute('data-padding-set')) return;
|
|
377
379
|
|
|
378
380
|
let left = this.settings.$paddingReference.getBoundingClientRect().left;
|
|
379
381
|
if (window.innerWidth < this.settings.paddingViewPortMinWidth) left = 0;
|
|
380
382
|
|
|
381
383
|
this.settings.$menuInner.style.paddingLeft = `${left}px`;
|
|
382
|
-
this.settings.$menuInner.setAttribute('data-padding-set', 'true');
|
|
384
|
+
// this.settings.$menuInner.setAttribute('data-padding-set', 'true');
|
|
383
385
|
}
|
|
384
386
|
|
|
385
387
|
/**
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
# @madj2k/frontend-kit
|
|
1
|
+
# @madj2k/fe-frontend-kit
|
|
2
2
|
Reusable frontend toolkit including SCSS mixins and menu components (JS/SCSS).
|
|
3
3
|
|
|
4
4
|
# # Installation
|
|
5
5
|
```
|
|
6
|
-
npm install @madj2k/frontend-kit
|
|
6
|
+
npm install @madj2k/fe-frontend-kit
|
|
7
7
|
```
|
|
8
8
|
Requirements:
|
|
9
9
|
For SCSS mixins: Bootstrap SCSS (your project needs to install bootstrap and include it in the build)
|
|
@@ -17,11 +17,11 @@ For menu components: none
|
|
|
17
17
|
## Usage in your project
|
|
18
18
|
### SCSS Mixins
|
|
19
19
|
```
|
|
20
|
-
@use '@madj2k/frontend-kit' as *;
|
|
20
|
+
@use '@madj2k/fe-frontend-kit' as *;
|
|
21
21
|
```
|
|
22
22
|
Or import individual mixins:
|
|
23
23
|
```
|
|
24
|
-
@use '@madj2k/frontend-kit/sass/00_mixins/colors' as *;
|
|
24
|
+
@use '@madj2k/fe-frontend-kit/sass/00_mixins/colors' as *;
|
|
25
25
|
```
|
|
26
26
|
### Menu components (JS and SCSS):
|
|
27
27
|
Each menu component can be used separately.
|
|
@@ -32,7 +32,7 @@ with opening and closing animation and optional cookie persistence.
|
|
|
32
32
|
|
|
33
33
|
Init:
|
|
34
34
|
```
|
|
35
|
-
import { Madj2kBanner } from '@madj2k/frontend-kit/tools/banner';
|
|
35
|
+
import { Madj2kBanner } from '@madj2k/fe-frontend-kit/tools/banner';
|
|
36
36
|
const banner = new Madj2kBanner({
|
|
37
37
|
bannerId: 'my-banner',
|
|
38
38
|
activeClass: 'active',
|
|
@@ -138,7 +138,7 @@ resize-events during user scrolling on mobile, and respects active input fields
|
|
|
138
138
|
|
|
139
139
|
Init with available options:
|
|
140
140
|
```
|
|
141
|
-
import { Madj2kBetterResizeEvent } from '@madj2k/frontend-kit/tools/better-resize-event';
|
|
141
|
+
import { Madj2kBetterResizeEvent } from '@madj2k/fe-frontend-kit/tools/better-resize-event';
|
|
142
142
|
const betterResizeEvent = new Madj2kBetterResizeEvent({
|
|
143
143
|
resizeEndTimeout: 300,
|
|
144
144
|
scrollingEndTimeout: 600,
|
|
@@ -165,7 +165,7 @@ where elements can be added, removed or re-ordered dynamically.
|
|
|
165
165
|
|
|
166
166
|
Init with available options:
|
|
167
167
|
```
|
|
168
|
-
import { Madj2kScrolling } from '@madj2k/frontend-kit/tools/scrolling';
|
|
168
|
+
import { Madj2kScrolling } from '@madj2k/fe-frontend-kit/tools/scrolling';
|
|
169
169
|
const scrolling = new Madj2kScrolling({
|
|
170
170
|
anchorScrolling: {
|
|
171
171
|
selector: ['a[href^="#"]', 'a[href*="#"]'],
|
|
@@ -200,7 +200,7 @@ and allows overlays to be closed externally via a custom event.
|
|
|
200
200
|
|
|
201
201
|
Init with available options:
|
|
202
202
|
```
|
|
203
|
-
import { Madj2kToggledOverlay } from '@madj2k/frontend-kit/tools/toggled-overlay';
|
|
203
|
+
import { Madj2kToggledOverlay } from '@madj2k/fe-frontend-kit/tools/toggled-overlay';
|
|
204
204
|
const overlayToggle = new Madj2kToggledOverlay('.js-toggled-overlay');
|
|
205
205
|
```
|
|
206
206
|
|
|
@@ -223,14 +223,22 @@ HTML:
|
|
|
223
223
|
Integrate the CSS- and JS-file into your project. Make sure jQuery is included.
|
|
224
224
|
Then init the menu with
|
|
225
225
|
```
|
|
226
|
-
import { Madj2kFlyoutMenu } from '@madj2k/frontend-kit/menus/flyout-menu';
|
|
226
|
+
import { Madj2kFlyoutMenu } from '@madj2k/fe-frontend-kit/menus/flyout-menu';
|
|
227
227
|
document.querySelectorAll('.js-flyout-toggle').forEach((el) => {
|
|
228
228
|
new Madj2kFlyoutMenu(el, { animationDuration: 800 });
|
|
229
229
|
});
|
|
230
230
|
```
|
|
231
|
+
Optional for automatically closing of the flyout menu resizing the browser window:
|
|
232
|
+
```
|
|
233
|
+
import { Madj2kBetterResizeEvent } from '@madj2k/fe-frontend-kit/tools/better-resize-event';
|
|
234
|
+
document.addEventListener('madj2k-better-resize-event', () => {
|
|
235
|
+
document.dispatchEvent(new CustomEvent('madj2k-flyoutmenu-close'));
|
|
236
|
+
});
|
|
237
|
+
```
|
|
238
|
+
|
|
231
239
|
CSS:
|
|
232
240
|
```
|
|
233
|
-
@use '@madj2k/frontend-kit/menus/flyout-menu' as *;
|
|
241
|
+
@use '@madj2k/fe-frontend-kit/menus/flyout-menu' as *;
|
|
234
242
|
```
|
|
235
243
|
|
|
236
244
|
## Basic HTML
|
|
@@ -275,7 +283,7 @@ Otherwise in the opened menu the scrolling won't work.
|
|
|
275
283
|
```
|
|
276
284
|
Then we deactivate the fullHeight of the flyout menu and make the blurry background clickable
|
|
277
285
|
```
|
|
278
|
-
import { Madj2kFlyoutdownMenu } from '@madj2k/frontend-kit/menus/flyout-menu';
|
|
286
|
+
import { Madj2kFlyoutdownMenu } from '@madj2k/fe-frontend-kit/menus/flyout-menu';
|
|
279
287
|
document.querySelectorAll('.js-flyout-toggle').forEach((el) => {
|
|
280
288
|
new Madj2kFlyoutMenu(el, { fullHeight: false });
|
|
281
289
|
});
|
|
@@ -329,14 +337,22 @@ html,body {
|
|
|
329
337
|
Integrate the CSS- and JS-file into your project. Make sure jQuery is included.
|
|
330
338
|
Then init the menu with
|
|
331
339
|
```
|
|
332
|
-
import { Madj2kPulldownMenu } from '@madj2k/frontend-kit/menus/pulldown-menu';
|
|
340
|
+
import { Madj2kPulldownMenu } from '@madj2k/fe-frontend-kit/menus/pulldown-menu';
|
|
333
341
|
document.querySelectorAll('.js-pulldown-toggle').forEach((el) => {
|
|
334
342
|
new Madj2kPulldownMenu(el);
|
|
335
343
|
});
|
|
336
344
|
```
|
|
345
|
+
Optional for automatically closing of the flyout menu resizing the browser window:
|
|
346
|
+
```
|
|
347
|
+
import { Madj2kBetterResizeEvent } from '@madj2k/fe-frontend-kit/tools/better-resize-event';
|
|
348
|
+
document.addEventListener('madj2k-better-resize-event', () => {
|
|
349
|
+
document.dispatchEvent(new CustomEvent('madj2k-pulldownmenu-close'));
|
|
350
|
+
});
|
|
351
|
+
```
|
|
352
|
+
|
|
337
353
|
CSS:
|
|
338
354
|
```
|
|
339
|
-
@use '@madj2k/frontend-kit/menus/pulldown-menu' as *;
|
|
355
|
+
@use '@madj2k/fe-frontend-kit/menus/pulldown-menu' as *;
|
|
340
356
|
```
|
|
341
357
|
|
|
342
358
|
## Basic HTML
|
|
@@ -19,11 +19,13 @@
|
|
|
19
19
|
/// @group Typography
|
|
20
20
|
/// @param {Map} $font-formats - A map of font style definitions. Defaults to the global `$font-formats` map.
|
|
21
21
|
/// @param {String} $font-format - The key name of the format to apply (e.g., 'h1', 'copy-small').
|
|
22
|
+
/// @param {String} $tablet-breakpoint - The breakpoint name for tablet styles (default: lg).
|
|
23
|
+
/// @param {String} $desktop-breakpoint - The breakpoint name for desktop styles (default: xl).
|
|
22
24
|
///
|
|
23
25
|
/// @author Steffen Kroggel <developer@steffenkroggel>
|
|
24
26
|
/// @license GNU General Public License v3.0 https://www.gnu.org/licenses/gpl-3.0.en.html
|
|
25
27
|
///
|
|
26
|
-
@mixin font-format($font-formats, $font-format: 'h1') {
|
|
28
|
+
@mixin font-format($font-formats, $font-format: 'h1', $tablet-breakpoint: lg, $desktop-breakpoint: xl) {
|
|
27
29
|
$format-data: map-get($font-formats, $font-format);
|
|
28
30
|
$mobile-data: map-get($format-data, 'mobile');
|
|
29
31
|
$default-data: map-get($format-data, 'default');
|
|
@@ -38,7 +40,7 @@
|
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
@if map-has-key($format-data, 'tablet') {
|
|
41
|
-
@include media-breakpoint-up(
|
|
43
|
+
@include media-breakpoint-up($tablet-breakpoint) {
|
|
42
44
|
@each $key in $keys {
|
|
43
45
|
#{$key}: map-get(map-get($format-data, 'tablet'), $key);
|
|
44
46
|
}
|
|
@@ -46,12 +48,23 @@
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
@if map-has-key($format-data, 'desktop') {
|
|
49
|
-
@include media-breakpoint-up(
|
|
51
|
+
@include media-breakpoint-up($desktop-breakpoint) {
|
|
50
52
|
@each $key in $keys {
|
|
51
53
|
#{$key}: map-get(map-get($format-data, 'desktop'), $key);
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
}
|
|
57
|
+
|
|
58
|
+
// dynamic breakpoints (but not mobile, default, tablet, desktop)
|
|
59
|
+
@each $variant, $values in $format-data {
|
|
60
|
+
@if not index(('mobile', 'default', 'tablet', 'desktop'), $variant) {
|
|
61
|
+
@include media-breakpoint-up($variant) {
|
|
62
|
+
@each $key in $keys {
|
|
63
|
+
#{$key}: map-get($values, $key);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
55
68
|
}
|
|
56
69
|
|
|
57
70
|
/// Enables word breaking and hyphenation for improved long text handling.
|