@newlogic-digital/ui 3.0.1 → 3.1.0

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 (113) hide show
  1. package/README.md +8 -12
  2. package/gulpfile.js +16 -168
  3. package/package.json +13 -8
  4. package/src/emails/email.css +15 -9
  5. package/src/emails/email.twig +7 -7
  6. package/src/icons.svg +32 -0
  7. package/src/main.json +14 -27
  8. package/src/scripts/Components/+.js +2 -2
  9. package/src/scripts/Components/CookieConsent.js +66 -64
  10. package/src/scripts/Components/Form.js +28 -21
  11. package/src/scripts/Layout/+.js +2 -1
  12. package/src/scripts/Layout/Header.js +18 -0
  13. package/src/scripts/Layout/Main.js +49 -45
  14. package/src/scripts/Libraries/+.js +12 -10
  15. package/src/scripts/Libraries/Anchor.js +18 -43
  16. package/src/scripts/Libraries/CookieConsent.js +37 -58
  17. package/src/scripts/Libraries/Dialog.js +56 -55
  18. package/src/scripts/Libraries/Drawer.js +23 -23
  19. package/src/scripts/Libraries/NativeSlider.js +86 -86
  20. package/src/scripts/Libraries/ReCaptcha.js +20 -18
  21. package/src/scripts/Libraries/Ripple.js +16 -32
  22. package/src/scripts/Libraries/Stimulus.js +30 -34
  23. package/src/scripts/Libraries/Swup.js +47 -50
  24. package/src/scripts/Libraries/Tabs.js +12 -18
  25. package/src/scripts/Libraries/Tippy.js +118 -0
  26. package/src/scripts/Ui/+.js +5 -3
  27. package/src/scripts/Ui/Checkbox.js +19 -0
  28. package/src/scripts/Ui/Input.js +188 -161
  29. package/src/scripts/Ui/Radio.js +23 -0
  30. package/src/scripts/Ui/Select.js +64 -37
  31. package/src/scripts/Ui/Text.js +25 -0
  32. package/src/scripts/Utils/Functions/+.js +6 -6
  33. package/src/scripts/Utils/Functions/dataValue.js +28 -25
  34. package/src/scripts/Utils/Functions/importScript.js +9 -11
  35. package/src/scripts/Utils/Functions/importStyle.js +18 -5
  36. package/src/scripts/Utils/Functions/inView.js +19 -21
  37. package/src/scripts/Utils/Functions/loadStimulus.js +22 -20
  38. package/src/scripts/Utils/cdn.js +6 -4
  39. package/src/scripts/Utils/global.js +10 -33
  40. package/src/scripts/main.js +6 -6
  41. package/src/styles/Components/CookieConsent.css +40 -179
  42. package/src/styles/Components/Dialog/Default.css +12 -15
  43. package/src/styles/Components/Form/CookieConsent.css +7 -12
  44. package/src/styles/Components/Item/+.css +1 -0
  45. package/src/styles/Layout/+.css +2 -0
  46. package/src/{templates/Components/Dialogs/.gitkeep → styles/Layout/Header.css} +0 -0
  47. package/src/styles/Layout/Main.css +28 -63
  48. package/src/styles/Layout/Nav.css +43 -0
  49. package/src/styles/Libraries/+.css +1 -1
  50. package/src/styles/Libraries/Datepicker.css +85 -39
  51. package/src/styles/Libraries/Dialog.css +6 -5
  52. package/src/styles/Libraries/Drawer.css +15 -15
  53. package/src/styles/Libraries/Hint.css +29 -23
  54. package/src/styles/Libraries/Lazysizes.css +2 -1
  55. package/src/styles/Libraries/NativeSlider.css +19 -18
  56. package/src/styles/Libraries/Ripple.css +8 -5
  57. package/src/styles/Libraries/Tabs.css +4 -4
  58. package/src/styles/Libraries/Tippy.css +87 -0
  59. package/src/styles/Sections/+.css +1 -0
  60. package/src/styles/Ui/+.css +5 -1
  61. package/src/styles/Ui/Badge.css +33 -19
  62. package/src/styles/Ui/Btn.css +80 -53
  63. package/src/styles/Ui/Checkbox.css +80 -41
  64. package/src/styles/Ui/Dropdown.css +5 -0
  65. package/src/styles/Ui/Heading.css +12 -12
  66. package/src/styles/Ui/Icon.css +27 -8
  67. package/src/styles/Ui/Image.css +23 -0
  68. package/src/styles/Ui/Input.css +295 -220
  69. package/src/styles/Ui/Label.css +14 -0
  70. package/src/styles/Ui/Link.css +3 -3
  71. package/src/styles/Ui/Notice.css +14 -16
  72. package/src/styles/Ui/Progress.css +10 -21
  73. package/src/styles/Ui/Radio.css +3 -8
  74. package/src/styles/Ui/Select.css +63 -112
  75. package/src/styles/Ui/Switch.css +70 -0
  76. package/src/styles/Ui/{Wsw.css → Text.css} +61 -80
  77. package/src/styles/Ui/Title.css +8 -4
  78. package/src/styles/Utils/default.css +75 -67
  79. package/src/styles/Utils/icons.css +9 -0
  80. package/src/styles/Utils/keyframes.css +182 -0
  81. package/src/styles/Utils/normalize.css +223 -0
  82. package/src/styles/Utils/print.css +1 -0
  83. package/src/styles/Utils/tailwind/base.css +15 -0
  84. package/src/styles/Utils/tailwind/gutters.css +264 -263
  85. package/src/styles/Utils/theme/main.css +24 -21
  86. package/src/styles/Utils/vars.css +58 -35
  87. package/src/styles/Utils/vendor.css +1 -2
  88. package/src/styles/main.css +6 -3
  89. package/src/styles/tailwind.css +1 -4
  90. package/src/templates/Components/CookieConsent.twig +30 -0
  91. package/src/templates/Components/Dialogs/Basic.twig +7 -3
  92. package/src/templates/Layout/Header.twig +42 -0
  93. package/src/templates/Layout/Main.twig +47 -64
  94. package/src/templates/Sections/Gdpr.twig +64 -0
  95. package/src/templates/Sections/Ui.twig +2104 -0
  96. package/src/templates/dialog-basic.twig +2 -2
  97. package/src/templates/gdpr.json +11 -0
  98. package/src/templates/index.json +8 -2
  99. package/src/templates/json-tippy.twig +16 -0
  100. package/src/templates/ui.json +11 -0
  101. package/CHANGELOG +0 -231
  102. package/src/icons/selection.json +0 -1
  103. package/src/icons/style.css +0 -171
  104. package/src/icons/variables.css +0 -31
  105. package/src/scripts/Ui/Wsw.js +0 -25
  106. package/src/scripts/Utils/Functions/bodyLoaded.js +0 -12
  107. package/src/styles/Libraries/Animate.css +0 -184
  108. package/src/styles/Utils/reference.css +0 -2
  109. package/src/styles/Utils/tailwind/content.css +0 -24
  110. package/src/styles/Utils/theme/vars.css +0 -19
  111. package/src/styles/preload.css +0 -29
  112. package/src/templates/Layout/Preload.twig +0 -21
  113. package/src/templates/Sections/.gitkeep +0 -0
@@ -1,82 +1,79 @@
1
- import Swup from 'swup';
2
- import {LibStimulus, loadStimulus} from "./Stimulus.js";
3
- import LibAnchor from "./Anchor.js";
4
- import LibDialog from "./Dialog.js";
5
- import LibCookieConsent from "./CookieConsent.js";
1
+ import Swup from 'swup'
2
+ import { getController, loadStimulus } from './Stimulus.js'
3
+ import LibAnchor from './Anchor.js'
4
+ import LibDialog from './Dialog.js'
5
+ import LibCookieConsent from './CookieConsent.js'
6
6
 
7
7
  const LibSwup = new Swup({
8
- containers: ['#l-main'],
9
- linkSelector: `a[href^="${window.location.origin}"]:not([data-no-swup]):not([target="_blank"]), a[href^="/"]:not([data-no-swup]):not([target="_blank"]), a[href^="#"]:not([data-no-swup])`
10
- });
8
+ containers: ['#l-main', '#l-header'].filter(element => document.querySelector(element)),
9
+ linkSelector: `:is(a[href^="${window.location.origin}"], a[href^="/"]):not([data-no-swup], [data-naja], [target="_blank"])`
10
+ })
11
11
 
12
- LibSwup.on('clickLink', () => {
13
- document.body.classList.remove("is-overflow-hidden");
12
+ LibSwup.on('clickLink', async() => {
13
+ document.body.classList.remove('overflow-hidden')
14
14
 
15
- if (document.querySelector(".is-lib-drawer-active") !== null) {
16
- LibStimulus.getController(document.body, "lib-drawer").hide()
15
+ if (document.querySelector('.lib-drawer[data-state~="active"]') !== null) {
16
+ getController(document.body, 'lib-drawer').hide()
17
17
  }
18
18
 
19
- if (document.querySelector(".lib-dialog") !== null) {
20
- LibDialog.hide();
19
+ if (document.querySelector('.lib-dialog') !== null) {
20
+ await LibDialog.hide()
21
21
  }
22
- });
22
+ })
23
23
 
24
24
  LibSwup.on('animationOutDone', () => {
25
- window.scrollTo(0, 0);
26
- });
25
+ document.documentElement.scroll({ top: 0, behavior: 'instant' })
26
+ })
27
27
 
28
28
  LibSwup.on('contentReplaced', () => {
29
- const content = new DOMParser().parseFromString(LibSwup.cache["getCurrentPage"]().originalContent, "text/html");
29
+ const content = new DOMParser().parseFromString(LibSwup.cache.getCurrentPage().originalContent, 'text/html')
30
30
 
31
- [...content.head.querySelectorAll("[data-lib-swup-replace]")].forEach(element => {
32
- let tag = document.querySelector(`[data-lib-swup-replace=${element.dataset.libSwupReplace}]`);
31
+ content.head.querySelectorAll('[data-lib-swup-replace]').forEach(element => {
32
+ const tag = document.querySelector(`[data-lib-swup-replace=${element.dataset.libSwupReplace}]`)
33
33
 
34
34
  if (tag !== null) {
35
35
  tag.outerHTML = element.outerHTML
36
36
  } else {
37
- document.head.insertAdjacentHTML("beforeend", element.outerHTML);
37
+ document.head.insertAdjacentHTML('beforeend', element.outerHTML)
38
38
  }
39
- });
39
+ })
40
40
 
41
- LibSwup.options.containers.forEach((selector) => {
42
- loadStimulus(document.querySelector(selector));
43
- });
41
+ LibAnchor.init()
44
42
 
45
- LibAnchor.init();
43
+ LibSwup.options.containers.forEach(selector => {
44
+ loadStimulus(document.querySelector(selector))
45
+ })
46
46
 
47
- if (typeof window.fbq !== "undefined") {
48
- window.fbq('track', 'PageView');
47
+ if (typeof window.fbq !== 'undefined') {
48
+ window.fbq('track', 'PageView')
49
49
  }
50
50
 
51
- if (typeof gtag !== "undefined") {
52
- let configs = [];
53
- window.dataLayer.forEach(function (config) {
54
- if (config[0] === "config") {
55
- if (typeof config[1] !== "undefined" && !configs.includes(config[1])) {
56
- configs.push(config[1]);
51
+ if (typeof gtag !== 'undefined') {
52
+ const configs = []
53
+ window.dataLayer.forEach(function(config) {
54
+ if (config[0] === 'config') {
55
+ if (typeof config[1] !== 'undefined' && !configs.includes(config[1])) {
56
+ configs.push(config[1])
57
57
  window.gtag('config', config[1], {
58
- 'page_title': document.title,
59
- 'page_path': window.location.pathname + window.location.search
60
- });
58
+ page_title: document.title,
59
+ page_path: window.location.pathname + window.location.search
60
+ })
61
61
  }
62
62
  }
63
- });
63
+ })
64
64
  }
65
65
 
66
- if (typeof window.dataLayer !== "undefined") {
66
+ if (typeof window.dataLayer !== 'undefined') {
67
67
  window.dataLayer.push({
68
- 'event': 'VirtualPageview',
69
- 'virtualPageURL': window.location.pathname + window.location.search,
70
- 'virtualPageTitle': document.title
71
- });
68
+ event: 'VirtualPageview',
69
+ virtualPageURL: window.location.pathname + window.location.search,
70
+ virtualPageTitle: document.title
71
+ })
72
72
  }
73
73
 
74
- if (typeof LibCookieConsent !== "undefined") {
75
- LibCookieConsent.init();
74
+ if (typeof LibCookieConsent !== 'undefined') {
75
+ LibCookieConsent.init()
76
76
  }
77
+ })
77
78
 
78
- document.body.classList.remove("is-body-preload");
79
- document.body.classList.add("is-body-loaded");
80
- });
81
-
82
- export default LibSwup;
79
+ export default LibSwup
@@ -1,22 +1,16 @@
1
- const LibTabs = function (element, callback) {
2
- [...element.querySelector(`[data-lib-tabs-nav]`).querySelectorAll(`[data-lib-tabs-item="nav"]`)].forEach((selector, index) => {
3
- selector.addEventListener("click", e => {
4
- e.preventDefault();
1
+ export default function LibTabs(element) {
2
+ element.querySelector('[data-lib-tabs-nav]').querySelectorAll('[data-lib-tabs-item="nav"]').forEach((selector, index) => {
3
+ selector.addEventListener('click', e => {
4
+ e.preventDefault()
5
5
 
6
- [...selector.closest(`[data-lib-tabs-nav]`).querySelectorAll(`[data-lib-tabs-item="nav"]`)].forEach(elm => elm._removeDataValue("state", "active"));
7
- selector._addDataValue("state", "active");
6
+ selector.closest('[data-lib-tabs-nav]').querySelectorAll('[data-lib-tabs-item="nav"]').forEach(elm => elm._removeDataValue('state', 'active'))
7
+ selector._addDataValue('state', 'active')
8
8
 
9
- [...element.querySelector(`[data-lib-tabs-area]`).children].forEach(elm => {
10
- elm._removeDataValue("state", "active");
11
- });
9
+ ;[...element.querySelector('[data-lib-tabs-area]').children].forEach(elm => {
10
+ elm._removeDataValue('state', 'active')
11
+ })
12
12
 
13
- element.querySelector(`[data-lib-tabs-area]`).children[index]._addDataValue("state", "active");
14
-
15
- if (callback) {
16
- callback(index);
17
- }
13
+ element.querySelector('[data-lib-tabs-area]').children[index]._addDataValue('state', 'active')
18
14
  })
19
- });
20
- };
21
-
22
- export default LibTabs;
15
+ })
16
+ }
@@ -0,0 +1,118 @@
1
+ import { loadStimulus, importStyle } from '../Utils/Functions/+.js'
2
+ import cdn from '../Utils/cdn.js'
3
+
4
+ export default class LibTippy {
5
+ async init(element, options, template) {
6
+ const tippy = (await import('tippy.js')).default
7
+ const { roundArrow } = await import('tippy.js')
8
+
9
+ await importStyle(cdn.tippy)
10
+
11
+ if (typeof element._tippy !== 'undefined') {
12
+ return false
13
+ }
14
+
15
+ if (this.type.includes('dropdown')) {
16
+ this.options.placement = 'bottom-end'
17
+ this.options.arrow = false
18
+ this.options.maxWidth = 'none'
19
+ }
20
+
21
+ if (this.type.includes('arrow')) {
22
+ options.arrow = roundArrow
23
+ }
24
+
25
+ if (!template.startsWith('/')) {
26
+ if (template !== '') {
27
+ options.content = document.querySelector('#' + template).innerHTML
28
+ } else {
29
+ options.content = `
30
+ <div class="ui-dropdown">
31
+ <div class="wrp_dropdown_body">
32
+ ${element.getAttribute('aria-label')}
33
+ </div>
34
+ </div>
35
+ `
36
+ }
37
+ }
38
+
39
+ if (typeof element.dataset.libTippySlot !== 'undefined') {
40
+ for (const [key, value] of Object.entries(JSON.parse(element.dataset.libTippySlot))) {
41
+ options.content = options.content.replaceAll(`{${key}}`, value).replaceAll(`%7B${key}%7B`, value)
42
+ }
43
+ }
44
+
45
+ tippy(element, options)
46
+ }
47
+
48
+ constructor(element, attributes = ['tooltip', '']) {
49
+ const self = this
50
+
51
+ this.options = {
52
+ content: '',
53
+ placement: 'bottom',
54
+ trigger: 'mouseenter focus',
55
+ interactive: true,
56
+ appendTo: 'parent',
57
+ arrow: false,
58
+ theme: 'light-border',
59
+ animation: 'scale',
60
+ inertia: true,
61
+ allowHTML: true,
62
+ onShow: (instance) => {
63
+ let name = this.template
64
+
65
+ if (this.type.includes('-full')) {
66
+ instance.popper.classList.add('is-full')
67
+ document.documentElement.classList.add('m:is-body-overlay')
68
+ }
69
+
70
+ if (typeof name === 'undefined') {
71
+ name = this.type
72
+ }
73
+
74
+ instance.popper.querySelector('.tippy-box').setAttribute('data-name', name)
75
+
76
+ loadStimulus(instance.popper.querySelector('.tippy-content'))
77
+ },
78
+ onHide: () => {
79
+ if (this.type.includes('-full')) {
80
+ setTimeout(() => document.documentElement.classList.remove('m:is-body-overlay'), 50)
81
+ }
82
+ }
83
+ }
84
+
85
+ this.type = attributes[0]
86
+ this.template = attributes[1]
87
+
88
+ if (this.type.includes('dropdown')) {
89
+ this.options.trigger = 'click'
90
+ }
91
+
92
+ if (typeof element.dataset.tippyTrigger !== 'undefined') {
93
+ this.options.trigger = element.dataset.tippyTrigger
94
+ }
95
+
96
+ this.options.showOnCreate = true
97
+
98
+ this.options.trigger !== 'manual' && this.options.trigger.split(' ').forEach(event => {
99
+ element.addEventListener(event, async function e() {
100
+ if (self.template.startsWith('/') && self.options.content === '') {
101
+ element.style.cursor = 'wait'
102
+
103
+ fetch(self.template, { headers: { 'X-Requested-With': 'XMLHttpRequest' } }).then(response => {
104
+ return response.json()
105
+ }).then(async(data) => {
106
+ self.options.content = data.content
107
+ element.style.cursor = ''
108
+ await self.init(element, self.options, self.template)
109
+ element.removeEventListener(event, e)
110
+ })
111
+ } else {
112
+ await self.init(element, self.options, self.template)
113
+ element.removeEventListener(event, e)
114
+ }
115
+ })
116
+ })
117
+ }
118
+ }
@@ -1,3 +1,5 @@
1
- import './Input.js';
2
- import './Select.js';
3
- import './Wsw.js';
1
+ import './Checkbox.js'
2
+ import './Input.js'
3
+ import './Radio.js'
4
+ import './Select.js'
5
+ import './Text.js'
@@ -0,0 +1,19 @@
1
+ import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
2
+
3
+ LibStimulus.register('ui-checkbox', class extends Controller {
4
+ validate(element) {
5
+ element.parentNode._removeDataValue('state', 'valid invalid')
6
+
7
+ if (element.checkValidity()) {
8
+ element.parentNode._addDataValue('state', 'valid')
9
+ } else {
10
+ element.parentNode._addDataValue('state', 'invalid')
11
+ }
12
+ }
13
+
14
+ connect() {
15
+ const input = this.element.querySelector('input:not([type="hidden"])')
16
+
17
+ input.addEventListener('change', () => this.validate(input))
18
+ }
19
+ })