hr-design-system-handlebars 1.8.1 → 1.9.1

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # v1.9.1 (Mon Mar 13 2023)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - Bugfix/dpe 2186 [#583](https://github.com/mumprod/hr-design-system-handlebars/pull/583) ([@szuelch](https://github.com/szuelch))
6
+
7
+ #### Authors: 1
8
+
9
+ - [@szuelch](https://github.com/szuelch)
10
+
11
+ ---
12
+
13
+ # v1.9.0 (Mon Mar 13 2023)
14
+
15
+ #### 🚀 Enhancement
16
+
17
+ - Bugfix/dpe 2186 [#582](https://github.com/mumprod/hr-design-system-handlebars/pull/582) ([@szuelch](https://github.com/szuelch))
18
+
19
+ #### Authors: 1
20
+
21
+ - [@szuelch](https://github.com/szuelch)
22
+
23
+ ---
24
+
1
25
  # v1.8.1 (Fri Mar 10 2023)
2
26
 
3
27
  #### 🐛 Bug Fix
@@ -185,7 +185,7 @@ var helpers = {
185
185
 
186
186
  // Register Helpers
187
187
  'resourceUrl': function (text, options) {
188
- var resourceUrl
188
+ let resourceUrl = text
189
189
  // ARD PLAYER Folder
190
190
  if (text.includes('assets/vendor/ardplayer/')) {
191
191
  resourceUrl = text.replace('assets/', './')
@@ -420,7 +420,18 @@ var helpers = {
420
420
  },
421
421
 
422
422
  'configProperty': function () {
423
- return null
423
+ let configProperty = ''
424
+
425
+ if (arguments.length >= 1) {
426
+ configProperty = arguments[0]
427
+ switch (configProperty) {
428
+ case 'dialogPolyfill.baseUrl':
429
+ configProperty = 'vendor/dialog-polyfill'
430
+ }
431
+ } else {
432
+ configProperty = 'No config-property defined.'
433
+ }
434
+ return configProperty
424
435
  },
425
436
 
426
437
  'addCacheEntry': function () {
@@ -2667,7 +2667,7 @@ video {
2667
2667
  transition-timing-function: cubic-bezier(0.4, 0, 1, 1);
2668
2668
  }
2669
2669
  .counter-reset {
2670
- counter-reset: cnt1678437637567;
2670
+ counter-reset: cnt1678722127008;
2671
2671
  }
2672
2672
  .line-clamp-4 {
2673
2673
  overflow: hidden;
@@ -2901,7 +2901,7 @@ video {
2901
2901
  --tw-ring-color: rgba(255, 255, 255, 0.5);
2902
2902
  }
2903
2903
  .-ordered {
2904
- counter-increment: cnt1678437637567 1;
2904
+ counter-increment: cnt1678722127008 1;
2905
2905
  }
2906
2906
  .-ordered::before {
2907
2907
  position: absolute;
@@ -2917,7 +2917,7 @@ video {
2917
2917
  letter-spacing: .0125em;
2918
2918
  --tw-text-opacity: 1;
2919
2919
  color: rgba(0, 0, 0, var(--tw-text-opacity));
2920
- content: counter(cnt1678437637567);
2920
+ content: counter(cnt1678722127008);
2921
2921
  }
2922
2922
  /*! ****************************/
2923
2923
  /*! text-shadow */
@@ -1,9 +1,11 @@
1
- import { hr$, listen, unlisten } from 'hrQuery'
1
+ import { hr$, listen, unlisten, addLink } from 'hrQuery'
2
2
  import { uxAction } from 'base/tracking/atiHelper.subfeature'
3
+ import dialogPolyfill from 'dialog-polyfill'
3
4
 
4
5
  const Modal = (context) => {
5
6
  const { options } = context,
6
7
  { element: rootElement } = context,
8
+ dialogPolyfillBaseUrl = options.dialogPolyfillBaseUrl || 'vendor/dialog-polyfill',
7
9
  modalTriggerId = options.modalTriggerId ? '#' + options.modalTriggerId : '',
8
10
  modalTrigger = hr$(modalTriggerId)[0],
9
11
  modalCloseTriggers = hr$('.js-modal-close', rootElement),
@@ -20,8 +22,18 @@ const Modal = (context) => {
20
22
  })
21
23
  }
22
24
 
25
+ const configurePolyfillIfNeeded = () => {
26
+ if (undefined == modal.showModal) {
27
+ addLink('dialog-polyfill-css', `${dialogPolyfillBaseUrl}/dialog-polyfill.css`, {
28
+ type: 'text/css',
29
+ rel: 'stylesheet',
30
+ })
31
+ }
32
+ dialogPolyfill.registerDialog(modal)
33
+ }
34
+
23
35
  const clickTracking = () => {
24
- console.log("tracking")
36
+ console.log('tracking')
25
37
  uxAction(trackingInformations)
26
38
  }
27
39
 
@@ -41,6 +53,7 @@ const Modal = (context) => {
41
53
  modal.close()
42
54
  }
43
55
 
56
+ configurePolyfillIfNeeded()
44
57
  configureEventListeners()
45
58
  }
46
59
 
@@ -358,6 +358,28 @@ const loadScript = function (id, scriptUrl, async, callback) {
358
358
  firstScriptTagInPage.parentNode.insertBefore(scriptTag, firstScriptTagInPage)
359
359
  }
360
360
 
361
+ const addLink = function (id, url, config) {
362
+ if (document.getElementById(id)) return
363
+
364
+ let linkTag = document.createElement('link')
365
+ linkTag.id = id
366
+ linkTag.href = url
367
+ if (config.type) {
368
+ linkTag.type = config.type
369
+ }
370
+ if (config.rel) {
371
+ linkTag.rel = config.rel
372
+ }
373
+ if (config.title) {
374
+ linkTag.title = config.title
375
+ }
376
+ if (config.as) {
377
+ linkTag.as = config.as
378
+ }
379
+
380
+ document.getElementsByTagName('head')[0].appendChild(linkTag)
381
+ }
382
+
361
383
  /*
362
384
  * Fügt ein "style" bereich zum dokument hinzu
363
385
  * und gibt eine referenz darauf zurück
@@ -445,6 +467,7 @@ const clearRequestInterval = (handle) =>
445
467
  : window.clearInterval(handle)
446
468
 
447
469
  export {
470
+ addLink,
448
471
  addStyle,
449
472
  hr$,
450
473
  stripTags,
@@ -0,0 +1,39 @@
1
+ dialog {
2
+ position: fixed;
3
+ top: 50%;
4
+ transform: translate(0, -50%);
5
+ left: 0;
6
+ right: 0;
7
+ width: -moz-fit-content;
8
+ width: -webkit-fit-content;
9
+ width: fit-content;
10
+ height: -moz-fit-content;
11
+ height: -webkit-fit-content;
12
+ height: fit-content;
13
+ margin: auto;
14
+ padding: 1em;
15
+ background: white;
16
+ color: black;
17
+ display: block;
18
+ }
19
+
20
+ dialog:not([open]) {
21
+ display: none;
22
+ }
23
+
24
+ dialog + .backdrop {
25
+ position: fixed;
26
+ top: 0;
27
+ right: 0;
28
+ bottom: 0;
29
+ left: 0;
30
+ background: rgba(96, 96, 96, 0.9);
31
+ }
32
+
33
+ ._dialog_overlay {
34
+ position: fixed;
35
+ top: 0;
36
+ right: 0;
37
+ bottom: 0;
38
+ left: 0;
39
+ }
@@ -1,4 +1,4 @@
1
- <div class="js-load" data-hr-modal='{"modalTriggerId":"{{defaultIfEmpty _trigger ""}}", "trackingInformations": "{{this.link.cmsDocument.title}} Ticketlink-Overlay ok geklickt - Dokumenten-Id: {{this.link.cmsDocument.sophoraId}}"}'>
1
+ <div class="js-load" data-hr-modal='{"modalTriggerId":"{{defaultIfEmpty _trigger ""}}", "trackingInformations": "{{this.link.cmsDocument.title}} Ticketlink-Overlay ok geklickt - Dokumenten-Id: {{this.link.cmsDocument.sophoraId}}","dialogPolyfillBaseUrl":"{{resourceUrl (configProperty 'dialogPolyfill.baseUrl')}}"}'>
2
2
  <dialog class='js-modal p-0 backdrop:bg-grey-scorpion/90 shadow-md {{defaultIfEmpty _css "sm:max-w-xl"}}'>
3
3
  <form method="dialog" class="js-dialog-content p-4">
4
4
  {{> @partial-block }}
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": "1.8.1",
9
+ "version": "1.9.1",
10
10
  "scripts": {
11
11
  "test": "echo \"Error: no test specified\" && exit 1",
12
12
  "storybook": "start-storybook -p 6006 public",
@@ -95,6 +95,7 @@
95
95
  "@tailwindcss/line-clamp": "^0.4.2",
96
96
  "alpinejs": "^3.8.1",
97
97
  "async-alpine": "^1.0.0",
98
+ "dialog-polyfill": "^0.5.6",
98
99
  "tailwindcss-counter": "^1.1.3"
99
100
  },
100
101
  "prettier": {
@@ -0,0 +1,39 @@
1
+ dialog {
2
+ position: fixed;
3
+ top: 50%;
4
+ transform: translate(0, -50%);
5
+ left: 0;
6
+ right: 0;
7
+ width: -moz-fit-content;
8
+ width: -webkit-fit-content;
9
+ width: fit-content;
10
+ height: -moz-fit-content;
11
+ height: -webkit-fit-content;
12
+ height: fit-content;
13
+ margin: auto;
14
+ padding: 1em;
15
+ background: white;
16
+ color: black;
17
+ display: block;
18
+ }
19
+
20
+ dialog:not([open]) {
21
+ display: none;
22
+ }
23
+
24
+ dialog + .backdrop {
25
+ position: fixed;
26
+ top: 0;
27
+ right: 0;
28
+ bottom: 0;
29
+ left: 0;
30
+ background: rgba(96, 96, 96, 0.9);
31
+ }
32
+
33
+ ._dialog_overlay {
34
+ position: fixed;
35
+ top: 0;
36
+ right: 0;
37
+ bottom: 0;
38
+ left: 0;
39
+ }
@@ -1,9 +1,11 @@
1
- import { hr$, listen, unlisten } from 'hrQuery'
1
+ import { hr$, listen, unlisten, addLink } from 'hrQuery'
2
2
  import { uxAction } from 'base/tracking/atiHelper.subfeature'
3
+ import dialogPolyfill from 'dialog-polyfill'
3
4
 
4
5
  const Modal = (context) => {
5
6
  const { options } = context,
6
7
  { element: rootElement } = context,
8
+ dialogPolyfillBaseUrl = options.dialogPolyfillBaseUrl || 'vendor/dialog-polyfill',
7
9
  modalTriggerId = options.modalTriggerId ? '#' + options.modalTriggerId : '',
8
10
  modalTrigger = hr$(modalTriggerId)[0],
9
11
  modalCloseTriggers = hr$('.js-modal-close', rootElement),
@@ -20,8 +22,18 @@ const Modal = (context) => {
20
22
  })
21
23
  }
22
24
 
25
+ const configurePolyfillIfNeeded = () => {
26
+ if (undefined == modal.showModal) {
27
+ addLink('dialog-polyfill-css', `${dialogPolyfillBaseUrl}/dialog-polyfill.css`, {
28
+ type: 'text/css',
29
+ rel: 'stylesheet',
30
+ })
31
+ }
32
+ dialogPolyfill.registerDialog(modal)
33
+ }
34
+
23
35
  const clickTracking = () => {
24
- console.log("tracking")
36
+ console.log('tracking')
25
37
  uxAction(trackingInformations)
26
38
  }
27
39
 
@@ -41,6 +53,7 @@ const Modal = (context) => {
41
53
  modal.close()
42
54
  }
43
55
 
56
+ configurePolyfillIfNeeded()
44
57
  configureEventListeners()
45
58
  }
46
59
 
@@ -1,4 +1,4 @@
1
- <div class="js-load" data-hr-modal='{"modalTriggerId":"{{defaultIfEmpty _trigger ""}}", "trackingInformations": "{{this.link.cmsDocument.title}} Ticketlink-Overlay ok geklickt - Dokumenten-Id: {{this.link.cmsDocument.sophoraId}}"}'>
1
+ <div class="js-load" data-hr-modal='{"modalTriggerId":"{{defaultIfEmpty _trigger ""}}", "trackingInformations": "{{this.link.cmsDocument.title}} Ticketlink-Overlay ok geklickt - Dokumenten-Id: {{this.link.cmsDocument.sophoraId}}","dialogPolyfillBaseUrl":"{{resourceUrl (configProperty 'dialogPolyfill.baseUrl')}}"}'>
2
2
  <dialog class='js-modal p-0 backdrop:bg-grey-scorpion/90 shadow-md {{defaultIfEmpty _css "sm:max-w-xl"}}'>
3
3
  <form method="dialog" class="js-dialog-content p-4">
4
4
  {{> @partial-block }}
@@ -358,6 +358,28 @@ const loadScript = function (id, scriptUrl, async, callback) {
358
358
  firstScriptTagInPage.parentNode.insertBefore(scriptTag, firstScriptTagInPage)
359
359
  }
360
360
 
361
+ const addLink = function (id, url, config) {
362
+ if (document.getElementById(id)) return
363
+
364
+ let linkTag = document.createElement('link')
365
+ linkTag.id = id
366
+ linkTag.href = url
367
+ if (config.type) {
368
+ linkTag.type = config.type
369
+ }
370
+ if (config.rel) {
371
+ linkTag.rel = config.rel
372
+ }
373
+ if (config.title) {
374
+ linkTag.title = config.title
375
+ }
376
+ if (config.as) {
377
+ linkTag.as = config.as
378
+ }
379
+
380
+ document.getElementsByTagName('head')[0].appendChild(linkTag)
381
+ }
382
+
361
383
  /*
362
384
  * Fügt ein "style" bereich zum dokument hinzu
363
385
  * und gibt eine referenz darauf zurück
@@ -445,6 +467,7 @@ const clearRequestInterval = (handle) =>
445
467
  : window.clearInterval(handle)
446
468
 
447
469
  export {
470
+ addLink,
448
471
  addStyle,
449
472
  hr$,
450
473
  stripTags,