@newlogic-digital/ui 3.5.0 → 3.7.5

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 (138) hide show
  1. package/README.md +11 -1
  2. package/package.json +29 -22
  3. package/src/data/main.json +23 -8
  4. package/src/emails/styles/main/+.css +3 -0
  5. package/src/emails/styles/main/Base/+.css +2 -0
  6. package/src/emails/styles/main/Base/config.css +22 -0
  7. package/src/emails/styles/main/Components/+.css +1 -0
  8. package/src/emails/styles/main/Components/Card.css +12 -0
  9. package/src/emails/styles/main/Ui/+.css +3 -0
  10. package/src/emails/styles/main/Ui/Btn.css +78 -0
  11. package/src/emails/styles/main/Ui/Heading.css +8 -0
  12. package/src/emails/styles/main/Ui/Text.css +12 -0
  13. package/src/emails/styles/main.css +92 -0
  14. package/src/emails/templates.test/Layout.latte +16 -4
  15. package/src/emails/templates.test/Sections/Footer.latte +22 -0
  16. package/src/emails/templates.test/Sections/Header.latte +37 -0
  17. package/src/emails/templates.test/Sections/Text.latte +24 -0
  18. package/src/icons.svg +28 -28
  19. package/src/scripts/Components/+.js +2 -1
  20. package/src/scripts/Components/Drawer.js +60 -0
  21. package/src/scripts/Components/Popover.js +65 -0
  22. package/src/scripts/Layout/+.js +0 -1
  23. package/src/scripts/Layout/Header.js +14 -26
  24. package/src/scripts/Libraries/+.js +3 -5
  25. package/src/scripts/Libraries/CookieConsent.js +65 -52
  26. package/src/scripts/Libraries/Dialog.js +19 -38
  27. package/src/scripts/Libraries/Form.js +6 -19
  28. package/src/scripts/Libraries/Naja.js +22 -18
  29. package/src/scripts/Libraries/ReCaptcha.js +9 -26
  30. package/src/scripts/Libraries/Reveal.js +32 -0
  31. package/src/scripts/Libraries/Ripple.js +3 -3
  32. package/src/scripts/Libraries/Stimulus.js +50 -5
  33. package/src/scripts/Libraries/Swup.js +44 -59
  34. package/src/scripts/Libraries/Toaster.js +55 -0
  35. package/src/scripts/Ui/Check.js +3 -3
  36. package/src/scripts/Ui/Control.js +42 -34
  37. package/src/scripts/Ui/ControlSelect.js +6 -5
  38. package/src/scripts/Ui/Text.js +6 -6
  39. package/src/scripts/Utils/+.js +3 -3
  40. package/src/scripts/Utils/cdn.js +0 -1
  41. package/src/scripts/Utils/initAfter.js +11 -0
  42. package/src/scripts/Utils/naja.js +41 -0
  43. package/src/scripts/Utils/utilities.js +8 -0
  44. package/src/scripts/main.js +2 -1
  45. package/src/styles/Components/+.css +3 -2
  46. package/src/styles/Components/Dialog/+.css +2 -0
  47. package/src/styles/Components/Dialog/Content.css +2 -0
  48. package/src/styles/Components/Dialog/CookieConsent.css +17 -0
  49. package/src/styles/Components/Dialog/Default.css +2 -26
  50. package/src/styles/Components/Drawer.css +18 -0
  51. package/src/styles/Components/Field.css +1 -1
  52. package/src/styles/Components/Popover.css +1 -0
  53. package/src/styles/Components/Toaster.css +2 -0
  54. package/src/styles/Layout/Header.css +7 -39
  55. package/src/styles/Layout/Main.css +9 -6
  56. package/src/styles/Layout/Nav.css +6 -30
  57. package/src/styles/Libraries/+.css +0 -5
  58. package/src/styles/Ui/+.css +0 -1
  59. package/src/styles/Ui/Badge.css +1 -0
  60. package/src/styles/Ui/Btn.css +6 -5
  61. package/src/styles/Ui/Check.css +1 -1
  62. package/src/styles/Ui/Control.css +14 -4
  63. package/src/styles/Ui/ControlSelect.css +10 -19
  64. package/src/styles/Ui/Group.css +1 -1
  65. package/src/styles/Ui/Heading.css +1 -0
  66. package/src/styles/Ui/Image.css +1 -1
  67. package/src/styles/Ui/Info.css +1 -1
  68. package/src/styles/Ui/Label.css +1 -1
  69. package/src/styles/Ui/Link.css +7 -1
  70. package/src/styles/Ui/Notice.css +9 -1
  71. package/src/styles/Ui/Progress.css +1 -1
  72. package/src/styles/Ui/Switch.css +1 -1
  73. package/src/styles/Ui/Text.css +1 -8
  74. package/src/styles/Ui/Title.css +1 -4
  75. package/src/styles/Utils/+.css +1 -3
  76. package/src/styles/Utils/config.css +14 -3
  77. package/src/styles/Utils/default.css +11 -4
  78. package/src/styles/Utils/theme/+.css +1 -1
  79. package/src/styles/Utils/theme/main.css +27 -13
  80. package/src/styles/Utils/utilities.css +42 -0
  81. package/src/styles/main.css +1 -4
  82. package/src/templates/Components/Dialog/Basic.latte +24 -0
  83. package/src/templates/Components/Dialog/CookieConsent.latte +27 -0
  84. package/src/templates/Components/Form/CookieConsent.latte +47 -0
  85. package/src/templates/Layout/Header.latte +31 -33
  86. package/src/templates/Layout/Main.latte +39 -28
  87. package/src/templates/Sections/CookieConsent.latte +69 -0
  88. package/src/templates/Sections/Site.latte +80 -8
  89. package/src/templates/Sections/Text.latte +64 -0
  90. package/src/templates/Sections/Ui/Docs/@intro.html +5 -5
  91. package/src/templates/Sections/Ui/Docs/@nav.html +50 -60
  92. package/src/templates/Sections/Ui/Docs/@styles.html +1 -1
  93. package/src/templates/Sections/Ui/Docs/Default.latte +86 -166
  94. package/src/templates/Sections/Ui/Icons.html +1 -1
  95. package/src/templates/Sections/Ui/Intro.html +33 -79
  96. package/src/templates/Ui/ControlDate.latte +1 -1
  97. package/src/templates/Ui/ControlTime.latte +1 -1
  98. package/src/views/dialog/basic.json.latte +1 -1
  99. package/src/views/email/email.latte +2 -2
  100. package/src/views/email/email.test.latte +2 -2
  101. package/src/views/gdpr.json +6 -4
  102. package/src/views/popover/info.json.latte +15 -0
  103. package/vite.config.js +17 -10
  104. package/src/emails/styles/email.css +0 -77
  105. package/src/emails/templates.test/Content.latte +0 -24
  106. package/src/emails/templates.test/Header.latte +0 -14
  107. package/src/scripts/Components/CookieConsent.js +0 -78
  108. package/src/scripts/Layout/Main.js +0 -50
  109. package/src/scripts/Libraries/Drawer.js +0 -42
  110. package/src/scripts/Libraries/Script.js +0 -18
  111. package/src/scripts/Libraries/Slider.js +0 -160
  112. package/src/scripts/Libraries/Tippy.js +0 -117
  113. package/src/scripts/Utils/Functions/+.js +0 -7
  114. package/src/scripts/Utils/Functions/importScript.js +0 -17
  115. package/src/scripts/Utils/Functions/importStyle.js +0 -18
  116. package/src/scripts/Utils/Functions/inputStep.js +0 -9
  117. package/src/scripts/Utils/Functions/inputValidity.js +0 -57
  118. package/src/scripts/Utils/Functions/loadStimulus.js +0 -42
  119. package/src/scripts/Utils/Functions/replaceScript.js +0 -4
  120. package/src/scripts/Utils/Functions/replaceTag.js +0 -8
  121. package/src/scripts/Utils/global.js +0 -15
  122. package/src/styles/Components/CookieConsent.css +0 -68
  123. package/src/styles/Components/Dropdown/+.css +0 -1
  124. package/src/styles/Components/Dropdown/Default.css +0 -8
  125. package/src/styles/Libraries/Dialog.css +0 -1
  126. package/src/styles/Libraries/Drawer.css +0 -64
  127. package/src/styles/Libraries/Hint.css +0 -186
  128. package/src/styles/Libraries/Ripple.css +0 -1
  129. package/src/styles/Libraries/Tippy.css +0 -73
  130. package/src/styles/Ui/Dot.css +0 -22
  131. package/src/styles/Utils/icons.css +0 -5
  132. package/src/styles/Utils/tailwind.css +0 -50
  133. package/src/templates/Components/CookieConsent.latte +0 -28
  134. package/src/templates/Components/Dialogs/Basic.latte +0 -22
  135. package/src/templates/Components/Items/.gitkeep +0 -0
  136. package/src/templates/Sections/Gdpr.latte +0 -127
  137. package/src/views/dropdown/tippy.json.latte +0 -19
  138. /package/src/{styles/Utils/print.css → emails/styles/main/Base/font.css} +0 -0
@@ -1,55 +1,25 @@
1
+ import { dialogSelector } from 'winduum/src/components/dialog/index.js'
2
+ import { delegateController } from './Stimulus.js'
1
3
  import Swup from 'swup'
2
- import { closeDialog } from 'winduum/src/libraries/dialog.js'
3
- import { hideTippy } from './Tippy.js'
4
- import { getController, loadStimulus } from './Stimulus.js'
5
- import LibCookieConsent from './CookieConsent.js'
6
- import { replaceTag, replaceScript } from '../Utils/Functions/+.js'
7
-
8
- document.addEventListener('click', ({ target }) => {
9
- const noSwup = target.closest('[data-no-swup]')
10
-
11
- if (!noSwup) {
12
- return
13
- }
14
-
15
- if (noSwup.classList.contains('ui-btn')) {
16
- noSwup.classList.add('loading')
17
- } else {
18
- noSwup.classList.add('cursor-wait')
19
- }
20
- })
4
+ import initAfter from '../Utils/initAfter.js'
21
5
 
22
6
  const LibSwup = new Swup({
23
- containers: ['#l-main', '#l-header'].filter(element => document.querySelector(element)),
24
- linkSelector: `:is(a[href^="${window.location.origin}"], a[href^="/"]):not([data-no-swup], [data-naja], [target="_blank"])`
7
+ containers: ['.l-main', '.l-header'].filter(element => document.querySelector(element)),
8
+ ignoreVisit: (url, { el }) => el?.closest('[data-no-swup], [data-naja]'),
9
+ animationSelector: '.swup-transition'
25
10
  })
26
11
 
27
- LibSwup.on('clickLink', async ({ target }) => {
12
+ LibSwup.hooks.on('animation:out:start', async () => {
28
13
  document.body.classList.remove('overflow-hidden')
29
14
 
30
- const LibDrawerSelector = document.querySelector('.lib-drawer.active')
31
- const LibDialogSelector = document.querySelector('.lib-dialog')
32
-
33
- hideTippy()
34
-
35
- if (LibDrawerSelector) {
36
- /** @type {LibDrawer} */
37
- const LibDrawer = getController(LibDrawerSelector, 'lib-drawer')
38
-
39
- LibDrawer.hide()
40
- }
41
-
42
- if (LibDialogSelector) {
43
- await closeDialog(LibDialogSelector)
44
- }
45
-
46
- if (window.location.href === target.closest('a').href) {
47
- document.documentElement.scroll({ top: 0, behavior: 'smooth' })
48
- }
15
+ delegateController('c-drawer', 'close')
16
+ delegateController('lib-dialog', 'close', {
17
+ currentTarget: dialogSelector('.c-dialog')
18
+ }, 'body')
49
19
  })
50
20
 
51
- LibSwup.on('animationOutDone', () => {
52
- document.documentElement.scroll({ top: 0, behavior: 'instant' })
21
+ LibSwup.hooks.before('scroll:top', (visit, { options }) => {
22
+ if (visit.from.url !== visit.to.url) (options.behavior = 'instant')
53
23
  })
54
24
 
55
25
  /** @var {Array} dataLayer */
@@ -59,34 +29,49 @@ LibSwup.on('animationOutDone', () => {
59
29
  /** @var {Object} retargetingConf */
60
30
  /** @var {Object} conversionConf */
61
31
  /** @var {Function} fbq */
62
- LibSwup.on('contentReplaced', () => {
63
- const content = new DOMParser().parseFromString(LibSwup.cache.getCurrentPage().originalContent, 'text/html')
64
-
65
- replaceTag(content)
32
+ LibSwup.hooks.on('content:replace', (visit, { page }) => {
33
+ const content = new DOMParser().parseFromString(page.html, 'text/html')
66
34
 
67
- if (window.location.hash) {
68
- document.documentElement.scroll({ top: document.querySelector(`${window.location.hash}`)?.offsetTop, behavior: 'smooth' })
69
- }
35
+ content.querySelectorAll('[data-lib-replace-tag]').forEach((element) => {
36
+ const replaceTag = document.querySelector(`[data-lib-replace-tag="${element.dataset.libReplaceTag}"]`)
37
+ const placement = element.closest('head') ? document.head : replaceTag.parentElement
70
38
 
71
- LibCookieConsent.init()
39
+ replaceTag ? (replaceTag.outerHTML = element.outerHTML) : placement.insertAdjacentHTML('beforeend', element.outerHTML)
40
+ })
72
41
 
73
- LibSwup.options.containers.forEach(selector => {
74
- loadStimulus(document.querySelector(selector))
75
- replaceScript(document.querySelector(selector))
42
+ LibSwup.options.containers.forEach((selector) => {
43
+ initAfter(document.querySelector(selector))
76
44
  })
77
45
 
78
46
  window.dataLayer && window.dataLayer.push({
79
47
  event: 'page_view'
80
48
  })
81
49
 
82
- window.rc?.retargetingHit && window.rc.retargetingHit(window.retargetingConf)
83
- window.rc?.conversionHit && window.rc.conversionHit(window.conversionConf)
50
+ window.rc?.retargetingHit && window.rc.retargetingHit(window.retargetingConf ?? {})
51
+ window.rc?.conversionHit && window.rc.conversionHit(window.conversionConf ?? {})
84
52
 
85
53
  window.fbq && window.fbq('track', 'PageView')
86
54
  })
87
55
 
88
- LibSwup.options.cache && setInterval(() => {
89
- LibSwup.cache.empty()
90
- }, 90 * 1000)
56
+ LibSwup.hooks.on('cache:set', (visit, { page }) => {
57
+ LibSwup.cache.update(page.url, { created: Date.now(), ttl: 1000 * 60 })
58
+ })
59
+
60
+ LibSwup.hooks.before('page:load', () => {
61
+ // noinspection JSCheckFunctionSignatures
62
+ LibSwup.cache.prune((url, { created, ttl }) => Date.now() > created + ttl)
63
+ })
64
+
65
+ document.addEventListener('click', ({ target }) => {
66
+ const noSwup = target.closest('[data-no-swup]')
67
+
68
+ if (!noSwup) return
69
+
70
+ if (noSwup.classList.contains('ui-btn')) {
71
+ noSwup.classList.add('loading')
72
+ } else {
73
+ noSwup.classList.add('cursor-wait')
74
+ }
75
+ })
91
76
 
92
77
  export default LibSwup
@@ -0,0 +1,55 @@
1
+ import { Controller, LibStimulus } from '../Libraries/Stimulus.js'
2
+
3
+ export const insertToaster = async (element, options) => {
4
+ if (!document.querySelector('.c-toaster')) {
5
+ element.insertAdjacentHTML('beforeend', `<ol class="c-toaster ${options?.classes ?? ''}" data-lib-toaster-target="toaster"></ol>`)
6
+ }
7
+ }
8
+
9
+ export const insertToast = async (element, options) => {
10
+ const { showToast } = await import('winduum/src/components/toaster/index.js')
11
+
12
+ element.insertAdjacentHTML('beforeend', `
13
+ <li class="c-toast ${options.classes ?? ''}" role="status" aria-live="assertive" aria-atomic="true" data-controller="c-toast">
14
+ <div class="c-toast-content border-main/10">
15
+ <div class="flex-col gap-0.5">
16
+ <div class="ui-title empty:hidden">${options.title ?? ''}</div>
17
+ <div class="ui-title sm font-normal empty:hidden text-main/70">${options.text ?? ''}</div>
18
+ </div>
19
+ <button class="ui-btn sm circle muted ml-auto accent-main -mr-1" data-action="c-toast#close">
20
+ <svg class="size-4">
21
+ <use href="#icon-x-mark"></use>
22
+ </svg>
23
+ </button>
24
+ </div>
25
+ </li>
26
+ `)
27
+
28
+ await showToast(element.children[element.children.length - 1], {
29
+ autoHide: false,
30
+ ...options?.show
31
+ })
32
+ }
33
+
34
+ LibStimulus.register('lib-toaster', class extends Controller {
35
+ static targets = ['toaster', 'show']
36
+
37
+ async show({ params }) {
38
+ await insertToaster(document.querySelector('dialog[open]') || document.body)
39
+ await insertToast(this.toasterTarget, params)
40
+ }
41
+
42
+ async showTargetConnected(element) {
43
+ await this.show({
44
+ params: JSON.parse(element.innerHTML)
45
+ })
46
+ }
47
+ })
48
+
49
+ LibStimulus.register('c-toast', class extends Controller {
50
+ async close() {
51
+ const { closeToast } = await import('winduum/src/components/toaster/index.js')
52
+
53
+ await closeToast(this.element)
54
+ }
55
+ })
@@ -1,8 +1,8 @@
1
1
  import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
2
- import { inputValidity } from '../Utils/Functions/+.js'
2
+ import { validateField } from 'winduum/src/components/form/index.js'
3
3
 
4
4
  LibStimulus.register('ui-check', class extends Controller {
5
- validity ({ currentTarget }) {
6
- inputValidity(currentTarget)
5
+ async validate({ currentTarget }) {
6
+ validateField(currentTarget)
7
7
  }
8
8
  })
@@ -1,6 +1,7 @@
1
1
  import cdn from '../Utils/cdn.js'
2
2
  import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
3
- import { importStyle, inputStep, inputValidity } from '../Utils/Functions/+.js'
3
+ import { importStyle } from '@newlogic-digital/utils-js'
4
+ import { validateField } from 'winduum/src/components/form/index.js'
4
5
 
5
6
  LibStimulus.register('ui-control', class extends Controller {
6
7
  static targets = ['number']
@@ -16,10 +17,10 @@ LibStimulus.register('ui-control', class extends Controller {
16
17
  }
17
18
  }
18
19
 
19
- async connect () {
20
- inputValidity(this.element, { validate: false })
20
+ async connect() {
21
+ validateField(this.element, { validate: false })
21
22
 
22
- this.element.addEventListener('change', () => inputValidity(this.element))
23
+ this.element.addEventListener('change', () => validateField(this.element))
23
24
 
24
25
  if (this.element.querySelector('select')) {
25
26
  return
@@ -32,7 +33,7 @@ LibStimulus.register('ui-control', class extends Controller {
32
33
  await this.typeColor()
33
34
  }
34
35
 
35
- async typeDate () {
36
+ async typeDate() {
36
37
  const input = this.element.querySelector('[type^="date"], [type="month"]')
37
38
 
38
39
  if (input) {
@@ -44,13 +45,14 @@ LibStimulus.register('ui-control', class extends Controller {
44
45
  const timepicker = input.type === 'datetime-local'
45
46
  const monthView = input.type === 'month'
46
47
  ? {
47
- view: 'months',
48
- minView: 'months',
49
- dateFormat: 'MMMM yyyy',
50
- altFieldDateFormat: 'yyyy-MM'
51
- }
48
+ view: 'months',
49
+ minView: 'months',
50
+ dateFormat: 'MMMM yyyy',
51
+ altFieldDateFormat: 'yyyy-MM'
52
+ }
52
53
  : {}
53
- const attributes = [...input.attributes].filter(({ name }) => name !== 'type').map(({ name, value }) => `${name}="${value}"`).join(' ')
54
+
55
+ const attributes = [...input.attributes].filter(({ name }) => name.match(/(required|placeholder)/)).map(({ name, value }) => `${name}="${value}"`).join(' ')
54
56
 
55
57
  input.setAttribute('type', 'hidden')
56
58
 
@@ -58,7 +60,11 @@ LibStimulus.register('ui-control', class extends Controller {
58
60
 
59
61
  const inputText = this.element.querySelector('[type="text"]')
60
62
 
61
- inputText.addEventListener('keydown', e => {
63
+ if (input.id) {
64
+ inputText.id = input.id + '-datepicker'
65
+ }
66
+
67
+ inputText.addEventListener('keydown', (e) => {
62
68
  const key = e.key.toLowerCase()
63
69
 
64
70
  if (key !== 'backspace' && key !== 'tab') {
@@ -92,19 +98,19 @@ LibStimulus.register('ui-control', class extends Controller {
92
98
  }
93
99
  },
94
100
  onShow: () => {
95
- this.datepicker.$datepicker.querySelectorAll('.air-datepicker-button').forEach(element => {
101
+ this.datepicker.$datepicker.querySelectorAll('.air-datepicker-button').forEach((element) => {
96
102
  element.setAttribute('type', 'button')
97
103
  element.setAttribute('tabindex', '-1')
98
104
  })
99
105
  },
100
106
  onSelect: ({ date }) => {
101
- inputText.dispatchEvent(new Event('change', { bubbles: true }))
107
+ input.dispatchEvent(new Event('change', { bubbles: true }))
102
108
  }
103
109
  })
104
110
  }
105
111
  }
106
112
 
107
- async typeColor () {
113
+ async typeColor() {
108
114
  if (this.element.querySelector('[type="color"]') !== null) {
109
115
  const Pickr = (await import('@simonwep/pickr')).default
110
116
  const input = this.element.querySelector('input')
@@ -116,7 +122,7 @@ LibStimulus.register('ui-control', class extends Controller {
116
122
  input.setAttribute('maxlength', '9')
117
123
  input.setAttribute('pattern', '^#?([a-fA-F0-9]{8}|[a-fA-F0-9]{6}|[a-fA-F0-9]{3})$')
118
124
 
119
- this.element.insertAdjacentHTML('afterbegin', '<div class="icon-l"><div class="color"></div></div>')
125
+ this.element.insertAdjacentHTML('afterbegin', '<div class="me-auto"><div class="color"></div></div>')
120
126
 
121
127
  const pickr = new Pickr({
122
128
  el: input,
@@ -133,12 +139,12 @@ LibStimulus.register('ui-control', class extends Controller {
133
139
  input: true
134
140
  }
135
141
  }
136
- }).on('init', pickr => {
142
+ }).on('init', (pickr) => {
137
143
  pickr.setColor(input.value)
138
- }).on('change', color => {
144
+ }).on('change', (color) => {
139
145
  input.value = color.toHEXA().toString()
140
146
  this.element.querySelector('.color').style['background-color'] = color.toHEXA().toString()
141
- }).on('hide', pickr => {
147
+ }).on('hide', (pickr) => {
142
148
  pickr.applyColor()
143
149
  input.dispatchEvent(new Event('change', { bubbles: true }))
144
150
  })
@@ -149,38 +155,40 @@ LibStimulus.register('ui-control', class extends Controller {
149
155
  }
150
156
  }
151
157
 
152
- typeNumber () {
158
+ typeNumber() {
153
159
  if (this.element.querySelector('[type="number"]') && !this.hasNumberTarget) {
154
- if (!this.element.querySelector('.icon-r')) {
155
- this.element.insertAdjacentHTML('beforeend', '<div class="icon-r"></div>')
160
+ if (!this.element.querySelector('.ms-auto')) {
161
+ this.element.insertAdjacentHTML('beforeend', '<div class="ms-auto"></div>')
156
162
  }
157
163
 
158
- this.element.querySelector('.icon-r').insertAdjacentHTML('beforeend', `
159
- <div class="flex flex-col gap-0 justify-center -space-y-1" data-ui-control-target="number">
160
- <button class="focus-visible:text-accent" type="button" data-action="click->ui-control#increase">
161
- <svg class="sq-4"><use href="#icon-angle-up"></use></svg>
164
+ this.element.querySelector('.ms-auto').insertAdjacentHTML('beforeend', `
165
+ <div class="flex flex-col gap-0 justify-center -space-y-1 -me-0.5" data-ui-control-target="number">
166
+ <button class="focus-visible:text-accent" type="button" data-action="click->ui-control#stepUp">
167
+ <svg class="size-4"><use href="#icon-angle-up-solid"></use></svg>
162
168
  </button>
163
- <button class="focus-visible:text-accent" type="button" data-action="click->ui-control#decrease">
164
- <svg class="sq-4"><use href="#icon-angle-down"></use></svg>
169
+ <button class="focus-visible:text-accent" type="button" data-action="click->ui-control#stepDown">
170
+ <svg class="size-4"><use href="#icon-angle-down-solid"></use></svg>
165
171
  </button>
166
172
  </div>
167
173
  `)
168
174
  }
169
175
  }
170
176
 
171
- increase () {
172
- inputStep(this.element.querySelector('input[type="number"]'), true)
177
+ stepUp() {
178
+ this.element.querySelector('input:not([hidden])').stepUp()
179
+ this.element.querySelector('input:not([hidden])').dispatchEvent(new Event('change', { bubbles: true }))
173
180
  }
174
181
 
175
- decrease () {
176
- inputStep(this.element.querySelector('input[type="number"]'), false)
182
+ stepDown() {
183
+ this.element.querySelector('input:not([hidden])').stepDown()
184
+ this.element.querySelector('input:not([hidden])').dispatchEvent(new Event('change', { bubbles: true }))
177
185
  }
178
186
 
179
- showPicker () {
187
+ showPicker() {
180
188
  this.element.querySelector('input:not([hidden])').showPicker()
181
189
  }
182
190
 
183
- showDatepicker () {
191
+ showDatepicker() {
184
192
  this.datepicker.$el.focus()
185
193
  }
186
194
  })
@@ -1,22 +1,23 @@
1
1
  import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
2
+ import { dataset } from '@newlogic-digital/utils-js'
2
3
 
3
4
  LibStimulus.register('ui-control-select', class extends Controller {
4
- connect () {
5
+ connect() {
5
6
  this.select = this.element.querySelector('select')
6
7
  const option = this.element.querySelectorAll('[data-option]')
7
8
 
8
- if (option[0] !== null) {
9
- option.forEach(option => {
9
+ if (option[0]) {
10
+ option.forEach((option) => {
10
11
  if (option.dataset.disabled) {
11
12
  return
12
13
  }
13
14
 
14
- option.setAttribute('data-action', 'click->ui-control-select#choose keydown.enter->ui-control-select#choose')
15
+ dataset(option, 'action').add('click->ui-control-select#choose', 'keydown.enter->ui-control-select#choose')
15
16
  })
16
17
  }
17
18
  }
18
19
 
19
- choose ({ currentTarget }) {
20
+ choose({ currentTarget }) {
20
21
  this.select.value = currentTarget.dataset.option
21
22
  this.select.dispatchEvent(new Event('change', { bubbles: true }))
22
23
  document.activeElement.blur()
@@ -1,18 +1,18 @@
1
1
  import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
2
2
 
3
3
  LibStimulus.register('ui-text', class extends Controller {
4
- connect () {
5
- function wrap (element, wrapper) {
4
+ connect() {
5
+ function wrap(element, wrapper) {
6
6
  element.parentNode.insertBefore(wrapper, element)
7
7
  wrapper.appendChild(element)
8
8
  }
9
9
 
10
- this.element.querySelectorAll('table').forEach(table => {
11
- wrap(table, new DOMParser().parseFromString('<div class="c_text_table"></div>', 'text/html').body.firstChild)
10
+ this.element.querySelectorAll('table').forEach((table) => {
11
+ wrap(table, new DOMParser().parseFromString('<div class="overflow-x-auto max-w-full"></div>', 'text/html').body.firstChild)
12
12
  })
13
13
 
14
- this.element.querySelectorAll('iframe').forEach(iframe => {
15
- if (iframe.width && iframe.style.aspectRatio !== 'undefined') {
14
+ this.element.querySelectorAll('iframe').forEach((iframe) => {
15
+ if (iframe.width && iframe.height) {
16
16
  iframe.style.aspectRatio = iframe.width + '/' + iframe.height
17
17
  iframe.style.height = 'auto'
18
18
  }
@@ -1,3 +1,3 @@
1
- import './Functions/+.js'
2
- export { default as cdn } from './cdn.js'
3
- import './global.js'
1
+ export { default as cdn } from './cdn.js'
2
+ export { default as initAfter } from './initAfter.js'
3
+ import './utilities.js'
@@ -1,6 +1,5 @@
1
1
  export default {
2
2
  recaptcha: 'https://www.google.com/recaptcha/enterprise.js?render={apikey}',
3
3
  pickrCss: 'https://cdn.jsdelivr.net/npm/@simonwep/pickr@1.8.2/dist/themes/nano.min.css',
4
- tippy: 'https://cdn.jsdelivr.net/combine/npm/tippy.js@6.3.7/dist/tippy.css,npm/tippy.js@6.3.1/dist/svg-arrow.css,npm/tippy.js@6.3.7/themes/light-border.css,npm/tippy.js@6.3.7/animations/scale.css',
5
4
  datepickerLang: `https://cdn.jsdelivr.net/npm/air-datepicker@3.3.5/locale/${document.documentElement.lang}.js/+esm`
6
5
  }
@@ -0,0 +1,11 @@
1
+ import { replaceScripts } from '@newlogic-digital/utils-js'
2
+ import { initStimulus } from '../Libraries/Stimulus.js'
3
+ import { initCookieConsent } from '../Libraries/CookieConsent.js'
4
+ import { initNaja } from './naja.js'
5
+
6
+ export default function initAfter(element) {
7
+ initStimulus(element)
8
+ initNaja(element)
9
+ replaceScripts(element)
10
+ initCookieConsent(element)
11
+ }
@@ -0,0 +1,41 @@
1
+ import naja from 'naja'
2
+
3
+ export const initNaja = (element, bindUI = true, selectors = 'button, [role="button"]') => {
4
+ bindUI && naja.uiHandler.bindUI(element)
5
+
6
+ element.querySelectorAll(`:where(${selectors})${naja.uiHandler.selector}`).forEach((element) => {
7
+ if (element.form && element.type === 'submit') return
8
+
9
+ element.addEventListener('click', (event) => {
10
+ naja.uiHandler.processInteraction(element, element.dataset.najaMethod ?? 'GET', element.dataset.najaUrl, element.dataset.najaData, {}, event)
11
+ })
12
+ })
13
+ }
14
+
15
+ export const NajaFormValidityExtension = {
16
+ initialize(naja) {
17
+ naja.uiHandler.addEventListener('interaction', (event) => {
18
+ const { element } = event.detail
19
+
20
+ if (element?.form && !element.form.reportValidity()) {
21
+ event.preventDefault()
22
+ }
23
+ })
24
+ }
25
+ }
26
+
27
+ export const NajaRecaptchaExtension = {
28
+ initialize(naja) {
29
+ naja.uiHandler.addEventListener('interaction', (event) => {
30
+ const { element } = event.detail
31
+
32
+ if (
33
+ (element.form ?? element)?.dataset?.controller?.includes('lib-recaptcha')
34
+ && !event.detail?.originalEvent?.detail?.recaptchaExecuted
35
+ ) {
36
+ event.preventDefault()
37
+ return false
38
+ }
39
+ })
40
+ }
41
+ }
@@ -0,0 +1,8 @@
1
+ import { Controller, LibStimulus } from '../Libraries/Stimulus.js'
2
+
3
+ LibStimulus.register('utils', class extends Controller {
4
+ darkMode() {
5
+ document.documentElement.classList.toggle('dark')
6
+ localStorage.theme = document.documentElement.classList.contains('dark') ? 'dark' : 'light'
7
+ }
8
+ })
@@ -1,6 +1,7 @@
1
- import './Utils/global.js'
2
1
  import './Libraries/+.js'
3
2
  import './Layout/+.js'
4
3
  import './Sections/+.js'
5
4
  import './Components/+.js'
6
5
  import './Ui/+.js'
6
+ import './Utils/utilities.js'
7
+ import.meta.glob('/src/assets/**')
@@ -1,4 +1,5 @@
1
- @import "CookieConsent.css";
2
1
  @import "Dialog/+.css";
3
- @import "Dropdown/+.css";
2
+ @import "Drawer.css";
4
3
  @import "Field.css";
4
+ @import "Popover.css";
5
+ @import "Toaster.css";
@@ -1 +1,3 @@
1
+ @import "Content.css";
2
+ @import "CookieConsent.css";
1
3
  @import "Default.css";
@@ -0,0 +1,2 @@
1
+ @import "winduum/src/components/dialog/content.css";
2
+ @import "winduum/src/components/dialog/content-props.css";
@@ -0,0 +1,17 @@
1
+ .c-dialog-cookieconsent {
2
+ .c-dialog-content {
3
+ max-width: 32rem;
4
+ }
5
+
6
+ &.center {
7
+ .c-dialog-content {
8
+ max-width: 26rem;
9
+ text-align: center;
10
+
11
+ & .ui-image {
12
+ margin-left: auto;
13
+ margin-right: auto;
14
+ }
15
+ }
16
+ }
17
+ }
@@ -1,26 +1,2 @@
1
- @import "winduum/src/components/dialog.css";
2
-
3
- .c-dialog {
4
- &.sm {
5
- --c-dialog-width: 30rem;
6
- }
7
-
8
- &.lg {
9
- --c-dialog-width: 50rem;
10
- }
11
-
12
- &.scrollable {
13
- height: 100%;
14
- display: flex;
15
- flex-direction: column;
16
-
17
- & .c_dialog_body {
18
- flex: 1 1 auto;
19
- overflow: auto;
20
- margin: var(--c-dialog-py) calc(var(--c-dialog-px) * -1);
21
- padding: 0 var(--c-dialog-px);
22
- overscroll-behavior: contain;
23
- -webkit-overflow-scrolling: touch;
24
- }
25
- }
26
- }
1
+ @import "winduum/src/components/dialog/default.css";
2
+ @import "winduum/src/components/dialog/default-props.css";
@@ -0,0 +1,18 @@
1
+ @import "winduum/src/components/drawer/default-props.css";
2
+ @import "winduum/src/components/drawer/default.css";
3
+ @import "winduum/src/components/drawer/content-props.css";
4
+ @import "winduum/src/components/drawer/content.css";
5
+
6
+ .c-drawer {
7
+ --c-drawer-content-width: min(calc(100vw - 2rem), 22rem);
8
+ --c-drawer-content-height: 100dvh;
9
+
10
+ &:not(.active) {
11
+ opacity: 0;
12
+ }
13
+ }
14
+
15
+ .c-drawer-content {
16
+ overflow-y: auto;
17
+ overscroll-behavior: contain;
18
+ }
@@ -1 +1 @@
1
- @import "winduum/src/components/field.css";
1
+ @import "winduum/src/components/field/index.css";
@@ -0,0 +1 @@
1
+ @import "winduum/src/components/popover/index.css";
@@ -0,0 +1,2 @@
1
+ @import "winduum/src/components/toaster/index.css";
2
+ @import "winduum/src/components/toast/index.css";