@newlogic-digital/ui 3.5.0 → 4.0.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 (229) hide show
  1. package/README.md +17 -21
  2. package/package.json +38 -22
  3. package/src/data/main.json +17 -32
  4. package/src/data/nav.json +12 -0
  5. package/src/icons.svg +5 -35
  6. package/src/pages/dialog/basic.json.latte +5 -0
  7. package/src/pages/email/index.json +12 -0
  8. package/src/pages/gdpr.json +11 -0
  9. package/src/pages/index.json +8 -0
  10. package/src/scripts/components/(ui)/+.js +12 -0
  11. package/src/scripts/components/(ui)/Button.js +4 -0
  12. package/src/scripts/components/(ui)/Compare.js +4 -0
  13. package/src/scripts/components/(ui)/Control.js +11 -0
  14. package/src/scripts/components/(ui)/ControlSelect.js +4 -0
  15. package/src/scripts/components/(ui)/Details.js +4 -0
  16. package/src/scripts/components/(ui)/Dialog.js +17 -0
  17. package/src/scripts/components/(ui)/Drawer.js +4 -0
  18. package/src/scripts/components/(ui)/Form.js +15 -0
  19. package/src/scripts/components/(ui)/Popover.js +4 -0
  20. package/src/scripts/components/(ui)/Range.js +4 -0
  21. package/src/scripts/components/(ui)/Tabs.js +4 -0
  22. package/src/scripts/components/(ui)/Toast.js +4 -0
  23. package/src/scripts/components/+.js +5 -0
  24. package/src/scripts/components/App.js +5 -0
  25. package/src/scripts/components/ReCaptcha.js +4 -0
  26. package/src/scripts/components/Reveal.js +4 -0
  27. package/src/scripts/components/cookieconsent/+.js +2 -0
  28. package/src/scripts/components/cookieconsent/CookieConsentDialog.js +4 -0
  29. package/src/scripts/components/cookieconsent/CookieConsentForm.js +4 -0
  30. package/src/scripts/composables/+.js +3 -0
  31. package/src/scripts/composables/naja.js +24 -0
  32. package/src/scripts/composables/stimulus.js +31 -0
  33. package/src/scripts/composables/swup.js +23 -0
  34. package/src/scripts/main.js +4 -6
  35. package/src/scripts/utils/+.js +1 -0
  36. package/src/scripts/utils/initAfter.js +11 -0
  37. package/src/styles/base/+.css +4 -0
  38. package/src/styles/base/defaults.css +36 -0
  39. package/src/styles/base/transitions.css +12 -0
  40. package/src/styles/components/(layout)/+.css +2 -0
  41. package/src/styles/components/(layout)/Header.css +11 -0
  42. package/src/styles/components/(layout)/Main.css +20 -0
  43. package/src/styles/components/(ui)/+.css +23 -0
  44. package/src/styles/components/(ui)/Badge.css +8 -0
  45. package/src/styles/components/(ui)/Button.css +12 -0
  46. package/src/styles/components/(ui)/Check.css +1 -0
  47. package/src/styles/components/(ui)/Compare.css +1 -0
  48. package/src/styles/components/(ui)/Control.css +29 -0
  49. package/src/styles/components/(ui)/ControlSelect.css +1 -0
  50. package/src/styles/components/(ui)/Drawer.css +14 -0
  51. package/src/styles/components/(ui)/Field.css +1 -0
  52. package/src/styles/components/(ui)/Group.css +1 -0
  53. package/src/styles/components/(ui)/Heading.css +4 -0
  54. package/src/styles/components/(ui)/Image.css +1 -0
  55. package/src/styles/components/(ui)/Info.css +1 -0
  56. package/src/styles/components/(ui)/Label.css +1 -0
  57. package/src/styles/components/(ui)/Link.css +2 -0
  58. package/src/styles/components/(ui)/Notice.css +1 -0
  59. package/src/styles/components/(ui)/Popover.css +1 -0
  60. package/src/styles/components/(ui)/Progress.css +1 -0
  61. package/src/styles/components/(ui)/Range.css +1 -0
  62. package/src/styles/components/(ui)/Switch.css +1 -0
  63. package/src/styles/components/(ui)/Text.css +1 -0
  64. package/src/styles/components/(ui)/Title.css +4 -0
  65. package/src/styles/components/(ui)/Toaster.css +2 -0
  66. package/src/styles/components/(ui)/dialog/+.css +2 -0
  67. package/src/styles/components/(ui)/dialog/Dialog.css +2 -0
  68. package/src/styles/components/(ui)/dialog/DialogContent.css +2 -0
  69. package/src/styles/components/+.css +3 -0
  70. package/src/styles/components/cookieconsent/+.css +1 -0
  71. package/src/styles/components/cookieconsent/CookieConsentDialog.css +17 -0
  72. package/src/styles/emails/+.css +5 -0
  73. package/src/styles/emails/base/+.css +2 -0
  74. package/src/styles/emails/base/defaults.css +22 -0
  75. package/src/styles/emails/components/+.css +4 -0
  76. package/src/styles/emails/components/Button.css +31 -0
  77. package/src/styles/emails/components/Heading.css +7 -0
  78. package/src/styles/emails/components/Main.css +13 -0
  79. package/src/styles/emails/components/Text.css +14 -0
  80. package/src/styles/emails/main.css +9 -0
  81. package/src/styles/emails/theme/+.css +2 -0
  82. package/src/styles/emails/theme/config.css +5 -0
  83. package/src/styles/emails/theme/default.css +13 -0
  84. package/src/styles/emails/utils/+.css +1 -0
  85. package/src/styles/emails/utils/common.css +29 -0
  86. package/src/styles/main.css +5 -14
  87. package/src/styles/theme/+.css +2 -0
  88. package/src/styles/theme/dark.css +5 -0
  89. package/src/styles/theme/main.css +35 -0
  90. package/src/styles/tinymce.css +2 -34
  91. package/src/styles/utils/+.css +4 -0
  92. package/src/styles/utils/container.css +5 -0
  93. package/src/styles/utils/index.css +8 -0
  94. package/src/styles/utils/reveal.css +22 -0
  95. package/src/styles/utils/scrollbar.css +23 -0
  96. package/src/templates/components/(layout)/Footer.latte +1 -0
  97. package/src/templates/components/(layout)/Header.latte +7 -0
  98. package/src/templates/components/(ui)/Toast.latte +9 -0
  99. package/src/templates/components/Content.latte +64 -0
  100. package/src/templates/components/Example.latte +17 -0
  101. package/src/templates/components/cookieconsent/CookieConsentContent.latte +69 -0
  102. package/src/templates/components/cookieconsent/CookieConsentDialog.latte +27 -0
  103. package/src/templates/components/cookieconsent/CookieConsentForm.latte +47 -0
  104. package/src/templates/components/dialog/DialogBasic.latte +18 -0
  105. package/src/templates/emails/components/Content.latte +29 -0
  106. package/src/templates/emails/components/Footer.latte +13 -0
  107. package/src/templates/emails/components/Header.latte +8 -0
  108. package/src/templates/emails/layouts/default.latte +35 -0
  109. package/src/templates/layouts/default.latte +71 -0
  110. package/vite.config.js +5 -17
  111. package/src/emails/styles/email.css +0 -77
  112. package/src/emails/templates/.gitkeep +0 -0
  113. package/src/emails/templates.test/Content.latte +0 -24
  114. package/src/emails/templates.test/Header.latte +0 -14
  115. package/src/emails/templates.test/Layout.latte +0 -23
  116. package/src/scripts/Components/+.js +0 -1
  117. package/src/scripts/Components/CookieConsent.js +0 -78
  118. package/src/scripts/Layout/+.js +0 -2
  119. package/src/scripts/Layout/Header.js +0 -32
  120. package/src/scripts/Layout/Main.js +0 -50
  121. package/src/scripts/Libraries/+.js +0 -12
  122. package/src/scripts/Libraries/CookieConsent.js +0 -67
  123. package/src/scripts/Libraries/Dialog.js +0 -47
  124. package/src/scripts/Libraries/Drawer.js +0 -42
  125. package/src/scripts/Libraries/Form.js +0 -26
  126. package/src/scripts/Libraries/Naja.js +0 -33
  127. package/src/scripts/Libraries/ReCaptcha.js +0 -42
  128. package/src/scripts/Libraries/Ripple.js +0 -8
  129. package/src/scripts/Libraries/Script.js +0 -18
  130. package/src/scripts/Libraries/Slider.js +0 -160
  131. package/src/scripts/Libraries/Stimulus.js +0 -11
  132. package/src/scripts/Libraries/Swup.js +0 -92
  133. package/src/scripts/Libraries/Tippy.js +0 -117
  134. package/src/scripts/Sections/+.js +0 -0
  135. package/src/scripts/Ui/+.js +0 -4
  136. package/src/scripts/Ui/Check.js +0 -8
  137. package/src/scripts/Ui/Control.js +0 -186
  138. package/src/scripts/Ui/ControlSelect.js +0 -24
  139. package/src/scripts/Ui/Text.js +0 -21
  140. package/src/scripts/Utils/+.js +0 -3
  141. package/src/scripts/Utils/Functions/+.js +0 -7
  142. package/src/scripts/Utils/Functions/importScript.js +0 -17
  143. package/src/scripts/Utils/Functions/importStyle.js +0 -18
  144. package/src/scripts/Utils/Functions/inputStep.js +0 -9
  145. package/src/scripts/Utils/Functions/inputValidity.js +0 -57
  146. package/src/scripts/Utils/Functions/loadStimulus.js +0 -42
  147. package/src/scripts/Utils/Functions/replaceScript.js +0 -4
  148. package/src/scripts/Utils/Functions/replaceTag.js +0 -8
  149. package/src/scripts/Utils/cdn.js +0 -6
  150. package/src/scripts/Utils/global.js +0 -15
  151. package/src/styles/Components/+.css +0 -4
  152. package/src/styles/Components/CookieConsent.css +0 -68
  153. package/src/styles/Components/Dialog/+.css +0 -1
  154. package/src/styles/Components/Dialog/Default.css +0 -26
  155. package/src/styles/Components/Dropdown/+.css +0 -1
  156. package/src/styles/Components/Dropdown/Default.css +0 -8
  157. package/src/styles/Components/Field.css +0 -1
  158. package/src/styles/Layout/+.css +0 -3
  159. package/src/styles/Layout/Header.css +0 -50
  160. package/src/styles/Layout/Main.css +0 -28
  161. package/src/styles/Layout/Nav.css +0 -47
  162. package/src/styles/Libraries/+.css +0 -7
  163. package/src/styles/Libraries/Datepicker.css +0 -54
  164. package/src/styles/Libraries/Dialog.css +0 -1
  165. package/src/styles/Libraries/Drawer.css +0 -64
  166. package/src/styles/Libraries/Hint.css +0 -186
  167. package/src/styles/Libraries/Pickr.css +0 -13
  168. package/src/styles/Libraries/Ripple.css +0 -1
  169. package/src/styles/Libraries/Tippy.css +0 -73
  170. package/src/styles/Sections/+.css +0 -1
  171. package/src/styles/Ui/+.css +0 -17
  172. package/src/styles/Ui/Badge.css +0 -7
  173. package/src/styles/Ui/Btn.css +0 -13
  174. package/src/styles/Ui/Check.css +0 -1
  175. package/src/styles/Ui/Control.css +0 -47
  176. package/src/styles/Ui/ControlSelect.css +0 -66
  177. package/src/styles/Ui/Dot.css +0 -22
  178. package/src/styles/Ui/Group.css +0 -1
  179. package/src/styles/Ui/Heading.css +0 -3
  180. package/src/styles/Ui/Image.css +0 -1
  181. package/src/styles/Ui/Info.css +0 -1
  182. package/src/styles/Ui/Label.css +0 -1
  183. package/src/styles/Ui/Link.css +0 -2
  184. package/src/styles/Ui/Notice.css +0 -1
  185. package/src/styles/Ui/Progress.css +0 -1
  186. package/src/styles/Ui/Switch.css +0 -1
  187. package/src/styles/Ui/Text.css +0 -8
  188. package/src/styles/Ui/Title.css +0 -7
  189. package/src/styles/Utils/+.css +0 -8
  190. package/src/styles/Utils/config.css +0 -5
  191. package/src/styles/Utils/default.css +0 -19
  192. package/src/styles/Utils/icons.css +0 -5
  193. package/src/styles/Utils/tailwind.css +0 -50
  194. package/src/styles/Utils/theme/+.css +0 -1
  195. package/src/styles/Utils/theme/main.css +0 -19
  196. package/src/templates/Components/CookieConsent.latte +0 -28
  197. package/src/templates/Components/Dialogs/Basic.latte +0 -22
  198. package/src/templates/Components/Items/.gitkeep +0 -0
  199. package/src/templates/Layout/Footer.latte +0 -0
  200. package/src/templates/Layout/Header.latte +0 -40
  201. package/src/templates/Layout/Main.latte +0 -62
  202. package/src/templates/Sections/Gdpr.latte +0 -127
  203. package/src/templates/Sections/Site.latte +0 -141
  204. package/src/templates/Sections/Ui/Docs/@intro.html +0 -48
  205. package/src/templates/Sections/Ui/Docs/@nav.html +0 -144
  206. package/src/templates/Sections/Ui/Docs/@styles.html +0 -96
  207. package/src/templates/Sections/Ui/Docs/Default.latte +0 -1059
  208. package/src/templates/Sections/Ui/Icons.html +0 -30
  209. package/src/templates/Sections/Ui/Intro.html +0 -165
  210. package/src/templates/Sections/Ui.latte +0 -8
  211. package/src/templates/Ui/+.latte +0 -5
  212. package/src/templates/Ui/Check.latte +0 -7
  213. package/src/templates/Ui/Control.latte +0 -9
  214. package/src/templates/Ui/ControlDate.latte +0 -14
  215. package/src/templates/Ui/ControlSelect.latte +0 -9
  216. package/src/templates/Ui/ControlTime.latte +0 -14
  217. package/src/views/dialog/basic.json.latte +0 -5
  218. package/src/views/dropdown/tippy.json.latte +0 -19
  219. package/src/views/email/email.latte +0 -6
  220. package/src/views/email/email.test.latte +0 -6
  221. package/src/views/gdpr.json +0 -12
  222. package/src/views/index.json +0 -12
  223. package/src/views/site.json +0 -11
  224. package/src/views/ui-icons.json +0 -12
  225. package/src/views/ui.json +0 -11
  226. /package/src/styles/{Utils → base}/breakpoints.css +0 -0
  227. /package/src/styles/{Utils → base}/keyframes.css +0 -0
  228. /package/src/styles/{Utils/print.css → emails/base/fonts.css} +0 -0
  229. /package/src/templates/{Utils → utils}/sections.latte +0 -0
@@ -1,78 +0,0 @@
1
- import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
2
- import LibCookieConsent from '../Libraries/CookieConsent.js'
3
-
4
- LibStimulus.register('c-cookieconsent', class extends Controller {
5
- connect () {
6
- const selector = this.element
7
-
8
- if (document.querySelector('.c-form-cookieconsent') !== null) {
9
- return
10
- }
11
-
12
- if (LibCookieConsent.getItem('lib-cookieconsent') === null || parseInt(LibCookieConsent.getItem('lib-cookieconsent-expire')) < Date.now()) {
13
- setTimeout(() => {
14
- selector.classList.add('active', 'is-animate')
15
- }, 1500)
16
- }
17
- }
18
-
19
- approve () {
20
- this.hide(['performance', 'marketing'])
21
- }
22
-
23
- decline () {
24
- this.hide([])
25
- }
26
-
27
- hide (type) {
28
- LibCookieConsent.set(type)
29
- this.element.classList.remove('is-animate')
30
-
31
- setTimeout(() => {
32
- this.element.classList.remove('active')
33
- this.element.remove()
34
- }, 500)
35
- }
36
- })
37
- LibStimulus.register('c-form-cookieconsent', class extends Controller {
38
- connect () {
39
- const selector = this.element
40
- const type = LibCookieConsent.getItem('lib-cookieconsent')
41
- const modal = document.querySelector('.c-cookieconsent')
42
-
43
- if (modal) {
44
- modal.classList.remove('is-animate', 'active')
45
- }
46
-
47
- if (type !== null) {
48
- this.element.querySelectorAll('input:not([disabled])').forEach(input => {
49
- input.checked = false
50
- })
51
-
52
- JSON.parse(type).forEach(type => {
53
- if (selector.querySelector(`input[value="${type}"]`) !== null) {
54
- selector.querySelector(`input[value="${type}"]`).checked = true
55
- }
56
- })
57
- }
58
- }
59
-
60
- update () {
61
- const type = []
62
-
63
- this.element.querySelectorAll('input:not([disabled])').forEach(input => {
64
- input.checked && type.push(input.value)
65
- })
66
-
67
- LibCookieConsent.set(type)
68
- location.reload()
69
- }
70
-
71
- disconnect () {
72
- const modal = document.querySelector('.c-cookieconsent')
73
-
74
- if (modal && (LibCookieConsent.getItem('lib-cookieconsent') === null || parseInt(LibCookieConsent.getItem('lib-cookieconsent-expire')) < Date.now())) {
75
- modal.classList.add('active', 'is-animate')
76
- }
77
- }
78
- })
@@ -1,2 +0,0 @@
1
- import './Header.js'
2
- import './Main.js'
@@ -1,32 +0,0 @@
1
- import { LibStimulus, Controller, getController } from '../Libraries/Stimulus.js'
2
-
3
- LibStimulus.register('l-header',
4
- /** @property {LibDrawer} libDrawerOutlet */
5
- class extends Controller {
6
- connect () {
7
- if (document.querySelector('#l-nav') === null) {
8
- this.element.insertAdjacentHTML('afterend', `
9
- <div id="l-nav" class="lib-drawer" data-controller="lib-drawer" data-action="scroll->lib-drawer#scroll" inert>
10
- <div class="l_nav">
11
- <div class="l_nav_head"></div>
12
- <div class="l_nav_body"></div>
13
- </div>
14
- </div>
15
- `)
16
-
17
- const layoutNav = document.querySelector('#l-nav')
18
- const logo = this.element.querySelector('.l_header_logo').outerHTML
19
- const nav = this.element.querySelector('.l_header_nav').outerHTML
20
-
21
- layoutNav.querySelector('.l_nav_head').insertAdjacentHTML('beforeend', logo)
22
- layoutNav.querySelector('.l_nav_body').insertAdjacentHTML('beforeend', nav)
23
- }
24
- }
25
-
26
- showDrawer () {
27
- /** @type {LibDrawer} */
28
- const LibDrawer = getController(document.querySelector('[data-controller~="lib-drawer"]'), 'lib-drawer')
29
- LibDrawer.show()
30
- }
31
- }
32
- )
@@ -1,50 +0,0 @@
1
- import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
2
- import LibTippy from '../Libraries/Tippy.js'
3
- import { initSlider, nextSlide, prevSlide, selectSlide } from '../Libraries/Slider.js'
4
-
5
- LibStimulus.register('lib', class extends Controller {
6
- darkMode () {
7
- if (document.documentElement.classList.contains('dark')) {
8
- localStorage.theme = 'light'
9
- document.documentElement.classList.remove('dark')
10
- } else {
11
- localStorage.theme = 'dark'
12
- document.documentElement.classList.add('dark')
13
- }
14
- }
15
- })
16
-
17
- LibStimulus.register('lib-tippy', class extends Controller {
18
- connect () {
19
- const attributes = this.element.dataset.libTippy
20
-
21
- new LibTippy(this.element, attributes?.replace(/\s/g, '')?.split(','))
22
- }
23
- })
24
-
25
- LibStimulus.register('lib-slider', class extends Controller {
26
- static targets = ['slider', 'dots', 'progress', 'counterMin', 'counterMax']
27
-
28
- connect () {
29
- initSlider(this.sliderTarget, {
30
- paginationSelector: this.hasDotsTarget ? this.dotsTarget : null,
31
- paginationItemClass: 'ui-dot',
32
- progressSelector: this.hasProgressTarget ? this.progressTarget : null,
33
- counterMinSelector: this.hasCounterMinTarget ? this.counterMinTarget : null,
34
- counterMaxSelector: this.hasCounterMaxTarget ? this.counterMaxTarget : null,
35
- pauseSelector: this.element.querySelectorAll('[data-action*="lib-slider"]')
36
- })
37
- }
38
-
39
- next () {
40
- nextSlide(this.sliderTarget)
41
- }
42
-
43
- prev () {
44
- prevSlide(this.sliderTarget)
45
- }
46
-
47
- select () {
48
- selectSlide(this.sliderTarget)
49
- }
50
- })
@@ -1,12 +0,0 @@
1
- export { default as CookieConsent } from './CookieConsent.js'
2
- import './Dialog.js'
3
- import './Drawer.js'
4
- import './Form.js'
5
- import './Naja.js'
6
- import './ReCaptcha.js'
7
- import './Ripple.js'
8
- import './Script.js'
9
- import './Slider.js'
10
- import './Stimulus.js'
11
- export { default as Swup } from './Swup.js'
12
- export { default as Tippy } from './Tippy.js'
@@ -1,67 +0,0 @@
1
- const LibCookieConsent = {
2
- setItem: (key, value) => {
3
- localStorage.setItem(key, value)
4
- },
5
- getItem: (key) => {
6
- return localStorage.getItem(key)
7
- },
8
- init: () => {
9
- const type = LibCookieConsent.getItem('lib-cookieconsent')
10
-
11
- if (type !== null) {
12
- JSON.parse(type).forEach(type => LibCookieConsent.append(type))
13
- }
14
- },
15
- set: (type) => {
16
- LibCookieConsent.setItem('lib-cookieconsent', JSON.stringify(type))
17
- LibCookieConsent.setItem('lib-cookieconsent-expire', (Date.now() + 31556926 * 1000).toString())
18
-
19
- if (type.length > 0) {
20
- type.forEach(type => LibCookieConsent.append(type))
21
- } else {
22
- LibCookieConsent.setItem('lib-cookieconsent', JSON.stringify([]))
23
- LibCookieConsent.remove()
24
- }
25
- },
26
- remove: () => {
27
- document.cookie.split(';').forEach(c => {
28
- document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/')
29
- })
30
- },
31
- append: (type) => {
32
- document.querySelectorAll('[data-lib-cookieconsent]').forEach(elm => {
33
- if (type === 'all' || elm.getAttribute('data-lib-cookieconsent') === type) {
34
- const script = document.createElement('script')
35
- let delay = 0
36
-
37
- ;[...elm.attributes].forEach((attribute) => {
38
- if (attribute.specified) {
39
- if (attribute.name.indexOf('data-lib-cookieconsent') === -1 && attribute.name.indexOf('type') === -1) {
40
- script.setAttribute(attribute.name, attribute.value)
41
- }
42
- }
43
- })
44
-
45
- script.innerHTML = elm.innerHTML
46
-
47
- if (elm.getAttribute('data-lib-cookieconsent-delay')) {
48
- delay = parseInt(elm.getAttribute('data-lib-cookieconsent-delay'))
49
- }
50
-
51
- setTimeout(() => {
52
- if (elm.closest('body') !== null) {
53
- document.body.appendChild(script)
54
- } else if (elm.closest('head') !== null) {
55
- document.head.appendChild(script)
56
- }
57
-
58
- elm.remove()
59
- }, delay)
60
- }
61
- })
62
- }
63
- }
64
-
65
- LibCookieConsent.init()
66
-
67
- export default LibCookieConsent
@@ -1,47 +0,0 @@
1
- import { Controller, LibStimulus, loadStimulus } from './Stimulus.js'
2
- import { insertDialog, closeDialog, fetchDialog, dialogSelector } from 'winduum/src/libraries/dialog.js'
3
- import { replaceScript } from '../Utils/Functions/+.js'
4
-
5
- LibStimulus.register('lib-dialog', class extends Controller {
6
- static values = {
7
- open: String,
8
- url: String
9
- }
10
-
11
- async connect () {
12
- if (this.hasOpenValue) {
13
- if (this.hasUrlValue) {
14
- await fetchDialog({
15
- url: this.urlValue, insertOptions: { remove: true }
16
- })
17
- } else {
18
- await insertDialog(document.querySelector(this.openValue).innerHTML, {
19
- remove: true
20
- })
21
- }
22
-
23
- loadStimulus(dialogSelector('.lib-dialog'))
24
- }
25
- }
26
-
27
- async show ({ currentTarget, params }) {
28
- currentTarget.classList.add('loading', 'cursor-wait')
29
-
30
- await fetchDialog({
31
- url: params.url,
32
- insertOptions: {
33
- remove: params.remove ?? true,
34
- append: params.append ?? false
35
- }
36
- }).then(() => {
37
- loadStimulus(dialogSelector('.lib-dialog'))
38
- replaceScript(dialogSelector('.lib-dialog'))
39
- })
40
-
41
- currentTarget.classList.remove('loading', 'cursor-wait')
42
- }
43
-
44
- async close ({ currentTarget, params }) {
45
- await closeDialog(currentTarget.closest('dialog'), { remove: params.remove ?? false })
46
- }
47
- })
@@ -1,42 +0,0 @@
1
- import { LibStimulus, Controller } from './Stimulus.js'
2
-
3
- LibStimulus.register('lib-drawer', class LibDrawer extends Controller {
4
- connect () {
5
- setTimeout(() => this.element.classList.add('is-transition'), 50)
6
- this.element.addEventListener('click', ({ target }) => {
7
- if (target === this.element) {
8
- this.hide()
9
- }
10
- })
11
- }
12
-
13
- show () {
14
- this.element.scrollLeft = 0
15
- this.element.style.setProperty('--lib-drawer-opacity', '1')
16
- this.element.classList.add('is-opacity', 'active')
17
- this.element.setAttribute('aria-hidden', 'false')
18
- this.element.removeAttribute('inert')
19
- document.documentElement.classList.add('overflow-hidden')
20
- }
21
-
22
- hide () {
23
- this.element.setAttribute('inert', '')
24
- this.element.setAttribute('aria-hidden', 'true')
25
- this.element.classList.remove('active')
26
- this.element.classList.add('is-opacity')
27
- this.element.style.setProperty('--lib-drawer-opacity', '0')
28
- document.documentElement.classList.remove('overflow-hidden')
29
- }
30
-
31
- scroll ({ target }) {
32
- if (target.scrollLeft > 1) {
33
- this.element.classList.remove('is-opacity')
34
- this.element.style.setProperty('--lib-drawer-opacity', `${Math.abs((target.scrollLeft / this.element.children[0].clientWidth) - 1)}`)
35
- }
36
-
37
- if (target.scrollLeft === this.element.children[0].clientWidth) {
38
- this.element.classList.remove('active')
39
- document.documentElement.classList.remove('overflow-hidden')
40
- }
41
- }
42
- })
@@ -1,26 +0,0 @@
1
- import { LibStimulus, Controller } from './Stimulus.js'
2
- import { inputValidity } from '../Utils/Functions/+.js'
3
-
4
- LibStimulus.register('lib-form', class extends Controller {
5
- connect () {
6
- this.element.setAttribute('novalidate', '')
7
- this.element.addEventListener('submit', e => this.validation(e))
8
- }
9
-
10
- validation (e) {
11
- if (this.element.checkValidity() === false) {
12
- e.preventDefault()
13
- e.stopPropagation()
14
-
15
- this.element.querySelector(':invalid').scrollIntoView({ behavior: 'smooth', block: 'center' })
16
- this.element.querySelector(':invalid').focus()
17
- } else {
18
- this.element.querySelector('[type="submit"]').classList.add('loading')
19
- }
20
-
21
- this.element.querySelectorAll('.ui-control, .ui-check, .ui-switch').forEach(element => {
22
- console.log(element)
23
- inputValidity(element, { message: true })
24
- })
25
- }
26
- })
@@ -1,33 +0,0 @@
1
- import naja from 'naja'
2
- import { Controller, LibStimulus, loadStimulus } from './Stimulus.js'
3
-
4
- LibStimulus.register('lib-naja', class extends Controller {
5
- async connect () {
6
- naja.uiHandler.addEventListener('interaction', ({ detail }) => {
7
- const element = detail.element
8
-
9
- detail.options.target = element
10
-
11
- element.dispatchEvent(new CustomEvent('naja:interaction', { bubbles: true, cancelable: true }))
12
-
13
- if (element?.form && !element.form.reportValidity()) {
14
- arguments[0].preventDefault()
15
- }
16
- })
17
-
18
- naja.snippetHandler.addEventListener('afterUpdate', ({ detail }) => {
19
- detail?.options.target.dispatchEvent(new CustomEvent('naja:afterUpdate', { bubbles: true, cancelable: true }))
20
-
21
- loadStimulus(document.body, false)
22
- })
23
-
24
- naja.uiHandler.selector = '[data-naja]'
25
- naja.initialize({
26
- history: false
27
- })
28
- }
29
-
30
- async get ({ params }) {
31
- await naja.makeRequest('GET', params.url, params.data ? JSON.parse(params.data) : null, { history: params.history ?? false })
32
- }
33
- })
@@ -1,42 +0,0 @@
1
- import { LibStimulus, Controller } from './Stimulus.js'
2
- import naja from 'naja'
3
- import importScript from '../Utils/Functions/importScript.js'
4
- import cdn from '../Utils/cdn.js'
5
-
6
- LibStimulus.register('lib-recaptcha', class extends Controller {
7
- static values = {
8
- api: String,
9
- action: String
10
- }
11
-
12
- connect () {
13
- importScript(cdn.recaptcha.replace('{apikey}', this.apiValue))
14
- }
15
-
16
- async execute () {
17
- return new Promise(resolve => {
18
- window.grecaptcha.enterprise.ready(() => {
19
- window.grecaptcha.enterprise.execute(this.apiValue, { action: this.actionValue ?? 'form' }).then(token => {
20
- this.element.querySelector('[name="gtoken"]').value = token
21
- resolve()
22
- })
23
- })
24
- })
25
- }
26
-
27
- async submit ({ params }) {
28
- if (this.element.reportValidity() === false) {
29
- return false
30
- }
31
-
32
- arguments[0].preventDefault()
33
-
34
- await this.execute()
35
-
36
- if (!params.naja) {
37
- this.element.submit()
38
- } else {
39
- await naja.makeRequest(this.element.method, this.element.action, new FormData(this.element), { history: 'replace' })
40
- }
41
- }
42
- })
@@ -1,8 +0,0 @@
1
- import { Controller, LibStimulus } from './Stimulus.js'
2
- import { showRipple } from 'winduum/src/libraries/ripple.js'
3
-
4
- LibStimulus.register('lib-ripple', class extends Controller {
5
- async show (e) {
6
- showRipple(e)
7
- }
8
- })
@@ -1,18 +0,0 @@
1
- import { LibStimulus, Controller } from './Stimulus.js'
2
-
3
- LibStimulus.register('lib-script', class extends Controller {
4
- connect () {
5
- const element = this.element
6
- const script = document.createElement('script')
7
-
8
- ;[...element.attributes].forEach(attribute => {
9
- if (attribute.specified && !attribute.name.includes('type') && !attribute.name.includes('data-controller')) {
10
- script.setAttribute(attribute.name, attribute.value)
11
- }
12
- })
13
-
14
- script.innerHTML = element.innerHTML
15
- element.parentElement.appendChild(script)
16
- element.remove()
17
- }
18
- })
@@ -1,160 +0,0 @@
1
- const defaultOptions = {
2
- behavior: 'smooth',
3
- init: {
4
- pauseSelector: [],
5
- paginationSelector: null,
6
- paginationItemClass: null,
7
- progressSelector: null,
8
- counterMinSelector: null,
9
- counterMaxSelector: null,
10
- autoplay: false
11
- }
12
- }
13
-
14
- export const prevSlide = (selector) => {
15
- selector.scroll({ left: selector.scrollLeft - selector.children[0].clientWidth, behavior: defaultOptions.behavior })
16
- }
17
-
18
- export const nextSlide = (selector) => {
19
- selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth, behavior: defaultOptions.behavior })
20
- }
21
-
22
- export const selectSlide = (selector, selected = 0) => {
23
- const position = selector.scrollLeft / selector.children[0].clientWidth
24
-
25
- if (position - selected <= 0) {
26
- selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth * (selected - 1 - position), behavior: defaultOptions.behavior })
27
- } else {
28
- selector.scroll({ left: selector.scrollLeft - selector.children[0].clientWidth * (position - selected + 1), behavior: defaultOptions.behavior })
29
- }
30
- }
31
-
32
- export const initSlider = (selector, options = defaultOptions.init) => {
33
- let isDown; let paused; let startX; let scrollLeft = null
34
-
35
- function isElementInViewport (element) {
36
- const rect = element.getBoundingClientRect()
37
- const sliderRect = selector.getBoundingClientRect()
38
-
39
- return (
40
- rect.left >= sliderRect.left &&
41
- rect.right <= sliderRect.right
42
- )
43
- }
44
-
45
- function setProgressValue () {
46
- if (options.progressSelector) {
47
- options.progressSelector.value = ((selector.scrollLeft + selector.clientWidth) / selector.scrollWidth * 100).toFixed(2)
48
- }
49
- }
50
-
51
- if (!selector.classList.contains('is-fade')) {
52
- const grabbing = () => {
53
- isDown = false
54
- paused = false
55
- selector.classList.remove('is-grabbing')
56
- selector.scrollLeft = selector.scrollLeft - 1
57
- }
58
-
59
- selector.addEventListener('mouseleave', grabbing)
60
-
61
- selector.addEventListener('mouseup', grabbing)
62
-
63
- selector.addEventListener('mousedown', ({ pageX }) => {
64
- isDown = true
65
- paused = true
66
- startX = pageX - selector.offsetLeft
67
- scrollLeft = selector.scrollLeft
68
- })
69
-
70
- selector.addEventListener('mousemove', e => {
71
- if (!isDown) return
72
- e.preventDefault()
73
- const x = e.pageX - selector.offsetLeft
74
- const walk = (x - startX) * 1.25
75
-
76
- selector.classList.add('is-grabbing')
77
- selector.scrollLeft = scrollLeft - walk
78
-
79
- selector.ondragstart = dragEvent => dragEvent.preventDefault()
80
- })
81
- }
82
-
83
- const itemsCount = selector.clientWidth > selector.children[0].clientWidth
84
- ? [...selector.children].reduce((item, children) =>
85
- (selector.scrollWidth - selector.clientWidth > item.itemsWidth + children.clientWidth / 2)
86
- ? { itemsWidth: item.itemsWidth + children.clientWidth, count: item.count + 1 }
87
- : item, { itemsWidth: 0, count: 0 }).count + 1
88
- : Math.ceil((selector.scrollWidth) / selector.children[0].clientWidth)
89
-
90
- if (options.counterMinSelector) {
91
- options.counterMinSelector.textContent = 1
92
- }
93
-
94
- if (options.counterMaxSelector) {
95
- options.counterMaxSelector.textContent = itemsCount
96
- }
97
-
98
- if (options.paginationSelector) {
99
- options.paginationSelector.insertAdjacentHTML('beforeend', [...Array(itemsCount)].map((_, i) => `
100
- <div class="${options.paginationItemClass ?? ''}${i === 0 ? ' active' : ''}"></div>
101
- `).join(''))
102
-
103
- ;[...options.paginationSelector.children].forEach((children) => {
104
- children.addEventListener('click', ({ currentTarget }) => {
105
- selectSlide(selector, [...options.paginationSelector.children].indexOf(currentTarget) + 1)
106
- })
107
- })
108
- }
109
-
110
- setProgressValue()
111
-
112
- selector.addEventListener('scroll', () => {
113
- const activeSlide = parseInt((selector.scrollLeft / selector.children[0].clientWidth).toFixed(0))
114
-
115
- for (const children of [...selector.children]) {
116
- if (isElementInViewport(children)) {
117
- children.classList.add('active')
118
- } else {
119
- children.classList.remove('active')
120
- }
121
- }
122
-
123
- if (options.paginationSelector) {
124
- [...options.paginationSelector.children].forEach(children => children.classList.remove('active'))
125
-
126
- options.paginationSelector.children[activeSlide].classList.add('active')
127
- }
128
-
129
- setProgressValue()
130
-
131
- if (options.counterMinSelector) {
132
- options.counterMinSelector.textContent = activeSlide + 1
133
- }
134
- }, { passive: true })
135
-
136
- if (options.progressSelector) {
137
- options.progressSelector.addEventListener('click', ({ clientX, target }) => {
138
- selector.scrollLeft = (selector.scrollWidth / 100) * (clientX - target.offsetLeft) / target.clientWidth * 100
139
- })
140
- }
141
-
142
- ;[...options.pauseSelector, options.progressSelector, options.paginationSelector, selector].forEach(element => {
143
- if (typeof element !== 'undefined' && element !== null) {
144
- element.addEventListener('mouseenter', () => (paused = true))
145
- element.addEventListener('mouseleave', () => (paused = false))
146
- }
147
- })
148
-
149
- if (options.autoplay && !isNaN(options.autoplay)) {
150
- setInterval(() => {
151
- if (!paused) {
152
- if (selector.scrollLeft < selector.children[0].clientWidth * (selector.children.length - 1)) {
153
- selector.scroll({ left: selector.scrollLeft + selector.children[0].clientWidth, behavior: self.behavior })
154
- } else {
155
- selector.scroll({ left: 0, behavior: options.behavior })
156
- }
157
- }
158
- }, options.autoplay)
159
- }
160
- }
@@ -1,11 +0,0 @@
1
- import { Application, Controller } from '@hotwired/stimulus'
2
- import loadStimulus from '../Utils/Functions/loadStimulus.js'
3
-
4
- const LibStimulus = new Application(document.documentElement)
5
- const getController = (element, identifier) => LibStimulus.getControllerForElementAndIdentifier(element, identifier)
6
-
7
- LibStimulus.start().then(() => loadStimulus(document.body))
8
-
9
- window.LibStimulus = { default: LibStimulus, Controller, loadStimulus }
10
-
11
- export { LibStimulus, Controller, loadStimulus, getController }