hr-design-system-handlebars 0.50.1 → 0.50.4

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 (33) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/assets/index.css +16 -4
  3. package/dist/views/components/site_header/header_alpine.js +56 -9
  4. package/dist/views/components/teaser/components/teaser_title_classes.hbs +1 -1
  5. package/dist/views/components/teaser/teaser_alternativ.hbs +8 -5
  6. package/package.json +1 -1
  7. package/src/assets/fixtures/teaser/teaser_alternative_100_serif.json +15 -0
  8. package/src/assets/fixtures/teaser/teaser_alternative_50_serif.json +15 -0
  9. package/src/assets/images/navi_default.png +0 -0
  10. package/src/assets/images/navi_flyout_section.PNG +0 -0
  11. package/src/assets/images/navi_flyout_service.PNG +0 -0
  12. package/src/assets/images/navi_mobil_burger_open.PNG +0 -0
  13. package/src/assets/images/navi_mobil_default.PNG +0 -0
  14. package/src/assets/images/navi_mobil_scroll_1percent.PNG +0 -0
  15. package/src/assets/images/navi_mobil_scroll_50percent.PNG +0 -0
  16. package/src/assets/images/navi_mobil_search.PNG +0 -0
  17. package/src/assets/images/navi_mobil_search.jpg +0 -0
  18. package/src/assets/images/navi_scroll_50percent.PNG +0 -0
  19. package/src/assets/images/navi_scroll_90percent.PNG +0 -0
  20. package/src/assets/images/navi_tablet.PNG +0 -0
  21. package/src/assets/images/navi_tablet_flyout_service.PNG +0 -0
  22. package/src/assets/images/navi_tablet_scroll_1percent.PNG +0 -0
  23. package/src/assets/images/navi_tablet_scroll_50percent.PNG +0 -0
  24. package/src/assets/tailwind.css +4 -0
  25. package/src/stories/views/components/site_header/header.stories.mdx +331 -6
  26. package/src/stories/views/components/site_header/header_alpine.js +56 -9
  27. package/src/stories/views/components/teaser/components/teaser_title_classes.hbs +1 -1
  28. package/src/stories/views/components/teaser/fixtures/teaser_alternative_100_serif.json +1 -1
  29. package/src/stories/views/components/teaser/fixtures/teaser_alternative_50_serif.json +1 -1
  30. package/src/stories/views/components/teaser/fixtures/teaser_cluster.json +1 -1
  31. package/src/stories/views/components/teaser/fixtures/teaser_tabbox.json +1 -1
  32. package/src/stories/views/components/teaser/teaser_alternativ.hbs +8 -5
  33. package/src/stories/views/components/teaser/teaser_alternativ.stories.mdx +3 -0
package/CHANGELOG.md CHANGED
@@ -1,3 +1,39 @@
1
+ # v0.50.4 (Fri Jul 15 2022)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Changed alternative 100% and 50% teaser to 1to1 in mobile [#280](https://github.com/mumprod/hr-design-system-handlebars/pull/280) ([@vascoeduardo](https://github.com/vascoeduardo))
6
+
7
+ #### Authors: 1
8
+
9
+ - Vasco ([@vascoeduardo](https://github.com/vascoeduardo))
10
+
11
+ ---
12
+
13
+ # v0.50.3 (Fri Jul 15 2022)
14
+
15
+ #### 🐛 Bug Fix
16
+
17
+ - removes loader from main.js + some more doku [#279](https://github.com/mumprod/hr-design-system-handlebars/pull/279) ([@StefanVesper](https://github.com/StefanVesper))
18
+
19
+ #### Authors: 1
20
+
21
+ - SonicSoulSurfer ([@StefanVesper](https://github.com/StefanVesper))
22
+
23
+ ---
24
+
25
+ # v0.50.2 (Fri Jul 15 2022)
26
+
27
+ #### 🐛 Bug Fix
28
+
29
+ - refactor header.stories.mdx [#276](https://github.com/mumprod/hr-design-system-handlebars/pull/276) ([@StefanVesper](https://github.com/StefanVesper))
30
+
31
+ #### Authors: 1
32
+
33
+ - SonicSoulSurfer ([@StefanVesper](https://github.com/StefanVesper))
34
+
35
+ ---
36
+
1
37
  # v0.50.1 (Fri Jul 15 2022)
2
38
 
3
39
  #### 🐛 Bug Fix
@@ -596,6 +596,10 @@ video {
596
596
  .relative {
597
597
  position: relative;
598
598
  }
599
+ .sticky {
600
+ position: -webkit-sticky;
601
+ position: sticky;
602
+ }
599
603
  .bottom-0 {
600
604
  bottom: 0px;
601
605
  }
@@ -910,6 +914,10 @@ video {
910
914
  -ms-flex-negative: 0;
911
915
  flex-shrink: 0;
912
916
  }
917
+ .basis-2\/3 {
918
+ -ms-flex-preferred-size: 66.666667%;
919
+ flex-basis: 66.666667%;
920
+ }
913
921
  .basis-2\/5 {
914
922
  -ms-flex-preferred-size: 40%;
915
923
  flex-basis: 40%;
@@ -918,10 +926,6 @@ video {
918
926
  -ms-flex-preferred-size: 33.333333%;
919
927
  flex-basis: 33.333333%;
920
928
  }
921
- .basis-2\/3 {
922
- -ms-flex-preferred-size: 66.666667%;
923
- flex-basis: 66.666667%;
924
- }
925
929
  .basis-3\/5 {
926
930
  -ms-flex-preferred-size: 60%;
927
931
  flex-basis: 60%;
@@ -2417,6 +2421,9 @@ video {
2417
2421
  --color-topline: #c20016;
2418
2422
  }
2419
2423
  /*! purgecss end ignore */
2424
+ .sbdocs-content {
2425
+ max-width:1140px !important;
2426
+ }
2420
2427
  .hide-scroll-bar {
2421
2428
  -ms-overflow-style: none;
2422
2429
  scrollbar-width: none;
@@ -2675,6 +2682,11 @@ video {
2675
2682
  flex-basis: 33.333333%;
2676
2683
  }
2677
2684
 
2685
+ .md\:basis-1\/2 {
2686
+ -ms-flex-preferred-size: 50%;
2687
+ flex-basis: 50%;
2688
+ }
2689
+
2678
2690
  .md\:basis-2\/3 {
2679
2691
  -ms-flex-preferred-size: 66.666667%;
2680
2692
  flex-basis: 66.666667%;
@@ -32,23 +32,25 @@ document.addEventListener('alpine:init', () => {
32
32
  init(){
33
33
  let lastScrollTop = 0
34
34
  let height = window.innerHeight
35
+
36
+ //Globale Variable, true = user initiated scroll / false = programmatic scroll via JS (e.g. click on Anchor Link)
35
37
  let userScroll = false;
36
38
  window.userScroll = userScroll;
37
39
 
40
+ // gets fired when user initated scroll happened, global variable is used in Ticker-Topnews and other anchor links to prevent expanding of the navigation if scrollposition gets corrected by JS.
38
41
  const mouseEvent = () => {
39
42
  userScroll = true;
40
43
  window.userScroll = true;
41
- //console.log('user action detected')
42
44
  }
43
-
45
+ // detect if the user clicked/dragged the scrollbar manually
44
46
  const clickedOnScrollbar = mouseX => {
45
47
  return document.documentElement.offsetWidth <= mouseX ? true : false;
46
48
  }
47
-
49
+ // if clicked on scrollbar, fire user initiated mouse event
48
50
  const mouseDownHandler = e => {
49
51
  clickedOnScrollbar(e.clientX) ? mouseEvent() : null
50
52
  };
51
-
53
+ // main scroll handler, defines scroll direction, percent of viewport scrolled, visibility of navigation and subnavigation
52
54
  const scrollHandler = () => {
53
55
  let winScroll = document.body.scrollTop || document.documentElement.scrollTop
54
56
  winScroll > lastScrollTop ? this.scrollingDown = true : this.scrollingDown = false
@@ -59,14 +61,19 @@ document.addEventListener('alpine:init', () => {
59
61
  //console.log('winscroll: '+winScroll+' screen height: '+height + ' percent scrolled: '+ this.percent)
60
62
  //console.log('Scroll initiated by ' + (window.userScroll == true ? "user" : "browser"));
61
63
  }
62
-
64
+ // Listeners
63
65
  window.addEventListener('mousedown', mouseDownHandler, false)
64
66
  window.addEventListener('wheel', mouseEvent, false);
65
67
  window.addEventListener('touchmove', mouseEvent, false)
66
68
  window.addEventListener('scroll', this.debounce( scrollHandler,50), { passive: true })
67
69
  },
70
+ //Holds the percentage of scrolled viewport
68
71
  percent: 0,
72
+
73
+ //defines the scroll direction
69
74
  scrollingDown: true,
75
+
76
+ //returns true if section navigation is hidden on desktop OR service navigation is hidden on mobile
70
77
  isNavHidden() {
71
78
  if(this.$screen('lg')) {
72
79
  return this.shouldSectionNavBeHidden()
@@ -74,6 +81,8 @@ document.addEventListener('alpine:init', () => {
74
81
  return this.shouldServiceNavBeHidden()
75
82
  }
76
83
  },
84
+
85
+ //returns false if subnav is visible and true if subnav is hidden
77
86
  isSubNavHidden() {
78
87
  if(this.$screen('lg')){
79
88
  if (document.querySelector('.isSelectedAndOpen') !== null) {
@@ -85,9 +94,13 @@ document.addEventListener('alpine:init', () => {
85
94
  return true
86
95
  }
87
96
  },
97
+
98
+ // returns true if the user scrolled at least 1px from top
88
99
  shouldBrandNavBeHidden() {
89
100
  return this.percent > 0
90
101
  },
102
+
103
+ // returns true if user scrolled >50% and scrolls down, no burger menu is open and the screen size is desktop. If scroll was initiated by script, ignore scroll direction.
91
104
  shouldSectionNavBeHidden() {
92
105
  if(window.userScroll == true){
93
106
  return this.percent > 50 && this.scrollingDown && this.$store.burgeropen == false && this.$screen('lg')
@@ -96,6 +109,8 @@ document.addEventListener('alpine:init', () => {
96
109
  }
97
110
 
98
111
  },
112
+
113
+ // returns true if user scrolled >90% and scrolls further down, no burger menu is open and the screen is NOT desktop. If scroll was initiated by script, ignore scroll direction.
99
114
  shouldServiceNavBeHidden() {
100
115
  if(window.userScroll == true) {
101
116
  return (this.percent > 90 && !this.$screen('lg') && this.scrollingDown && this.$store.burgeropen == false)
@@ -103,12 +118,18 @@ document.addEventListener('alpine:init', () => {
103
118
  return (this.percent > 90 && !this.$screen('lg') && this.$store.burgeropen == false)
104
119
  }
105
120
  },
121
+
122
+ //returns true if user scrolled >50% and scrolls further down, no burger menu is open, no serviceNav is open and screen is not larger than mobile. OR: same same, but scrolling up.
106
123
  shouldServiceIconsBeHidden() {
107
124
  return (this.percent > 50 && !this.$screen('md') && this.$store.burgeropen == false && this.$store.serviceNavIsOpen == false && this.scrollingDown == true) || (this.percent > 50 && !this.$screen('md') && this.$store.burgeropen == false && this.$store.serviceNavIsOpen == false && this.scrollingDown == false)
108
125
  },
126
+
127
+ // returns true if user scrolled >50% and scrolls further down and is a desktop viewport
109
128
  shouldFlyoutBeHidden() {
110
129
  return (this.percent > 50 && this.scrollingDown && this.$screen('lg') )
111
130
  },
131
+
132
+ // resets the navigation back to the initial state. Happens f.ex. on resize of window.
112
133
  resetNav() {
113
134
  if(window.innerWidth > 1023) {
114
135
  this.$refs.sectionnavigation.setAttribute("style","")
@@ -143,6 +164,8 @@ document.addEventListener('alpine:init', () => {
143
164
  this.$store.clientWidth = nowClientWidth
144
165
  }
145
166
  },
167
+
168
+ // toggles the maxHeight of the section nav and makes sure there is enough space to display all items.
146
169
  toggleSectionNav() {
147
170
  //false = sectionNav schließt ( mobile/tablet? --> maxHeight = 0 /// desktop? just clear maxHeight attribute )
148
171
  //true = sectionNav öffnet (maxheight = scrollheight)
@@ -168,16 +191,22 @@ document.addEventListener('alpine:init', () => {
168
191
  }
169
192
  }
170
193
  },
194
+
195
+ // no scrolling when overlay is visible
171
196
  disableScrolling() {
172
197
  document.body.classList.add('overflow-hidden','h-full','w-full')
173
198
  this.$refs.myOverlay.ontouchmove = (e) => e.preventDefault();
174
199
  console.log("disableScrolling")
175
200
  },
201
+
202
+ //only scroll when no overlay is visible
176
203
  enableScrolling() {
177
204
  document.body.classList.remove('overflow-hidden','h-full','w-full')
178
205
  this.$refs.myOverlay.ontouchmove = (e) => true;
179
206
  console.log("enableScrolling")
180
207
  },
208
+
209
+ // toggles scrolling ability
181
210
  toggleScrolling(mode){
182
211
  if(this.$screen(0) && !this.$screen('lg')){
183
212
  mode == false ? this.disableScrolling() : this.enableScrolling()
@@ -191,9 +220,13 @@ document.addEventListener('alpine:init', () => {
191
220
 
192
221
  // context for the overlay
193
222
  Alpine.data('overlayHandler', () => ({
223
+
224
+ // show the overlay on mobile and tablet if burger menu is open OR service nav is open OR search field is open
194
225
  shouldOverlayBeShown() {
195
226
  return (!this.$screen('lg') && ( this.$store.burgeropen == true || this.$store.serviceNavIsOpen == true || this.$store.searchFieldOpen == true ))
196
227
  },
228
+
229
+ // on click on overlay change global var for servicenav, dispatch events to close burger and service menu, re-enable scrolling.
197
230
  overlayWasClicked() {
198
231
  this.$store.serviceNavIsOpen ? this.$store.serviceNavIsOpen = false : null
199
232
  this.$dispatch('burger-close')
@@ -203,18 +236,28 @@ document.addEventListener('alpine:init', () => {
203
236
  }
204
237
  }))
205
238
 
206
- // context for all dropdowns
239
+ // context for all dropdowns, used in section nav submenus and service nav flyout submenus
207
240
  Alpine.data('dropdown', () => ({
241
+
242
+ // state of the dropdown
208
243
  dropped: false,
244
+
245
+ // toggle() interpolates state
209
246
  toggle() {
210
247
  this.dropped = ! this.dropped;
211
248
  },
249
+
250
+ // toggles visibility of service nav and sets global variables in stores
212
251
  toggleServiceNav(){
213
252
  this.dropped = ! this.dropped;
253
+
254
+ // close search if open
214
255
  this.$store.searchFieldOpen = false;
215
256
 
257
+ // if clicked element is not the current serviceID, leave the servicenav open, else interpolate servicenav state
216
258
  this.$el.id != this.$store.serviceID.current ? this.$store.serviceNavIsOpen = true : this.$el.id == this.$store.serviceID.current ? this.$store.serviceNavIsOpen = !this.$store.serviceNavIsOpen : null;
217
259
 
260
+ //if burger is open, dispatch event to close it
218
261
  this.$store.burgeropen == true ? this.$dispatch('burger-close') : null
219
262
 
220
263
  console.log('currentID: '+ this.$store.serviceID.current)
@@ -222,10 +265,13 @@ document.addEventListener('alpine:init', () => {
222
265
  console.log('element-id: '+this.$el.id)
223
266
  console.log('serviceNav is open:'+ this.$store.serviceNavIsOpen)
224
267
 
268
+ //set the serviceID to the current element´s ID.
225
269
  this.$store.serviceID.current = this.$el.id
226
270
 
271
+ //enable/disable scrolling
227
272
  this.toggleScrolling(!this.$store.serviceNavIsOpen)
228
273
 
274
+ //defines behaviour for servicenav on mobile viewports, taking care of viewport sizes
229
275
  let myFlyout = document.querySelector('#flyout-'+this.$el.id)
230
276
  let brandNavHeight = this.percent > 0 ? 40 : 0
231
277
 
@@ -252,8 +298,9 @@ document.addEventListener('alpine:init', () => {
252
298
  this.$el.setAttribute("x-collapse","")
253
299
  }
254
300
  },
301
+
302
+ //Adds scrollheight of the flyout to sectionNav container to make sure all following items stay visible
255
303
  sectionNavFlyoutWatcher() {
256
- //Adds scrollheight of the flyout to sectionNav container to make sure all following items stay visible
257
304
  this.$watch('dropped', value => {
258
305
  let a = this.$refs.sectionnavigation.scrollHeight + this.$el.scrollHeight;
259
306
  let brandNavHeight = this.percent > 0 ? 40 : 0
@@ -278,8 +325,9 @@ document.addEventListener('alpine:init', () => {
278
325
 
279
326
  })
280
327
  },
328
+
329
+ //sets/cleansup the x-collapse attributes depending on window.innerWidth, gets fired @resize.window in NavigationFlyout.hbs
281
330
  setFlyoutAnimationStyle() {
282
- //sets/cleansup the x-collapse attributes depending on window.innerWidth, gets fired @resize.window in NavigationFlyout.hbs
283
331
  if(window.innerWidth > 1023) {
284
332
  if(this.$el.hasAttribute("x-collapse.duration.500ms")) {
285
333
  this.$el.removeAttribute("x-collapse.duration.500ms")
@@ -289,7 +337,6 @@ document.addEventListener('alpine:init', () => {
289
337
  if (! this.$el._x_isShown) this.$el.style.display = 'none'
290
338
  if(this.$el.hasAttribute("hidden")) this.$el.removeAttribute("hidden")
291
339
  }
292
-
293
340
  } else {
294
341
  if(!this.$el.hasAttribute("x-collapse.duration.500ms")) this.$el.setAttribute("x-collapse.duration.500ms","")
295
342
  }
@@ -30,7 +30,7 @@ the 4 parameters are:
30
30
  {{~inline-switch
31
31
  size
32
32
  '["hero","100","50"]'
33
- '["text-2xl md:text-3xl","text-2xl md:text-3xl","text-2xl"]'
33
+ '["text-2xl md:text-3xl","text-lg md:text-3xl","text-lg md:text-2xl"]'
34
34
  ~}}
35
35
  {{~/case~}}
36
36
  {{~#case 'poster-ds'~}}
@@ -1,9 +1,12 @@
1
- <article class="col-span-12 flex flex-col md:flex-row gap-y-3 gap-x-4 md:px-0 {{inline-switch this.teaserSize '["50"]' '["md:col-span-6"]'}} ">
2
- <figure class="ar-16-9 {{inline-switch this.teaserSize '["50","100","hero"]' '["basis-2/5 md:basis-1/3", "basis-1/3" , "basis-2/3"]'}} ">
1
+ <article class="col-span-12 flex md:flex-row gap-y-3 gap-x-4 md:px-0
2
+ {{~inline-switch this.teaserSize '["hero","100","50"]' '[" flex-col"," px-5"," md:col-span-6 px-5"]'~}}
3
+ "
4
+ >
5
+ <figure class="ar-16-9{{~inline-switch this.teaserSize '["hero","100","50"]' '["basis-2/3"," basis-2/5 md:basis-1/3"," basis-2/5 md:basis-1/2"]'~}}">
3
6
  {{> components/teaser/components/teaser_lead }}
4
7
  </figure>
5
- <div class="{{inline-switch this.teaserSize '["50","100","hero"]' '["basis-3/5 md:basis-2/3","basis-2/3","basis-1/3"]'}} ">
6
- <header class="px-5 md:px-0">
8
+ <div class="{{~inline-switch this.teaserSize '["hero","100","50"]' '["basis-1/3"," basis-3/5 md:basis-2/3"," basis-3/5 md:basis-1/2"]'~}}">
9
+ <header class="md:px-0{{#unless this.isMobile1to1}} px-5{{/unless}}">
7
10
  {{#>components/base/link css="hover:text-toplineColor" doTracking=(if this.doTracking 'true') clickLabelPrefix1=this.teaserSize clickLabelPrefix2="headlineLink" }}
8
11
  {{> components/teaser/components/teaser_heading fontVariant=this.headingFontVariant
9
12
  headlineTag=this.headlineTag
@@ -14,7 +17,7 @@
14
17
  topline=this.topline}}
15
18
  {{/components/base/link}}
16
19
  </header>
17
- <section class="px-5 md:px-0">
20
+ <section class="md:px-0{{#unless this.isMobile1to1}} px-5{{/unless}}">
18
21
  {{> components/teaser/components/teaser_text text=this.shorttext size=this.teaserSize }}
19
22
  {{> components/teaser/components/teaser_byline}}
20
23
  </section>
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "license": "MIT",
7
7
  "main": "dist/index.js",
8
8
  "repository": "https://github.com/szuelch/hr-design-system-handlebars",
9
- "version": "0.50.1",
9
+ "version": "0.50.4",
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
12
  "storybook": "start-storybook -p 6006 public",
@@ -13,6 +13,21 @@
13
13
  {
14
14
  "@->contentpath": "logicItem.includeModel.teaserType",
15
15
  "@->value": "alternative-ds"
16
+ },
17
+ {
18
+ "@->contentpath": "logicItem.includeModel.isMobile1to1",
19
+ "@->value": "true"
20
+ },
21
+ {
22
+ "@->contentpath": "logicItem.includeModel.link.content.isMobile1to1",
23
+ "@->value": "true"
24
+ },
25
+ {
26
+ "@->contentpath": "logicItem.includeModel.teaserImage",
27
+ "@->value": {
28
+ "@->jsoninclude": "teaser/teaser_images.inc.json",
29
+ "@->contentpath": "md_1_tab"
30
+ }
16
31
  }
17
32
  ]
18
33
  }
@@ -13,6 +13,21 @@
13
13
  {
14
14
  "@->contentpath": "logicItem.includeModel.teaserType",
15
15
  "@->value": "alternative-ds"
16
+ },
17
+ {
18
+ "@->contentpath": "logicItem.includeModel.isMobile1to1",
19
+ "@->value": "true"
20
+ },
21
+ {
22
+ "@->contentpath": "logicItem.includeModel.link.content.isMobile1to1",
23
+ "@->value": "true"
24
+ },
25
+ {
26
+ "@->contentpath": "logicItem.includeModel.teaserImage",
27
+ "@->value": {
28
+ "@->jsoninclude": "teaser/teaser_images.inc.json",
29
+ "@->contentpath": "md_2_tab"
30
+ }
16
31
  }
17
32
  ]
18
33
  }
@@ -353,6 +353,10 @@
353
353
 
354
354
  /*! purgecss end ignore */
355
355
 
356
+ .sbdocs-content {
357
+ max-width:1140px !important;
358
+ }
359
+
356
360
  .hide-scroll-bar {
357
361
  -ms-overflow-style: none;
358
362
  scrollbar-width: none;