@newlogic-digital/ui 3.0.3 → 3.2.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 (120) hide show
  1. package/README.md +20 -22
  2. package/package.json +25 -14
  3. package/src/{main.json → data/main.json} +13 -11
  4. package/src/emails/email.css +3 -3
  5. package/src/emails/email.twig +1 -1
  6. package/src/icons.svg +32 -0
  7. package/src/scripts/Components/+.js +1 -2
  8. package/src/scripts/Components/CookieConsent.js +68 -64
  9. package/src/scripts/Layout/+.js +2 -1
  10. package/src/scripts/Layout/Header.js +18 -0
  11. package/src/scripts/Layout/Main.js +49 -45
  12. package/src/scripts/Libraries/+.js +13 -10
  13. package/src/scripts/Libraries/Anchor.js +18 -43
  14. package/src/scripts/Libraries/CookieConsent.js +42 -57
  15. package/src/scripts/Libraries/Dialog.js +56 -55
  16. package/src/scripts/Libraries/Drawer.js +23 -23
  17. package/src/scripts/Libraries/Form.js +37 -0
  18. package/src/scripts/Libraries/NativeSlider.js +86 -86
  19. package/src/scripts/Libraries/ReCaptcha.js +20 -18
  20. package/src/scripts/Libraries/Ripple.js +16 -32
  21. package/src/scripts/Libraries/Script.js +19 -0
  22. package/src/scripts/Libraries/Stimulus.js +30 -34
  23. package/src/scripts/Libraries/Swup.js +45 -55
  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/+.js +3 -0
  33. package/src/scripts/Utils/Functions/+.js +6 -6
  34. package/src/scripts/Utils/Functions/dataValue.js +28 -25
  35. package/src/scripts/Utils/Functions/importScript.js +9 -11
  36. package/src/scripts/Utils/Functions/importStyle.js +18 -5
  37. package/src/scripts/Utils/Functions/inView.js +19 -21
  38. package/src/scripts/Utils/Functions/loadStimulus.js +22 -20
  39. package/src/scripts/Utils/Functions/replaceTag.js +12 -0
  40. package/src/scripts/Utils/cdn.js +6 -4
  41. package/src/scripts/Utils/global.js +10 -33
  42. package/src/scripts/main.js +6 -6
  43. package/src/styles/Components/CookieConsent.css +40 -179
  44. package/src/styles/Components/Dialog/Default.css +12 -15
  45. package/src/styles/Components/Form/CookieConsent.css +7 -12
  46. package/src/styles/Layout/+.css +2 -0
  47. package/src/styles/Layout/Header.css +54 -0
  48. package/src/styles/Layout/Main.css +28 -63
  49. package/src/styles/Layout/Nav.css +43 -0
  50. package/src/styles/Libraries/+.css +1 -1
  51. package/src/styles/Libraries/Datepicker.css +85 -39
  52. package/src/styles/Libraries/Dialog.css +6 -5
  53. package/src/styles/Libraries/Drawer.css +15 -14
  54. package/src/styles/Libraries/Hint.css +29 -23
  55. package/src/styles/Libraries/Lazysizes.css +2 -1
  56. package/src/styles/Libraries/NativeSlider.css +19 -18
  57. package/src/styles/Libraries/Ripple.css +8 -5
  58. package/src/styles/Libraries/Tabs.css +4 -4
  59. package/src/styles/Libraries/Tippy.css +87 -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/+.css +9 -0
  79. package/src/styles/Utils/default.css +75 -67
  80. package/src/styles/Utils/icons.css +9 -0
  81. package/src/styles/Utils/keyframes.css +182 -0
  82. package/src/styles/Utils/normalize.css +223 -0
  83. package/src/styles/Utils/print.css +1 -1
  84. package/src/styles/Utils/tailwind/+.css +2 -0
  85. package/src/styles/Utils/tailwind/base.css +15 -0
  86. package/src/styles/Utils/tailwind/gutters.css +264 -263
  87. package/src/styles/Utils/theme/+.css +1 -0
  88. package/src/styles/Utils/theme/main.css +24 -21
  89. package/src/styles/Utils/vars.css +58 -35
  90. package/src/styles/Utils/vendor.css +1 -2
  91. package/src/styles/main.css +8 -3
  92. package/src/templates/Components/CookieConsent.twig +30 -0
  93. package/src/templates/Components/Dialogs/Basic.twig +7 -3
  94. package/src/templates/Layout/Header.twig +42 -0
  95. package/src/templates/Layout/Main.twig +52 -67
  96. package/src/templates/Sections/Gdpr.twig +64 -0
  97. package/src/templates/Sections/Ui.twig +2093 -0
  98. package/src/views/dialog-basic.json.twig +3 -0
  99. package/src/views/gdpr.json +11 -0
  100. package/src/views/index.json +12 -0
  101. package/src/views/json-tippy.json.twig +16 -0
  102. package/src/views/ui.json +11 -0
  103. package/vite.config.js +6 -0
  104. package/CHANGELOG +0 -231
  105. package/gulpfile.js +0 -192
  106. package/src/icons/iconfont.css +0 -171
  107. package/src/icons/selection.json +0 -1
  108. package/src/icons/variables.css +0 -31
  109. package/src/scripts/Components/Form.js +0 -26
  110. package/src/scripts/Ui/Wsw.js +0 -25
  111. package/src/scripts/Utils/Functions/bodyLoaded.js +0 -12
  112. package/src/styles/Libraries/Animate.css +0 -184
  113. package/src/styles/Utils/reference.css +0 -2
  114. package/src/styles/Utils/tailwind/content.css +0 -24
  115. package/src/styles/Utils/theme/vars.css +0 -19
  116. package/src/styles/preload.css +0 -29
  117. package/src/styles/tailwind.css +0 -5
  118. package/src/templates/Sections/.gitkeep +0 -0
  119. package/src/templates/dialog-basic.twig +0 -3
  120. package/src/templates/index.json +0 -6
package/README.md CHANGED
@@ -10,9 +10,7 @@
10
10
 
11
11
  # 🎨 Newlogic UI
12
12
 
13
- > v3 is still in early development
14
-
15
- Modern and modular CSS framework with the best principles.
13
+ Lightweight, modern and modular CSS framework with the best principles
16
14
 
17
15
  - 💡 Modern
18
16
  - 📦 Modular
@@ -20,11 +18,14 @@ Modern and modular CSS framework with the best principles.
20
18
  - ✨️ Progressive
21
19
  - ⚡️ Fast
22
20
 
23
- Newlogic UI is component framework with simple syntax. Inspired by popular frameworks like Bootstrap and Bulma. It uses Tailwind CSS for utility classes. The modern approach comes first.
21
+ Newlogic UI is component framework with easy syntax. Modern approach of CSS properties, enriched with utility classes from Tailwind. Inspired by favourite frameworks like Boostrap and Bulma
22
+
23
+ Javascript implementation is mainly intended for use on backend rendered websites and applications such as with PHP
24
24
 
25
25
  ## ⚙️ Under the hood
26
- * **[Newlogic Core](https://core.newlogic.cz/)** - set of tools that can be used to create modern web applications
27
- * **[ESM](https://tailwindcss.com/)** - completely written in modern JS syntax - ES8+, ES module, etc.
26
+ * **[Vituum](https://vituum.dev/)** - a small wrapper around Vite, adds support of template engines and more
27
+ * **[Newlogic Core](https://github.com/newlogic-digital/core)** - integration for Vituum, adds pre-defined config of integrations and more
28
+ * **[ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules)** - completely written in modern JS syntax - ES8+, ES module, etc.
28
29
  * **[PostCSS](https://postcss.org/)** - completely written in modern CSS syntax - nesting, variables, etc.
29
30
  * **[Tailwind CSS](https://tailwindcss.com/)** - rich utility classes for everything
30
31
  * **[Stimulus](https://stimulus.hotwire.dev/)** - a modest JavaScript framework for the HTML you already have
@@ -32,53 +33,50 @@ Newlogic UI is component framework with simple syntax. Inspired by popular frame
32
33
  * **Easy syntax** - .ui-btn (ui elements), .c-component (components), .c-section (sections) etc.
33
34
 
34
35
 
35
- The core of the Newlogic UI is Newlogic Core, which compiles modern JS and CSS code and contains other tools for web development. The source code is written in way that it can be used with other tools or a completely different environment than NodeJS, such as Deno. In general the rule is that the source code should be executable in current or future browsers, so it's written with W3C standards in mind. The framework is modular and you can really use only what is needed for your project.
36
+ The core of the Newlogic UI is Vituum with Newlogic Core, which compiles modern JS and CSS syntax and contains other tools for web development. Source code can be used with any other tools or even different environment than NodeJS, eg. Deno and is written in W3C standards and should be runnable in current or future version of browsers. The framework is modular, and you can really use only what is needed for your project.
36
37
 
37
- ## 🪄 Instalation
38
+ ## 🪄 Get started
38
39
 
39
- Creating a new project (using Newlogic Core)
40
+ Creating a new project (using Vituum)
40
41
  ```sh
41
42
  $ git clone --depth 1 https://github.com/newlogic-digital/ui.git newlogic-ui-project
42
43
  $ cd newlogic-ui-project && npm i
43
44
  ```
44
45
  ```sh
45
- $ npx gulp serve
46
+ $ vite
46
47
  ```
47
48
  or
48
49
  ```sh
49
- $ npx gulp production
50
+ $ vituum build
50
51
  ```
51
52
  ___
52
53
  Or in any other environment
53
54
  ```sh
54
- $ npm i @newlogic-newlogic/ui
55
+ $ npm i @newlogic-digital/ui
55
56
  ```
56
57
 
57
58
  ```css
58
59
  /* main.css or individual modules */
59
- @import "node_modules/@newlogic/ui/src/icons/style.css"
60
- @import "node_modules/@newlogic/ui/src/styles/main.css"
60
+ @import "node_modules/@newlogic-digital/ui/src/styles/main.css"
61
61
  ```
62
62
 
63
63
  ```js
64
64
  /* main.js or individual modules */
65
- import "node_modules/@newlogic/ui/src/scripts/main.js"
65
+ import "node_modules/@newlogic-digital/ui/src/scripts/main.js"
66
66
  ```
67
67
 
68
68
  ### Requirements
69
69
 
70
- - [Node.js LTS (14.x)](https://nodejs.org/en/download/)
71
- - [NPM (7.x)](https://www.npmjs.com/package/npm) or [Yarn (2.x)](https://yarnpkg.com/)
70
+ - [Node.js LTS (16.x)](https://nodejs.org/en/download/)
71
+ - [NPM (7.x)](https://www.npmjs.com/package/npm) or any other package manager
72
72
 
73
73
  ### Config
74
74
 
75
- Each Newlogic Core project has to have config via `gulpfile.js`, docs - [core.newlogic.cz](https://core.newlogic.cz/)
75
+ Each Vituum project has to have config via `vite.config.js`, docs - [vituum.dev](https://vituum.dev)
76
76
 
77
77
  ## 📌 Future plans
78
- - finishing docs and translating it to english
79
- - lighthouse optimization
80
- - upgrading form elements
81
- - new elements - dropdown, notificaton, snack and more
78
+ - support for new modern web features `:has`, `<dialog>`
79
+ - performance optimization
82
80
 
83
81
  ## Licence
84
82
  GNU GPLv3
package/package.json CHANGED
@@ -1,31 +1,42 @@
1
1
  {
2
2
  "name": "@newlogic-digital/ui",
3
- "version": "3.0.3",
3
+ "version": "3.2.0",
4
4
  "type": "module",
5
- "main": "gulpfile.js",
5
+ "main": "vite.config.js",
6
6
  "author": "New Logic Studio s.r.o.",
7
- "description": "Modern and modular CSS framework with the best principles",
7
+ "description": "Lightweight, modern and modular CSS framework with the best principles",
8
8
  "license": "GNU GPLv3",
9
- "imports": {},
9
+ "scripts": {
10
+ "dev": "vite",
11
+ "preview": "vite preview",
12
+ "build": "vituum build",
13
+ "build:headless": "vituum headless",
14
+ "cleanup": "vituum cleanup",
15
+ "eslint": "eslint 'src/scripts/**/*.js'",
16
+ "eslint:fix": "eslint 'src/scripts/**/*.js' --fix",
17
+ "stylelint": "stylelint 'src/styles/**/*.css'",
18
+ "stylelint:fix": "stylelint 'src/styles/**/*.css' --fix"
19
+ },
10
20
  "dependencies": {
11
- "@simonwep/pickr": "^1.8.0",
12
- "cleave.js": "^1.6.0",
13
- "stimulus": "2.0.0",
14
- "swup": "2.0.14",
15
- "vanillajs-datepicker": "^1.1.4"
21
+ "@simonwep/pickr": "^1.8.2",
22
+ "@hotwired/stimulus": "3.1.0",
23
+ "swup": "2.0.19",
24
+ "tippy.js": "^6.3.7",
25
+ "vanillajs-datepicker": "^1.2.0"
16
26
  },
17
27
  "devDependencies": {
18
- "@newlogic-digital/core": "^0.4.4",
19
- "postcss-mixins": "^7.0.3"
28
+ "@newlogic-digital/core": "^1.0.0",
29
+ "vituum": "^0.0.28",
30
+ "eslint-config-standard": "^17.0.0",
31
+ "stylelint-config-standard": "^28.0.0"
20
32
  },
21
33
  "files": [
22
34
  "src",
23
35
  "gulpfile.js"
24
36
  ],
25
37
  "engines": {
26
- "node": ">=14.0.0",
27
- "npm": ">=7.10.0",
28
- "yarn": ">=2.3.0"
38
+ "node": ">=16.0.0",
39
+ "npm": ">=7.10.0"
29
40
  },
30
41
  "repository": {
31
42
  "type": "git",
@@ -1,4 +1,5 @@
1
1
  {
2
+ "template": "templates/Layout/Main.twig",
2
3
  "prefetch": [
3
4
  "https://cdn.jsdelivr.net",
4
5
  "https://fonts.gstatic.com",
@@ -8,27 +9,28 @@
8
9
  "css": {
9
10
  "all": [
10
11
  "/src/styles/main.css",
11
- "https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=block",
12
- "/src/icons/iconfont.css"
12
+ "https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=block"
13
13
  ],
14
- "preload": "/src/styles/preload.css",
15
14
  "tailwind": "/temp/tailwind.css",
16
- "tailwind.src": "/src/styles/tailwind.css"
15
+ "tailwind.src": "/src/styles/tailwind.css",
16
+ "ratio": "/temp/ratio.css"
17
17
  },
18
18
  "js": {
19
19
  "importmap": "/public/importmap.json",
20
- "core": "/src/scripts/main.js",
21
- "es-module-shims": "https://cdn.jsdelivr.net/npm/es-module-shims@0.10.4/dist/es-module-shims.js",
22
- "lazysizes": "https://cdn.jsdelivr.net/npm/lazysizes@5.2.2/lazysizes.min.js"
20
+ "main": "/src/scripts/main.js",
21
+ "lazysizes": "https://cdn.jsdelivr.net/npm/lazysizes@5.3.2/lazysizes.min.js"
23
22
  }
24
23
  },
25
24
  "layout": {
26
- "template": "Layout/Main.twig",
27
- "cookies": true,
25
+ "cookies": false,
28
26
  "nav": [
29
27
  {
30
- "name": "Domů",
28
+ "name": "Home",
31
29
  "url": "/"
30
+ },
31
+ {
32
+ "name": "Documentation",
33
+ "url": "/ui"
32
34
  }
33
35
  ]
34
36
  },
@@ -47,4 +49,4 @@
47
49
  "8x5": "data:image/gif;base64,R0lGODlhCAAFAIAAAP///wAAACwAAAAACAAFAAACBYSPqctYADs=",
48
50
  "3x2": "data:image/gif;base64,R0lGODlhAwACAIAAAP///wAAACwAAAAAAwACAAACAoRfADs="
49
51
  }
50
- }
52
+ }
@@ -1,7 +1,7 @@
1
1
  @import "../styles/Utils/theme/main.css";
2
2
 
3
3
  :root {
4
- --width : 660px;
4
+ --width: 660px;
5
5
  --container: 30px;
6
6
  }
7
7
 
@@ -72,6 +72,6 @@ p {
72
72
 
73
73
  @media print {
74
74
  * {
75
- -webkit-print-color-adjust:exact;
75
+ -webkit-print-color-adjust: exact;
76
76
  }
77
- }
77
+ }
@@ -6,7 +6,7 @@
6
6
  <!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]-->
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
8
  <style type="text/css" n:syntax="off">
9
- {{ fetch ("/temp/emails/email.css") }}
9
+ @import './email.css';
10
10
  </style>
11
11
  </head>
12
12
  <body>
package/src/icons.svg ADDED
@@ -0,0 +1,32 @@
1
+ <svg hidden="">
2
+ <symbol id="icon-chevron-left" fill="none" viewBox="0 0 24 24" stroke="currentColor">
3
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 19l-7-7 7-7" />
4
+ </symbol>
5
+ <symbol id="icon-chevron-right" fill="none" viewBox="0 0 24 24" stroke="currentColor">
6
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5l7 7-7 7" />
7
+ </symbol>
8
+ <symbol id="icon-angle-down" fill="currentColor" viewBox="0 0 24 24" stroke="currentColor">
9
+ <path d="M10.998 15.467c.491.71 1.513.71 2.004 0l3.767-5.453c.581-.843 0-2.013-1.002-2.014H8.234C7.232 8 6.65 9.17 7.231 10.014z" />
10
+ </symbol>
11
+ <symbol id="icon-angle-up" fill="currentColor" viewBox="0 0 24 24" stroke="currentColor">
12
+ <path d="M10.998 15.467c.491.71 1.513.71 2.004 0l3.767-5.453c.581-.843 0-2.013-1.002-2.014H8.234C7.232 8 6.65 9.17 7.231 10.014z" style="transform: scaleY(-1) translateY(1px); transform-origin: 50% 50%;" />
13
+ </symbol>
14
+ <symbol id="icon-exclamation-circle" fill="none" viewBox="0 0 24 24" stroke="currentColor">
15
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
16
+ </symbol>
17
+ <symbol id="icon-x" fill="none" viewBox="0 0 24 24" stroke="currentColor">
18
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="1.75" d="M6 18L18 6M6 6l12 12" />
19
+ </symbol>
20
+ <symbol id="icon-menu" fill="none" viewBox="0 0 24 24" stroke="currentColor">
21
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16" />
22
+ </symbol>
23
+ <symbol id="icon-moon" fill="none" viewBox="0 0 24 24" stroke="currentColor">
24
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20.354 15.354A9 9 0 018.646 3.646 9.003 9.003 0 0012 21a9.003 9.003 0 008.354-5.646z" />
25
+ </symbol>
26
+ <symbol id="icon-sun" fill="none" viewBox="0 0 24 24" stroke="currentColor">
27
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z" />
28
+ </symbol>
29
+ <symbol id="icon-at-symbol" fill="none" viewBox="0 0 24 24" stroke="currentColor">
30
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207" />
31
+ </symbol>
32
+ </svg>
@@ -1,2 +1 @@
1
- import './CookieConsent.js';
2
- import './Form.js';
1
+ import './CookieConsent.js'
@@ -1,80 +1,84 @@
1
- import {LibStimulus, Controller} from "../Libraries/Stimulus.js";
2
- import LibCookieConsent from "../Libraries/CookieConsent.js";
1
+ import { LibStimulus, Controller } from '../Libraries/Stimulus.js'
2
+ import LibCookieConsent from '../Libraries/CookieConsent.js'
3
3
 
4
- LibCookieConsent.init();
5
-
6
- LibStimulus.register("c-cookieconsent", class extends Controller {
4
+ LibStimulus.register('c-cookieconsent', class extends Controller {
7
5
  connect() {
8
- const selector = this.element;
6
+ const selector = this.element
7
+
8
+ if (document.querySelector('.c-form-cookieconsent') !== null) {
9
+ return
10
+ }
9
11
 
10
- if (localStorage.getItem('cookieconsent') === null) {
12
+ if (LibCookieConsent.getItem('lib-cookieconsent') === null || parseInt(LibCookieConsent.getItem('lib-cookieconsent-expire')) < Date.now()) {
11
13
  setTimeout(() => {
12
- selector._addDataValue("state", "active");
13
- selector.classList.add("is-animate");
14
- },1500);
14
+ selector._addDataValue('state', 'active')
15
+ selector.classList.add('is-animate')
16
+ }, 1500)
15
17
  }
16
18
 
17
- selector.addEventListener("click", () => {
18
- selector.classList.add("is-mobile-show");
19
- });
20
-
21
- selector.querySelector("[data-lib-cookieconsent-approve]").addEventListener("click", () => {
22
- LibCookieConsent.set("approve");
23
- selector.classList.remove("is-animate");
24
-
25
- setTimeout(function(){
26
- selector._removeDataValue("state", "active");
27
- selector.remove();
28
- },500);
29
- });
30
-
31
- selector.querySelector("[data-lib-cookieconsent-decline]").addEventListener("click", () => {
32
- LibCookieConsent.set("performance");
33
- selector.classList.remove("is-animate");
34
-
35
- setTimeout(function(){
36
- selector._removeDataValue("state", "active");
37
- selector.remove();
38
- },500);
39
- });
19
+ selector.querySelector('[data-lib-cookieconsent-approve]').addEventListener('click', () => {
20
+ this.hide(['performance', 'marketing'])
21
+ })
22
+
23
+ selector.querySelector('[data-lib-cookieconsent-decline]').addEventListener('click', () => {
24
+ this.hide([])
25
+ })
26
+ }
27
+
28
+ hide(type) {
29
+ LibCookieConsent.set(type)
30
+ this.element.classList.remove('is-animate')
31
+
32
+ setTimeout(() => {
33
+ this.element._removeDataValue('state', 'active')
34
+ this.element.remove()
35
+ }, 500)
40
36
  }
41
- });
37
+ })
42
38
 
43
- LibStimulus.register("c-form-cookieconsent", class extends Controller {
39
+ LibStimulus.register('c-form-cookieconsent', class extends Controller {
44
40
  connect() {
45
- const selector = this.element;
46
-
47
- if (localStorage.getItem('cookieconsent') !== null) {
48
- if (localStorage.getItem('cookieconsent') === "approve") {
49
- let type = localStorage.getItem('cookieconsent_type');
50
- if (type !== null) {
51
- if (type === "performance") {
52
- selector.querySelector(`input[value="performance"]`).checked = true;
53
- } else {
54
- selector.querySelector(`input[value="approve"]`).checked = true;
55
- }
56
- } else {
57
- selector.querySelector(`input[value="approve"]`).checked = true;
41
+ const selector = this.element
42
+ const type = LibCookieConsent.getItem('lib-cookieconsent')
43
+ const modal = document.querySelector('.c-cookieconsent')
44
+
45
+ if (modal) {
46
+ modal.classList.remove('is-animate')
47
+ modal._removeDataValue('state', 'active')
48
+ }
49
+
50
+ if (type !== null) {
51
+ this.element.querySelectorAll('input:not([disabled])').forEach(input => {
52
+ input.checked = false
53
+ })
54
+
55
+ JSON.parse(type).forEach(type => {
56
+ if (selector.querySelector(`input[value="${type}"]`) !== null) {
57
+ selector.querySelector(`input[value="${type}"]`).checked = true
58
58
  }
59
- } else if (localStorage.getItem('cookieconsent') === "decline") {
60
- selector.querySelector(`input[value="decline"]`).checked = true;
61
- }
59
+ })
62
60
  }
63
61
 
64
- selector.addEventListener("submit", (e) => {
65
- e.preventDefault();
62
+ selector.addEventListener('submit', e => {
63
+ e.preventDefault()
64
+
65
+ const type = []
66
66
 
67
- let value = (new FormData(e.target)).get("cookies");
67
+ this.element.querySelectorAll('input:not([disabled])').forEach(input => {
68
+ input.checked && type.push(input.value)
69
+ })
68
70
 
69
- if (value === "approve") {
70
- LibCookieConsent.set("marketing");
71
- location.reload();
72
- } else if (value === "performance") {
73
- LibCookieConsent.set("performance");
74
- location.reload();
75
- } else if (value === "decline") {
76
- LibCookieConsent.set("decline", () => location.reload());
77
- }
71
+ LibCookieConsent.set(type)
72
+ location.reload()
78
73
  })
79
74
  }
80
- });
75
+
76
+ disconnect() {
77
+ const modal = document.querySelector('.c-cookieconsent')
78
+
79
+ if (modal && (LibCookieConsent.getItem('lib-cookieconsent') === null || parseInt(LibCookieConsent.getItem('lib-cookieconsent-expire')) < Date.now())) {
80
+ modal._addDataValue('state', 'active')
81
+ modal.classList.add('is-animate')
82
+ }
83
+ }
84
+ })
@@ -1 +1,2 @@
1
- import './Main.js';
1
+ import './Header.js'
2
+ import './Main.js'
@@ -0,0 +1,18 @@
1
+ import { LibStimulus, Controller, getController } from '../Libraries/Stimulus.js'
2
+
3
+ LibStimulus.register('l-header', class extends Controller {
4
+ connect() {
5
+ if (document.querySelector('#l-nav') === null) {
6
+ this.element.insertAdjacentHTML('afterend', '<div id="l-nav" class="lib-drawer" data-lib-drawer-target="nav" data-action="scroll->lib-drawer#scroll"><div class="wrp_nav"><div class="wrp_nav_head"></div><div class="wrp_nav_body"></div></div></div>')
7
+
8
+ getController(document.body, 'lib-drawer').init()
9
+
10
+ const layoutNav = document.querySelector('#l-nav')
11
+ const logo = this.element.querySelector('.elm_header_logo').outerHTML
12
+ const nav = this.element.querySelector('.elm_header_nav').outerHTML
13
+
14
+ layoutNav.querySelector('.wrp_nav_head').insertAdjacentHTML('beforeend', logo)
15
+ layoutNav.querySelector('.wrp_nav_body').insertAdjacentHTML('beforeend', nav)
16
+ }
17
+ }
18
+ })
@@ -1,76 +1,80 @@
1
- import {LibStimulus, Controller, loadStimulus} from "../Libraries/Stimulus.js";
2
- import {bodyLoaded, importScript} from "../Utils/Functions/+.js";
3
- import LibRipple from "../Libraries/Ripple.js";
4
- import LibAnchor from "../Libraries/Anchor.js";
5
- import LibDialog from "../Libraries/Dialog.js";
6
- import LibTabs from "../Libraries/Tabs.js";
7
- import LibNativeSlider from "../Libraries/NativeSlider.js";
8
- import cdn from "../Utils/cdn.js";
1
+ import { LibStimulus, Controller, loadStimulus } from '../Libraries/Stimulus.js'
2
+ import { importScript } from '../Utils/Functions/+.js'
3
+ import LibRipple from '../Libraries/Ripple.js'
4
+ import LibAnchor from '../Libraries/Anchor.js'
5
+ import LibDialog from '../Libraries/Dialog.js'
6
+ import LibTippy from '../Libraries/Tippy.js'
7
+ import LibTabs from '../Libraries/Tabs.js'
8
+ import LibNativeSlider from '../Libraries/NativeSlider.js'
9
+ import cdn from '../Utils/cdn.js'
10
+
11
+ LibStimulus.register('lib', class extends Controller {
12
+ connect() {
13
+ if (!('scrollBehavior' in document.documentElement.style)) {
14
+ importScript(cdn.seamless).then(() => window.seamless.polyfill())
15
+ }
16
+ }
9
17
 
10
- LibStimulus.register("lib", class extends Controller {
11
18
  ripple(e) {
12
- LibRipple(e.currentTarget, e)
19
+ LibRipple(e)
13
20
  }
14
21
 
15
22
  anchor(e) {
16
- e.preventDefault();
23
+ e.preventDefault()
17
24
  LibAnchor.action(e.currentTarget)
18
25
  }
19
26
 
20
- darkMode(e) {
21
- let currentTarget = e.currentTarget;
22
-
27
+ darkMode() {
23
28
  if (document.documentElement.classList.contains('dark')) {
24
- localStorage.theme = 'light';
25
- document.documentElement.classList.remove('dark');
26
- currentTarget.classList.remove("icon-light");
29
+ localStorage.theme = 'light'
30
+ document.documentElement.classList.remove('dark')
27
31
  } else {
28
- localStorage.theme = 'dark';
29
- document.documentElement.classList.add('dark');
30
- currentTarget.classList.add("icon-light");
32
+ localStorage.theme = 'dark'
33
+ document.documentElement.classList.add('dark')
31
34
  }
32
35
  }
33
- });
36
+ })
34
37
 
35
- LibStimulus.register("lib-dialog", class extends Controller {
36
- connect() {
37
- let element = this.element;
38
-
39
- if (typeof element.dataset.libDialogOpen !== "undefined") {
40
- let url = element.getAttribute("data-action-url");
38
+ LibStimulus.register('lib-dialog', class extends Controller {
39
+ async connect() {
40
+ if (this.element.getAttribute('data-lib-dialog-open')) {
41
+ const url = this.element.getAttribute('data-action-url')
41
42
 
42
43
  if (url) {
43
- LibDialog.action(element, url, () => loadStimulus(document.querySelector(".lib-dialog")) );
44
+ await LibDialog.action(this.element, url, () => loadStimulus(document.querySelector('.lib-dialog')))
44
45
  } else {
45
- LibDialog.show(document.querySelector(element.dataset.libDialogOpen).innerHTML, () => loadStimulus(document.querySelector(".lib-dialog")));
46
+ await LibDialog.show(document.querySelector(this.element.getAttribute('data-lib-dialog-open')).innerHTML, () => loadStimulus(document.querySelector('.lib-dialog')))
46
47
  }
47
48
  }
48
49
  }
49
50
 
50
- show(e) {
51
- let element = e.currentTarget;
52
- let url = element.getAttribute("data-action-url");
51
+ async show({ currentTarget }) {
52
+ const url = currentTarget.getAttribute('data-action-url')
53
53
 
54
- LibDialog.action(element, url, () => loadStimulus(document.querySelector(".lib-dialog")));
54
+ await LibDialog.action(currentTarget, url)
55
55
  }
56
56
 
57
- hide() {
58
- LibDialog.hide();
57
+ async hide() {
58
+ await LibDialog.hide()
59
59
  }
60
- });
60
+ })
61
61
 
62
- LibStimulus.register("lib-tabs", class extends Controller {
62
+ LibStimulus.register('lib-tabs', class extends Controller {
63
63
  connect() {
64
- LibTabs(this.element);
64
+ LibTabs(this.element)
65
65
  }
66
- });
66
+ })
67
67
 
68
- LibStimulus.register("lib-ns", class extends Controller {
68
+ LibStimulus.register('lib-ns', class extends Controller {
69
69
  connect() {
70
- if (!('scrollBehavior' in document.documentElement.style)) {
71
- importScript(cdn.seamless).then(() => window.seamless.polyfill())
72
- }
70
+ LibNativeSlider(this.element.querySelector('[data-lib-ns]'), this.element)
71
+ }
72
+ })
73
+
74
+ LibStimulus.register('lib-tippy', class extends Controller {
75
+ connect() {
76
+ const attributes = this.element.getAttribute('data-lib-tippy')
73
77
 
74
- bodyLoaded(() => LibNativeSlider(this.element.querySelector("[data-lib-ns]"), this.element))
78
+ new LibTippy(this.element, attributes !== null ? attributes.replace(/\s/g, '').split(',') : undefined)
75
79
  }
76
- });
80
+ })
@@ -1,10 +1,13 @@
1
- export { default as Anchor } from './Anchor.js';
2
- export { default as CookieConsent } from './CookieConsent.js';
3
- export { default as Dialog } from './Dialog.js';
4
- import './Drawer.js';
5
- export { default as NativeSlider } from './NativeSlider.js';
6
- import './ReCaptcha.js';
7
- export { default as Ripple } from './Ripple.js';
8
- import './Stimulus.js';
9
- export { default as Swup } from './Swup.js';
10
- export { default as Tabs } from './Tabs.js';
1
+ export { default as Anchor } from './Anchor.js'
2
+ export { default as CookieConsent } from './CookieConsent.js'
3
+ export { default as Dialog } from './Dialog.js'
4
+ import './Drawer.js'
5
+ import './Form.js'
6
+ export { default as NativeSlider } from './NativeSlider.js'
7
+ import './ReCaptcha.js'
8
+ export { default as Ripple } from './Ripple.js'
9
+ import './Script.js'
10
+ import './Stimulus.js'
11
+ export { default as Swup } from './Swup.js'
12
+ export { default as Tabs } from './Tabs.js'
13
+ export { default as Tippy } from './Tippy.js'