diff --git a/.gitignore b/.gitignore index 7539bc8c..86092346 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,7 @@ typings/ # Yarn Integrity file .yarn-integrity +yarn.lock # dotenv environment variables file .env @@ -77,8 +78,8 @@ assets/reactjs/node_modules/ package-lock.json composer.lock .idea/ -.vscode/ .DS_Store assets/reactjs/yarn.lock *.zip qubely/* +yarn.lock diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..d569c548 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "tabWidth": 4, + "useTabs": true, + "printWidth": 120 +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..6791d545 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,20 @@ +{ + "emmet.includeLanguages": { + "javascript": "javascriptreact" + }, + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnType": true, + "editor.formatOnSave": true, + "editor.tabSize": 4, + "prettier.singleQuote": true, + "prettier.printWidth": 120, + "emmet.triggerExpansionOnTab": true, + "prettier.useTabs": true, + "prettier.trailingComma": "all", + "editor.codeActionsOnSave": { + "source.fixAll.eslint": true + }, + "[php]": { + "editor.defaultFormatter": "bmewburn.vscode-intelephense-client" + } +} diff --git a/CHANGELOG.txt b/CHANGELOG.txt deleted file mode 100644 index 1ce00b9c..00000000 --- a/CHANGELOG.txt +++ /dev/null @@ -1,29 +0,0 @@ -

1.7.3 - 3 November, 2021

- - -

1.7.2 - 23 August, 2021

- - -

1.7.1 - 16 July, 2021

- - - -

1.7.0 - 23 June, 2021

- - - diff --git a/assets/css/animation.css b/assets/css/animation.css index 1eab381f..e936d609 100644 --- a/assets/css/animation.css +++ b/assets/css/animation.css @@ -1,1716 +1,1655 @@ /* Fade */ @-webkit-keyframes fadeCenter { - from { - opacity: 0; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - @keyframes fadeCenter { - from { - opacity: 0; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - .fadeCenter { - -webkit-animation-name: fadeCenter; - animation-name: fadeCenter; - } + from { + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + } + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} +@keyframes fadeCenter { + from { + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + } + + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +.fadeCenter { + -webkit-animation-name: fadeCenter; + animation-name: fadeCenter; +} @-webkit-keyframes fadeUp { - from { - opacity: 0; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - -webkit-transform: translate3d(0, 100%, 0); - transform: translate3d(0, 100%, 0); - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes fadeUp { - from { - opacity: 0; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - -webkit-transform: translate3d(0, 100%, 0); - transform: translate3d(0, 100%, 0); - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .fadeUp { - -webkit-animation-name: fadeUp; - animation-name: fadeUp; - } + from { + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } + + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes fadeUp { + from { + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + } + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.fadeUp { + -webkit-animation-name: fadeUp; + animation-name: fadeUp; +} @-webkit-keyframes fadeRight { - from { - opacity: 0; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - -webkit-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes fadeRight { - from { - opacity: 0; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - -webkit-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .fadeRight { - -webkit-animation-name: fadeRight; - animation-name: fadeRight; - } + from { + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } + + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes fadeRight { + from { + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + } + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.fadeRight { + -webkit-animation-name: fadeRight; + animation-name: fadeRight; +} @-webkit-keyframes fadeDown { - from { - opacity: 0; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - -webkit-transform: translate3d(0, -100%, 0); - transform: translate3d(0, -100%, 0); - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes fadeDown { - from { - opacity: 0; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - -webkit-transform: translate3d(0, -100%, 0); - transform: translate3d(0, -100%, 0); - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .fadeDown { - -webkit-animation-name: fadeDown; - animation-name: fadeDown; - } + from { + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } + + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes fadeDown { + from { + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + } + + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.fadeDown { + -webkit-animation-name: fadeDown; + animation-name: fadeDown; +} @-webkit-keyframes fadeLeft { - from { - opacity: 0; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - -webkit-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes fadeLeft { - from { - opacity: 0; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; - -webkit-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .fadeLeft { - -webkit-animation-name: fadeLeft; - animation-name: fadeLeft; - } + from { + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } + + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes fadeLeft { + from { + opacity: 0; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)"; + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + } + + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.fadeLeft { + -webkit-animation-name: fadeLeft; + animation-name: fadeLeft; +} /* Slide */ @-webkit-keyframes slideUp { - from { - -webkit-transform: translate3d(0, 100%, 0); - transform: translate3d(0, 100%, 0); - visibility: visible; - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes slideUp { - from { - -webkit-transform: translate3d(0, 100%, 0); - transform: translate3d(0, 100%, 0); - visibility: visible; - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .slideUp { - -webkit-animation-name: slideUp; - animation-name: slideUp; - } - - - @-webkit-keyframes slideRight { - from { - -webkit-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - visibility: visible; - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes slideRight { - from { - -webkit-transform: translate3d(100%, 0, 0); - transform: translate3d(100%, 0, 0); - visibility: visible; - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .slideRight { - -webkit-animation-name: slideRight; - animation-name: slideRight; - } + from { + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes slideUp { + from { + -webkit-transform: translate3d(0, 100%, 0); + transform: translate3d(0, 100%, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.slideUp { + -webkit-animation-name: slideUp; + animation-name: slideUp; +} + +@-webkit-keyframes slideRight { + from { + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + visibility: visible; + } + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes slideRight { + from { + -webkit-transform: translate3d(100%, 0, 0); + transform: translate3d(100%, 0, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.slideRight { + -webkit-animation-name: slideRight; + animation-name: slideRight; +} @-webkit-keyframes slideDown { - from { - -webkit-transform: translate3d(0, -100%, 0); - transform: translate3d(0, -100%, 0); - visibility: visible; - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes slideDown { - from { - -webkit-transform: translate3d(0, -100%, 0); - transform: translate3d(0, -100%, 0); - visibility: visible; - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .slideDown { - -webkit-animation-name: slideDown; - animation-name: slideDown; - } - + from { + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes slideDown { + from { + -webkit-transform: translate3d(0, -100%, 0); + transform: translate3d(0, -100%, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.slideDown { + -webkit-animation-name: slideDown; + animation-name: slideDown; +} @-webkit-keyframes slideLeft { - from { - -webkit-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - visibility: visible; - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes slideLeft { - from { - -webkit-transform: translate3d(-100%, 0, 0); - transform: translate3d(-100%, 0, 0); - visibility: visible; - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .slideLeft { - -webkit-animation-name: slideLeft; - animation-name: slideLeft; - } - + from { + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes slideLeft { + from { + -webkit-transform: translate3d(-100%, 0, 0); + transform: translate3d(-100%, 0, 0); + visibility: visible; + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.slideLeft { + -webkit-animation-name: slideLeft; + animation-name: slideLeft; +} + /* Bounce */ @-webkit-keyframes bounce { - from, - 20%, - 53%, - 80%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - - 40%, - 43% { - -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); - animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); - -webkit-transform: translate3d(0, -30px, 0); - transform: translate3d(0, -30px, 0); - } - - 70% { - -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); - animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); - -webkit-transform: translate3d(0, -15px, 0); - transform: translate3d(0, -15px, 0); - } - - 90% { - -webkit-transform: translate3d(0, -4px, 0); - transform: translate3d(0, -4px, 0); - } - } - - @keyframes bounce { - from, - 20%, - 53%, - 80%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - - 40%, - 43% { - -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); - animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); - -webkit-transform: translate3d(0, -30px, 0); - transform: translate3d(0, -30px, 0); - } - - 70% { - -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); - animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); - -webkit-transform: translate3d(0, -15px, 0); - transform: translate3d(0, -15px, 0); - } - - 90% { - -webkit-transform: translate3d(0, -4px, 0); - transform: translate3d(0, -4px, 0); - } - } - - .bounce { - -webkit-animation-name: bounce; - animation-name: bounce; - -webkit-transform-origin: center bottom; - transform-origin: center bottom; - } - - @-webkit-keyframes bounceCenter { - from, - 20%, - 40%, - 60%, - 80%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - } - - 0% { - -webkit-transform: scale3d(0.3, 0.3, 0.3); - transform: scale3d(0.3, 0.3, 0.3); - opacity: 0; - } - - 20% { - -webkit-transform: scale3d(1.1, 1.1, 1.1); - transform: scale3d(1.1, 1.1, 1.1); - } - - 40% { - -webkit-transform: scale3d(0.9, 0.9, 0.9); - transform: scale3d(0.9, 0.9, 0.9); - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(1.03, 1.03, 1.03); - transform: scale3d(1.03, 1.03, 1.03); - } - - 80% { - -webkit-transform: scale3d(0.97, 0.97, 0.97); - transform: scale3d(0.97, 0.97, 0.97); - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(1, 1, 1); - transform: scale3d(1, 1, 1); - } - } - - @keyframes bounceCenter { - from, - 20%, - 40%, - 60%, - 80%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - } - - 0% { - -webkit-transform: scale3d(0.3, 0.3, 0.3); - transform: scale3d(0.3, 0.3, 0.3); - opacity: 0; - } - - 20% { - -webkit-transform: scale3d(1.1, 1.1, 1.1); - transform: scale3d(1.1, 1.1, 1.1); - } - - 40% { - -webkit-transform: scale3d(0.9, 0.9, 0.9); - transform: scale3d(0.9, 0.9, 0.9); - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(1.03, 1.03, 1.03); - transform: scale3d(1.03, 1.03, 1.03); - } - - 80% { - -webkit-transform: scale3d(0.97, 0.97, 0.97); - transform: scale3d(0.97, 0.97, 0.97); - } - - to { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(1, 1, 1); - transform: scale3d(1, 1, 1); - } - } - - .bounceCenter { - -webkit-animation-duration: 0.75s; - animation-duration: 0.75s; - -webkit-animation-name: bounceCenter; - animation-name: bounceCenter; - } - - @-webkit-keyframes bounceDown { - from, - 60%, - 75%, - 90%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - } - - 0% { - - -webkit-transform: translate3d(0, -3000px, 0); - transform: translate3d(0, -3000px, 0); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, 25px, 0); - transform: translate3d(0, 25px, 0); - } - - 75% { - -webkit-transform: translate3d(0, -10px, 0); - transform: translate3d(0, -10px, 0); - } - - 90% { - -webkit-transform: translate3d(0, 5px, 0); - transform: translate3d(0, 5px, 0); - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes bounceDown { - from, - 60%, - 75%, - 90%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - } - - 0% { - - -webkit-transform: translate3d(0, -3000px, 0); - transform: translate3d(0, -3000px, 0); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, 25px, 0); - transform: translate3d(0, 25px, 0); - } - - 75% { - -webkit-transform: translate3d(0, -10px, 0); - transform: translate3d(0, -10px, 0); - } - - 90% { - -webkit-transform: translate3d(0, 5px, 0); - transform: translate3d(0, 5px, 0); - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .bounceDown { - -webkit-animation-name: bounceDown; - animation-name: bounceDown; - } - - @-webkit-keyframes bounceLeft { - from, - 60%, - 75%, - 90%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - } - - 0% { - - -webkit-transform: translate3d(-3000px, 0, 0); - transform: translate3d(-3000px, 0, 0); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(25px, 0, 0); - transform: translate3d(25px, 0, 0); - } - - 75% { - -webkit-transform: translate3d(-10px, 0, 0); - transform: translate3d(-10px, 0, 0); - } - - 90% { - -webkit-transform: translate3d(5px, 0, 0); - transform: translate3d(5px, 0, 0); - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes bounceLeft { - from, - 60%, - 75%, - 90%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - } - - 0% { - - -webkit-transform: translate3d(-3000px, 0, 0); - transform: translate3d(-3000px, 0, 0); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(25px, 0, 0); - transform: translate3d(25px, 0, 0); - } - - 75% { - -webkit-transform: translate3d(-10px, 0, 0); - transform: translate3d(-10px, 0, 0); - } - - 90% { - -webkit-transform: translate3d(5px, 0, 0); - transform: translate3d(5px, 0, 0); - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .bounceLeft { - -webkit-animation-name: bounceLeft; - animation-name: bounceLeft; - } - - @-webkit-keyframes bounceRight { - from, - 60%, - 75%, - 90%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - } - - from { - - -webkit-transform: translate3d(3000px, 0, 0); - transform: translate3d(3000px, 0, 0); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(-25px, 0, 0); - transform: translate3d(-25px, 0, 0); - } - - 75% { - -webkit-transform: translate3d(10px, 0, 0); - transform: translate3d(10px, 0, 0); - } - - 90% { - -webkit-transform: translate3d(-5px, 0, 0); - transform: translate3d(-5px, 0, 0); - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes bounceRight { - from, - 60%, - 75%, - 90%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - } - - from { - - -webkit-transform: translate3d(3000px, 0, 0); - transform: translate3d(3000px, 0, 0); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(-25px, 0, 0); - transform: translate3d(-25px, 0, 0); - } - - 75% { - -webkit-transform: translate3d(10px, 0, 0); - transform: translate3d(10px, 0, 0); - } - - 90% { - -webkit-transform: translate3d(-5px, 0, 0); - transform: translate3d(-5px, 0, 0); - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .bounceRight { - -webkit-animation-name: bounceRight; - animation-name: bounceRight; - } - - @-webkit-keyframes bounceUp { - from, - 60%, - 75%, - 90%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - } - - from { - - -webkit-transform: translate3d(0, 3000px, 0); - transform: translate3d(0, 3000px, 0); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, -20px, 0); - transform: translate3d(0, -20px, 0); - } - - 75% { - -webkit-transform: translate3d(0, 10px, 0); - transform: translate3d(0, 10px, 0); - } - - 90% { - -webkit-transform: translate3d(0, -5px, 0); - transform: translate3d(0, -5px, 0); - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - @keyframes bounceUp { - from, - 60%, - 75%, - 90%, - to { - -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); - } - - from { - - -webkit-transform: translate3d(0, 3000px, 0); - transform: translate3d(0, 3000px, 0); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: translate3d(0, -20px, 0); - transform: translate3d(0, -20px, 0); - } - - 75% { - -webkit-transform: translate3d(0, 10px, 0); - transform: translate3d(0, 10px, 0); - } - - 90% { - -webkit-transform: translate3d(0, -5px, 0); - transform: translate3d(0, -5px, 0); - } - - to { - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - } - } - - .bounceUp { - -webkit-animation-name: bounceUp; - animation-name: bounceUp; - } + from, + 20%, + 53%, + 80%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + 40%, + 43% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + -webkit-transform: translate3d(0, -30px, 0); + transform: translate3d(0, -30px, 0); + } + + 70% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + -webkit-transform: translate3d(0, -15px, 0); + transform: translate3d(0, -15px, 0); + } + + 90% { + -webkit-transform: translate3d(0, -4px, 0); + transform: translate3d(0, -4px, 0); + } +} + +@keyframes bounce { + from, + 20%, + 53%, + 80%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } + + 40%, + 43% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + -webkit-transform: translate3d(0, -30px, 0); + transform: translate3d(0, -30px, 0); + } + + 70% { + -webkit-animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); + -webkit-transform: translate3d(0, -15px, 0); + transform: translate3d(0, -15px, 0); + } + + 90% { + -webkit-transform: translate3d(0, -4px, 0); + transform: translate3d(0, -4px, 0); + } +} + +.bounce { + -webkit-animation-name: bounce; + animation-name: bounce; + -webkit-transform-origin: center bottom; + transform-origin: center bottom; +} + +@-webkit-keyframes bounceCenter { + from, + 20%, + 40%, + 60%, + 80%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + 0% { + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + opacity: 0; + } + + 20% { + -webkit-transform: scale3d(1.1, 1.1, 1.1); + transform: scale3d(1.1, 1.1, 1.1); + } + + 40% { + -webkit-transform: scale3d(0.9, 0.9, 0.9); + transform: scale3d(0.9, 0.9, 0.9); + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(1.03, 1.03, 1.03); + transform: scale3d(1.03, 1.03, 1.03); + } + + 80% { + -webkit-transform: scale3d(0.97, 0.97, 0.97); + transform: scale3d(0.97, 0.97, 0.97); + } + + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} + +@keyframes bounceCenter { + from, + 20%, + 40%, + 60%, + 80%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + 0% { + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + opacity: 0; + } + + 20% { + -webkit-transform: scale3d(1.1, 1.1, 1.1); + transform: scale3d(1.1, 1.1, 1.1); + } + + 40% { + -webkit-transform: scale3d(0.9, 0.9, 0.9); + transform: scale3d(0.9, 0.9, 0.9); + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(1.03, 1.03, 1.03); + transform: scale3d(1.03, 1.03, 1.03); + } + + 80% { + -webkit-transform: scale3d(0.97, 0.97, 0.97); + transform: scale3d(0.97, 0.97, 0.97); + } + + to { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(1, 1, 1); + transform: scale3d(1, 1, 1); + } +} + +.bounceCenter { + -webkit-animation-duration: 0.75s; + animation-duration: 0.75s; + -webkit-animation-name: bounceCenter; + animation-name: bounceCenter; +} + +@-webkit-keyframes bounceDown { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + 0% { + -webkit-transform: translate3d(0, -3000px, 0); + transform: translate3d(0, -3000px, 0); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, 25px, 0); + transform: translate3d(0, 25px, 0); + } + + 75% { + -webkit-transform: translate3d(0, -10px, 0); + transform: translate3d(0, -10px, 0); + } + + 90% { + -webkit-transform: translate3d(0, 5px, 0); + transform: translate3d(0, 5px, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes bounceDown { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + 0% { + -webkit-transform: translate3d(0, -3000px, 0); + transform: translate3d(0, -3000px, 0); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, 25px, 0); + transform: translate3d(0, 25px, 0); + } + + 75% { + -webkit-transform: translate3d(0, -10px, 0); + transform: translate3d(0, -10px, 0); + } + + 90% { + -webkit-transform: translate3d(0, 5px, 0); + transform: translate3d(0, 5px, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.bounceDown { + -webkit-animation-name: bounceDown; + animation-name: bounceDown; +} + +@-webkit-keyframes bounceLeft { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + 0% { + -webkit-transform: translate3d(-3000px, 0, 0); + transform: translate3d(-3000px, 0, 0); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(25px, 0, 0); + transform: translate3d(25px, 0, 0); + } + + 75% { + -webkit-transform: translate3d(-10px, 0, 0); + transform: translate3d(-10px, 0, 0); + } + + 90% { + -webkit-transform: translate3d(5px, 0, 0); + transform: translate3d(5px, 0, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes bounceLeft { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + 0% { + -webkit-transform: translate3d(-3000px, 0, 0); + transform: translate3d(-3000px, 0, 0); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(25px, 0, 0); + transform: translate3d(25px, 0, 0); + } + + 75% { + -webkit-transform: translate3d(-10px, 0, 0); + transform: translate3d(-10px, 0, 0); + } + + 90% { + -webkit-transform: translate3d(5px, 0, 0); + transform: translate3d(5px, 0, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.bounceLeft { + -webkit-animation-name: bounceLeft; + animation-name: bounceLeft; +} + +@-webkit-keyframes bounceRight { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + from { + -webkit-transform: translate3d(3000px, 0, 0); + transform: translate3d(3000px, 0, 0); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(-25px, 0, 0); + transform: translate3d(-25px, 0, 0); + } + + 75% { + -webkit-transform: translate3d(10px, 0, 0); + transform: translate3d(10px, 0, 0); + } + + 90% { + -webkit-transform: translate3d(-5px, 0, 0); + transform: translate3d(-5px, 0, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes bounceRight { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + from { + -webkit-transform: translate3d(3000px, 0, 0); + transform: translate3d(3000px, 0, 0); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(-25px, 0, 0); + transform: translate3d(-25px, 0, 0); + } + + 75% { + -webkit-transform: translate3d(10px, 0, 0); + transform: translate3d(10px, 0, 0); + } + + 90% { + -webkit-transform: translate3d(-5px, 0, 0); + transform: translate3d(-5px, 0, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.bounceRight { + -webkit-animation-name: bounceRight; + animation-name: bounceRight; +} + +@-webkit-keyframes bounceUp { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + from { + -webkit-transform: translate3d(0, 3000px, 0); + transform: translate3d(0, 3000px, 0); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + + 75% { + -webkit-transform: translate3d(0, 10px, 0); + transform: translate3d(0, 10px, 0); + } + + 90% { + -webkit-transform: translate3d(0, -5px, 0); + transform: translate3d(0, -5px, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +@keyframes bounceUp { + from, + 60%, + 75%, + 90%, + to { + -webkit-animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); + } + + from { + -webkit-transform: translate3d(0, 3000px, 0); + transform: translate3d(0, 3000px, 0); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: translate3d(0, -20px, 0); + transform: translate3d(0, -20px, 0); + } + + 75% { + -webkit-transform: translate3d(0, 10px, 0); + transform: translate3d(0, 10px, 0); + } + + 90% { + -webkit-transform: translate3d(0, -5px, 0); + transform: translate3d(0, -5px, 0); + } + + to { + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + } +} + +.bounceUp { + -webkit-animation-name: bounceUp; + animation-name: bounceUp; +} /* Zoom */ - @-webkit-keyframes zoomCenter { - from { - - -webkit-transform: scale3d(0.3, 0.3, 0.3); - transform: scale3d(0.3, 0.3, 0.3); - opacity: 0; - } - - 50% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - @keyframes zoomCenter { - from { - - -webkit-transform: scale3d(0.3, 0.3, 0.3); - transform: scale3d(0.3, 0.3, 0.3); - opacity: 0; - } - - 50% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - .zoomCenter { - -webkit-animation-name: zoomCenter; - animation-name: zoomCenter; - } - - @-webkit-keyframes zoomDown { - from { - - -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); - transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); - -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); - transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); - -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - } - } - - @keyframes zoomDown { - from { - - -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); - transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); - -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); - transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); - -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - } - } - - .zoomDown { - -webkit-animation-name: zoomDown; - animation-name: zoomDown; - } - - @-webkit-keyframes zoomLeft { - from { - - -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); - transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); - -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); - transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); - -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - } - } - - @keyframes zoomLeft { - from { - - -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); - transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); - -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); - transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); - -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - } - } - - .zoomLeft { - -webkit-animation-name: zoomLeft; - animation-name: zoomLeft; - } - - @-webkit-keyframes zoomRight { - from { - - -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); - transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); - -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); - transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); - -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - } - } - - @keyframes zoomRight { - from { - - -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); - transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); - -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); - transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); - -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - } - } - - .zoomRight { - -webkit-animation-name: zoomRight; - animation-name: zoomRight; - } - - @-webkit-keyframes zoomUp { - from { - - -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); - transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); - -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); - transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); - -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - } - } - - @keyframes zoomUp { - from { - - -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); - transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); - -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); - opacity: 0; - } - - 60% { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); - transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); - -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); - } - } - - .zoomUp { - -webkit-animation-name: zoomUp; - animation-name: zoomUp; - } - - - @-webkit-keyframes rotateCenter { - from { - -webkit-transform-origin: center; - transform-origin: center; - -webkit-transform: rotate3d(0, 0, 1, -200deg); - transform: rotate3d(0, 0, 1, -200deg); - opacity: 0; - - } - - to { - -webkit-transform-origin: center; - transform-origin: center; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - @keyframes rotateCenter { - from { - -webkit-transform-origin: center; - transform-origin: center; - -webkit-transform: rotate3d(0, 0, 1, -200deg); - transform: rotate3d(0, 0, 1, -200deg); - opacity: 0; - - } - - to { - -webkit-transform-origin: center; - transform-origin: center; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - .rotateCenter { - -webkit-animation-name: rotateCenter; - animation-name: rotateCenter; - } - - @-webkit-keyframes rotateDownLeft { - from { - -webkit-transform-origin: left bottom; - transform-origin: left bottom; - -webkit-transform: rotate3d(0, 0, 1, -45deg); - transform: rotate3d(0, 0, 1, -45deg); - opacity: 0; - - } - - to { - -webkit-transform-origin: left bottom; - transform-origin: left bottom; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - @keyframes rotateDownLeft { - from { - -webkit-transform-origin: left bottom; - transform-origin: left bottom; - -webkit-transform: rotate3d(0, 0, 1, -45deg); - transform: rotate3d(0, 0, 1, -45deg); - opacity: 0; - - } - - to { - -webkit-transform-origin: left bottom; - transform-origin: left bottom; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - .rotateDownLeft { - -webkit-animation-name: rotateDownLeft; - animation-name: rotateDownLeft; - } - - @-webkit-keyframes rotateDownRight { - from { - -webkit-transform-origin: right bottom; - transform-origin: right bottom; - -webkit-transform: rotate3d(0, 0, 1, 45deg); - transform: rotate3d(0, 0, 1, 45deg); - opacity: 0; - - } - - to { - -webkit-transform-origin: right bottom; - transform-origin: right bottom; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - @keyframes rotateDownRight { - from { - -webkit-transform-origin: right bottom; - transform-origin: right bottom; - -webkit-transform: rotate3d(0, 0, 1, 45deg); - transform: rotate3d(0, 0, 1, 45deg); - opacity: 0; - - } - - to { - -webkit-transform-origin: right bottom; - transform-origin: right bottom; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - .rotateDownRight { - -webkit-animation-name: rotateDownRight; - animation-name: rotateDownRight; - } - - @-webkit-keyframes rotateUpLeft { - from { - -webkit-transform-origin: left bottom; - transform-origin: left bottom; - -webkit-transform: rotate3d(0, 0, 1, 45deg); - transform: rotate3d(0, 0, 1, 45deg); - opacity: 0; - - } - - to { - -webkit-transform-origin: left bottom; - transform-origin: left bottom; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - @keyframes rotateUpLeft { - from { - -webkit-transform-origin: left bottom; - transform-origin: left bottom; - -webkit-transform: rotate3d(0, 0, 1, 45deg); - transform: rotate3d(0, 0, 1, 45deg); - opacity: 0; - - } - - to { - -webkit-transform-origin: left bottom; - transform-origin: left bottom; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - .rotateUpLeft { - -webkit-animation-name: rotateUpLeft; - animation-name: rotateUpLeft; - } - - @-webkit-keyframes rotateUpRight { - from { - -webkit-transform-origin: right bottom; - transform-origin: right bottom; - -webkit-transform: rotate3d(0, 0, 1, -90deg); - transform: rotate3d(0, 0, 1, -90deg); - opacity: 0; - - } - - to { - -webkit-transform-origin: right bottom; - transform-origin: right bottom; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - @keyframes rotateUpRight { - from { - -webkit-transform-origin: right bottom; - transform-origin: right bottom; - -webkit-transform: rotate3d(0, 0, 1, -90deg); - transform: rotate3d(0, 0, 1, -90deg); - opacity: 0; - - } - - to { - -webkit-transform-origin: right bottom; - transform-origin: right bottom; - -webkit-transform: translate3d(0, 0, 0); - transform: translate3d(0, 0, 0); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - } - - .rotateUpRight { - -webkit-animation-name: rotateUpRight; - animation-name: rotateUpRight; - } +@-webkit-keyframes zoomCenter { + from { + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + opacity: 0; + } -/* animation flip */ + 50% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +@keyframes zoomCenter { + from { + -webkit-transform: scale3d(0.3, 0.3, 0.3); + transform: scale3d(0.3, 0.3, 0.3); + opacity: 0; + } + + 50% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} +.zoomCenter { + -webkit-animation-name: zoomCenter; + animation-name: zoomCenter; +} + +@-webkit-keyframes zoomDown { + from { + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +@keyframes zoomDown { + from { + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +.zoomDown { + -webkit-animation-name: zoomDown; + animation-name: zoomDown; +} + +@-webkit-keyframes zoomLeft { + from { + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +@keyframes zoomLeft { + from { + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +.zoomLeft { + -webkit-animation-name: zoomLeft; + animation-name: zoomLeft; +} + +@-webkit-keyframes zoomRight { + from { + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +@keyframes zoomRight { + from { + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +.zoomRight { + -webkit-animation-name: zoomRight; + animation-name: zoomRight; +} + +@-webkit-keyframes zoomUp { + from { + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +@keyframes zoomUp { + from { + -webkit-transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); + transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); + -webkit-animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); + opacity: 0; + } + + 60% { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + -webkit-transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); + -webkit-animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); + } +} + +.zoomUp { + -webkit-animation-name: zoomUp; + animation-name: zoomUp; +} + +@-webkit-keyframes rotateCenter { + from { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: rotate3d(0, 0, 1, -200deg); + transform: rotate3d(0, 0, 1, -200deg); + opacity: 0; + } + + to { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +@keyframes rotateCenter { + from { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: rotate3d(0, 0, 1, -200deg); + transform: rotate3d(0, 0, 1, -200deg); + opacity: 0; + } + + to { + -webkit-transform-origin: center; + transform-origin: center; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +.rotateCenter { + -webkit-animation-name: rotateCenter; + animation-name: rotateCenter; +} + +@-webkit-keyframes rotateDownLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +@keyframes rotateDownLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, -45deg); + transform: rotate3d(0, 0, 1, -45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +.rotateDownLeft { + -webkit-animation-name: rotateDownLeft; + animation-name: rotateDownLeft; +} + +@-webkit-keyframes rotateDownRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +@keyframes rotateDownRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +.rotateDownRight { + -webkit-animation-name: rotateDownRight; + animation-name: rotateDownRight; +} + +@-webkit-keyframes rotateUpLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +@keyframes rotateUpLeft { + from { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: rotate3d(0, 0, 1, 45deg); + transform: rotate3d(0, 0, 1, 45deg); + opacity: 0; + } + + to { + -webkit-transform-origin: left bottom; + transform-origin: left bottom; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +.rotateUpLeft { + -webkit-animation-name: rotateUpLeft; + animation-name: rotateUpLeft; +} + +@-webkit-keyframes rotateUpRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, -90deg); + transform: rotate3d(0, 0, 1, -90deg); + opacity: 0; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +@keyframes rotateUpRight { + from { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: rotate3d(0, 0, 1, -90deg); + transform: rotate3d(0, 0, 1, -90deg); + opacity: 0; + } + + to { + -webkit-transform-origin: right bottom; + transform-origin: right bottom; + -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } +} + +.rotateUpRight { + -webkit-animation-name: rotateUpRight; + animation-name: rotateUpRight; +} + +/* animation flip */ @-webkit-keyframes flipUp { - from { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); - transform: perspective(400px) rotate3d(1, 0, 0, 90deg); - opacity: 0; - } - - 40% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); - transform: perspective(400px) rotate3d(1, 0, 0, -20deg); - } - - 60% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); - transform: perspective(400px) rotate3d(1, 0, 0, 10deg); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - - 80% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); - transform: perspective(400px) rotate3d(1, 0, 0, -5deg); - } - - to { - -webkit-transform: perspective(400px); - transform: perspective(400px); - } - } - - @keyframes flipUp { - from { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); - transform: perspective(400px) rotate3d(1, 0, 0, 90deg); - opacity: 0; - } - - 40% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); - transform: perspective(400px) rotate3d(1, 0, 0, -20deg); - } - - 60% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); - transform: perspective(400px) rotate3d(1, 0, 0, 10deg); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - - 80% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); - transform: perspective(400px) rotate3d(1, 0, 0, -5deg); - } - - to { - -webkit-transform: perspective(400px); - transform: perspective(400px); - } - } - - .flipUp { - -webkit-backface-visibility: visible !important; - backface-visibility: visible !important; - -webkit-animation-name: flipUp; - animation-name: flipUp; - } - - /* flip down */ + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} + +@keyframes flipUp { + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + transform: perspective(400px) rotate3d(1, 0, 0, 90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + transform: perspective(400px) rotate3d(1, 0, 0, -20deg); + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + transform: perspective(400px) rotate3d(1, 0, 0, 10deg); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + transform: perspective(400px) rotate3d(1, 0, 0, -5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} +.flipUp { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipUp; + animation-name: flipUp; +} +/* flip down */ @-webkit-keyframes flipDown { - from { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -90deg); - transform: perspective(400px) rotate3d(1, 0, 0, -90deg); - opacity: 0; - } - - 40% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 20deg); - transform: perspective(400px) rotate3d(1, 0, 0, 20deg); - } - - 60% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -10deg); - transform: perspective(400px) rotate3d(1, 0, 0, -10deg); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - - 80% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 5deg); - transform: perspective(400px) rotate3d(1, 0, 0, 5deg); - } - - to { - -webkit-transform: perspective(400px); - transform: perspective(400px); - } - } - - @keyframes flipDown { - - from { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -90deg); - transform: perspective(400px) rotate3d(1, 0, 0, -90deg); - opacity: 0; - } - - 40% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 20deg); - transform: perspective(400px) rotate3d(1, 0, 0, 20deg); - } - - 60% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -10deg); - transform: perspective(400px) rotate3d(1, 0, 0, -10deg); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - - 80% { - -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 5deg); - transform: perspective(400px) rotate3d(1, 0, 0, 5deg); - } - - to { - -webkit-transform: perspective(400px); - transform: perspective(400px); - } - } - - .flipDown { - -webkit-backface-visibility: visible !important; - backface-visibility: visible !important; - -webkit-animation-name: flipDown; - animation-name: flipDown; - } - - - /* flip right */ - - @-webkit-keyframes flipRight { - from { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); - transform: perspective(400px) rotate3d(0, 1, 0, 90deg); - opacity: 0; - } - - 40% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg); - transform: perspective(400px) rotate3d(0, 1, 0, -20deg); - } - - 60% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg); - transform: perspective(400px) rotate3d(0, 1, 0, 10deg); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - - 80% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg); - transform: perspective(400px) rotate3d(0, 1, 0, -5deg); - } - - to { - -webkit-transform: perspective(400px); - transform: perspective(400px); - } - } - - @keyframes flipRight { - from { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); - transform: perspective(400px) rotate3d(0, 1, 0, 90deg); - opacity: 0; - } - - 40% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg); - transform: perspective(400px) rotate3d(0, 1, 0, -20deg); - } - - 60% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg); - transform: perspective(400px) rotate3d(0, 1, 0, 10deg); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - - 80% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg); - transform: perspective(400px) rotate3d(0, 1, 0, -5deg); - } - - to { - -webkit-transform: perspective(400px); - transform: perspective(400px); - } - } - - .flipRight { - -webkit-backface-visibility: visible !important; - backface-visibility: visible !important; - -webkit-animation-name: flipRight; - animation-name: flipRight; - } - - /* flip left */ - - @-webkit-keyframes flipLeft { - from { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); - transform: perspective(400px) rotate3d(0, 1, 0, 90deg); - opacity: 0; - } - - 40% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg); - transform: perspective(400px) rotate3d(0, 1, 0, -20deg); - } - - 60% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg); - transform: perspective(400px) rotate3d(0, 1, 0, 10deg); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - - 80% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg); - transform: perspective(400px) rotate3d(0, 1, 0, -5deg); - } - - to { - -webkit-transform: perspective(400px); - transform: perspective(400px); - } - } - - @keyframes flipLeft { - from { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -90deg); - transform: perspective(400px) rotate3d(0, 1, 0, -90deg); - opacity: 0; - } - - 40% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 20deg); - transform: perspective(400px) rotate3d(0, 1, 0, 20deg); - } - - 60% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -10deg); - transform: perspective(400px) rotate3d(0, 1, 0, -10deg); - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; - } - - 80% { - -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 5deg); - transform: perspective(400px) rotate3d(0, 1, 0, 5deg); - } - - to { - -webkit-transform: perspective(400px); - transform: perspective(400px); - } - } - - .flipLeft { - -webkit-backface-visibility: visible !important; - backface-visibility: visible !important; - -webkit-animation-name: flipLeft; - animation-name: flipLeft; - } - - /* fold animation */ - - - @-webkit-keyframes foldUp { - from { - -webkit-transform: perspective(400px) rotateX(-80deg); - transform: perspective(400px) rotateX(-80deg); - -webkit-transform-origin: top; - transform-origin: top; - - } - - to { - -webkit-transform: perspective(400px) rotateX(0deg); - transform: perspective(400px) rotateX(0deg); - -webkit-transform-origin: top; - transform-origin: top; - } - } - - - @keyframes foldUp { - from { - -webkit-transform: perspective(400px) rotateX(-80deg); - transform: perspective(400px) rotateX(-80deg); - -webkit-transform-origin: top; - transform-origin: top; - - } - - to { - -webkit-transform: perspective(400px) rotateX(0deg); - transform: perspective(400px) rotateX(0deg); - -webkit-transform-origin: top; - transform-origin: top; - } - } - - .foldUp { - -webkit-animation-name: foldUp; - animation-name: foldUp; - } - - - - @-webkit-keyframes foldDown { - from { - -webkit-transform: perspective(400px) rotateX(80deg); - transform: perspective(400px) rotateX(80deg); - -webkit-transform-origin: bottom; - transform-origin: bottom; - - } - - to { - -webkit-transform: perspective(400px) rotateX(0deg); - transform: perspective(400px) rotateX(0deg); - -webkit-transform-origin: bottom; - transform-origin: bottom; - } - } - - - - @keyframes foldDown { - from { - -webkit-transform: perspective(400px) rotateX(80deg); - transform: perspective(400px) rotateX(80deg); - -webkit-transform-origin: bottom; - transform-origin: bottom; - - } - - to { - -webkit-transform: perspective(400px) rotateX(0deg); - transform: perspective(400px) rotateX(0deg); - -webkit-transform-origin: bottom; - transform-origin: bottom; - } - } - - .foldDown { - -webkit-animation-name: foldDown; - animation-name: foldDown; - } - - - - @-webkit-keyframes foldRight { - from { - -webkit-transform: perspective(400px) rotateY(-80deg); - transform: perspective(400px) rotateY(-80deg); - -webkit-transform-origin: right; - transform-origin: right; - - } - - to { - -webkit-transform: perspective(400px) rotateY(0deg); - transform: perspective(400px) rotateY(0deg); - -webkit-transform-origin: right; - transform-origin: right; - } - } - - - - @keyframes foldRight { - from { - -webkit-transform: perspective(400px) rotateY(-80deg); - transform: perspective(400px) rotateY(-80deg); - -webkit-transform-origin: right; - transform-origin: right; - - } - - to { - -webkit-transform: perspective(400px) rotateY(0deg); - transform: perspective(400px) rotateY(0deg); - -webkit-transform-origin: right; - transform-origin: right; - } - } - - .foldRight { - -webkit-animation-name: foldRight; - animation-name: foldRight; - } - - - @-webkit-keyframes foldLeft { - from { - -webkit-transform: perspective(400px) rotateY(80deg); - transform: perspective(400px) rotateY(80deg); - -webkit-transform-origin: left; - transform-origin: left; - - } - - to { - -webkit-transform: perspective(400px) rotateY(0deg); - transform: perspective(400px) rotateY(0deg); - -webkit-transform-origin: left; - transform-origin: left; - } - } - - - @keyframes foldLeft { - from { - -webkit-transform: perspective(400px) rotateY(80deg); - transform: perspective(400px) rotateY(80deg); - -webkit-transform-origin: left; - transform-origin: left; - - } - - to { - -webkit-transform: perspective(400px) rotateY(0deg); - transform: perspective(400px) rotateY(0deg); - -webkit-transform-origin: left; - transform-origin: left; - } - } - - .foldLeft { - -webkit-animation-name: foldLeft; - animation-name: foldLeft; - } \ No newline at end of file + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -90deg); + transform: perspective(400px) rotate3d(1, 0, 0, -90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 20deg); + transform: perspective(400px) rotate3d(1, 0, 0, 20deg); + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -10deg); + transform: perspective(400px) rotate3d(1, 0, 0, -10deg); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 5deg); + transform: perspective(400px) rotate3d(1, 0, 0, 5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} + +@keyframes flipDown { + from { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -90deg); + transform: perspective(400px) rotate3d(1, 0, 0, -90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 20deg); + transform: perspective(400px) rotate3d(1, 0, 0, 20deg); + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, -10deg); + transform: perspective(400px) rotate3d(1, 0, 0, -10deg); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(1, 0, 0, 5deg); + transform: perspective(400px) rotate3d(1, 0, 0, 5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} + +.flipDown { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipDown; + animation-name: flipDown; +} + +/* flip right */ + +@-webkit-keyframes flipRight { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} + +@keyframes flipRight { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} + +.flipRight { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipRight; + animation-name: flipRight; +} + +/* flip left */ + +@-webkit-keyframes flipLeft { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + transform: perspective(400px) rotate3d(0, 1, 0, 90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + transform: perspective(400px) rotate3d(0, 1, 0, -20deg); + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + transform: perspective(400px) rotate3d(0, 1, 0, 10deg); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + transform: perspective(400px) rotate3d(0, 1, 0, -5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} + +@keyframes flipLeft { + from { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -90deg); + transform: perspective(400px) rotate3d(0, 1, 0, -90deg); + opacity: 0; + } + + 40% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 20deg); + transform: perspective(400px) rotate3d(0, 1, 0, 20deg); + } + + 60% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, -10deg); + transform: perspective(400px) rotate3d(0, 1, 0, -10deg); + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + } + + 80% { + -webkit-transform: perspective(400px) rotate3d(0, 1, 0, 5deg); + transform: perspective(400px) rotate3d(0, 1, 0, 5deg); + } + + to { + -webkit-transform: perspective(400px); + transform: perspective(400px); + } +} + +.flipLeft { + -webkit-backface-visibility: visible !important; + backface-visibility: visible !important; + -webkit-animation-name: flipLeft; + animation-name: flipLeft; +} + +/* fold animation */ + +@-webkit-keyframes foldUp { + from { + -webkit-transform: perspective(400px) rotateX(-80deg); + transform: perspective(400px) rotateX(-80deg); + -webkit-transform-origin: top; + transform-origin: top; + } + + to { + -webkit-transform: perspective(400px) rotateX(0deg); + transform: perspective(400px) rotateX(0deg); + -webkit-transform-origin: top; + transform-origin: top; + } +} + +@keyframes foldUp { + from { + -webkit-transform: perspective(400px) rotateX(-80deg); + transform: perspective(400px) rotateX(-80deg); + -webkit-transform-origin: top; + transform-origin: top; + } + + to { + -webkit-transform: perspective(400px) rotateX(0deg); + transform: perspective(400px) rotateX(0deg); + -webkit-transform-origin: top; + transform-origin: top; + } +} + +.foldUp { + -webkit-animation-name: foldUp; + animation-name: foldUp; +} + +@-webkit-keyframes foldDown { + from { + -webkit-transform: perspective(400px) rotateX(80deg); + transform: perspective(400px) rotateX(80deg); + -webkit-transform-origin: bottom; + transform-origin: bottom; + } + + to { + -webkit-transform: perspective(400px) rotateX(0deg); + transform: perspective(400px) rotateX(0deg); + -webkit-transform-origin: bottom; + transform-origin: bottom; + } +} + +@keyframes foldDown { + from { + -webkit-transform: perspective(400px) rotateX(80deg); + transform: perspective(400px) rotateX(80deg); + -webkit-transform-origin: bottom; + transform-origin: bottom; + } + + to { + -webkit-transform: perspective(400px) rotateX(0deg); + transform: perspective(400px) rotateX(0deg); + -webkit-transform-origin: bottom; + transform-origin: bottom; + } +} + +.foldDown { + -webkit-animation-name: foldDown; + animation-name: foldDown; +} + +@-webkit-keyframes foldRight { + from { + -webkit-transform: perspective(400px) rotateY(-80deg); + transform: perspective(400px) rotateY(-80deg); + -webkit-transform-origin: right; + transform-origin: right; + } + + to { + -webkit-transform: perspective(400px) rotateY(0deg); + transform: perspective(400px) rotateY(0deg); + -webkit-transform-origin: right; + transform-origin: right; + } +} + +@keyframes foldRight { + from { + -webkit-transform: perspective(400px) rotateY(-80deg); + transform: perspective(400px) rotateY(-80deg); + -webkit-transform-origin: right; + transform-origin: right; + } + + to { + -webkit-transform: perspective(400px) rotateY(0deg); + transform: perspective(400px) rotateY(0deg); + -webkit-transform-origin: right; + transform-origin: right; + } +} + +.foldRight { + -webkit-animation-name: foldRight; + animation-name: foldRight; +} + +@-webkit-keyframes foldLeft { + from { + -webkit-transform: perspective(400px) rotateY(80deg); + transform: perspective(400px) rotateY(80deg); + -webkit-transform-origin: left; + transform-origin: left; + } + + to { + -webkit-transform: perspective(400px) rotateY(0deg); + transform: perspective(400px) rotateY(0deg); + -webkit-transform-origin: left; + transform-origin: left; + } +} + +@keyframes foldLeft { + from { + -webkit-transform: perspective(400px) rotateY(80deg); + transform: perspective(400px) rotateY(80deg); + -webkit-transform-origin: left; + transform-origin: left; + } + + to { + -webkit-transform: perspective(400px) rotateY(0deg); + transform: perspective(400px) rotateY(0deg); + -webkit-transform-origin: left; + transform-origin: left; + } +} + +.foldLeft { + -webkit-animation-name: foldLeft; + animation-name: foldLeft; +} diff --git a/assets/css/magnific-popup.css b/assets/css/magnific-popup.css index 2be2b031..d4cfa58e 100755 --- a/assets/css/magnific-popup.css +++ b/assets/css/magnific-popup.css @@ -1,432 +1,431 @@ /* Magnific Popup CSS */ .mfp-bg { - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 1042; - overflow: hidden; - position: fixed; - background: #0b0b0b; - opacity: 0.8; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1042; + overflow: hidden; + position: fixed; + background: #0b0b0b; + opacity: 0.8; } .mfp-wrap { - top: 0; - left: 0; - width: 100%; - height: 100%; - z-index: 1043; - position: fixed; - outline: none !important; - -webkit-backface-visibility: hidden; + top: 0; + left: 0; + width: 100%; + height: 100%; + z-index: 1043; + position: fixed; + outline: none !important; + -webkit-backface-visibility: hidden; } .mfp-container { - text-align: center; - position: absolute; - width: 100%; - height: 100%; - left: 0; - top: 0; - padding: 0 8px; - box-sizing: border-box; + text-align: center; + position: absolute; + width: 100%; + height: 100%; + left: 0; + top: 0; + padding: 0 8px; + box-sizing: border-box; } .mfp-container:before { - content: ""; - display: inline-block; - height: 100%; - vertical-align: middle; + content: ""; + display: inline-block; + height: 100%; + vertical-align: middle; } .mfp-align-top .mfp-container:before { - display: none; + display: none; } .mfp-content { - position: relative; - display: inline-block; - vertical-align: middle; - margin: 0 auto; - text-align: left; - z-index: 1045; + position: relative; + display: inline-block; + vertical-align: middle; + margin: 0 auto; + text-align: left; + z-index: 1045; } .mfp-inline-holder .mfp-content, .mfp-ajax-holder .mfp-content { - width: 100%; - cursor: auto; + width: 100%; + cursor: auto; } .mfp-ajax-cur { - cursor: progress; + cursor: progress; } .mfp-zoom-out-cur, .mfp-zoom-out-cur .mfp-image-holder .mfp-close { - cursor: -moz-zoom-out; - cursor: -webkit-zoom-out; - cursor: zoom-out; + cursor: -moz-zoom-out; + cursor: -webkit-zoom-out; + cursor: zoom-out; } .mfp-zoom { - cursor: pointer; - cursor: -webkit-zoom-in; - cursor: -moz-zoom-in; - cursor: zoom-in; + cursor: pointer; + cursor: -webkit-zoom-in; + cursor: -moz-zoom-in; + cursor: zoom-in; } .mfp-auto-cursor .mfp-content { - cursor: auto; + cursor: auto; } .mfp-close, .mfp-arrow, .mfp-preloader, .mfp-counter { - -webkit-user-select: none; - -moz-user-select: none; - user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + user-select: none; } .mfp-loading.mfp-figure { - display: none; + display: none; } .mfp-hide { - display: none !important; + display: none !important; } .mfp-preloader { - color: #ccc; - position: absolute; - top: 50%; - width: auto; - text-align: center; - margin-top: -0.8em; - left: 8px; - right: 8px; - z-index: 1044; + color: #ccc; + position: absolute; + top: 50%; + width: auto; + text-align: center; + margin-top: -0.8em; + left: 8px; + right: 8px; + z-index: 1044; } .mfp-preloader a { - color: #ccc; + color: #ccc; } .mfp-preloader a:hover { - color: #fff; + color: #fff; } .mfp-s-ready .mfp-preloader { - display: none; + display: none; } .mfp-s-error .mfp-content { - display: none; + display: none; } button.mfp-close, button.mfp-arrow { - overflow: visible; - cursor: pointer; - background: transparent; - border: 0; - -webkit-appearance: none; - display: block; - outline: none; - padding: 0; - z-index: 1046; - box-shadow: none; - touch-action: manipulation; + overflow: visible; + cursor: pointer; + background: transparent; + border: 0; + -webkit-appearance: none; + display: block; + outline: none; + padding: 0; + z-index: 1046; + box-shadow: none; + touch-action: manipulation; } button::-moz-focus-inner { - padding: 0; - border: 0; + padding: 0; + border: 0; } .mfp-close { - width: 44px; - height: 44px; - line-height: 44px; - position: absolute; - right: 0; - top: 0; - text-decoration: none; - text-align: center; - opacity: 0.65; - padding: 0 0 18px 10px; - color: #fff; - font-style: normal; - font-size: 28px; - font-family: Arial, Baskerville, monospace; + width: 44px; + height: 44px; + line-height: 44px; + position: absolute; + right: 0; + top: 0; + text-decoration: none; + text-align: center; + opacity: 0.65; + padding: 0 0 18px 10px; + color: #fff; + font-style: normal; + font-size: 28px; + font-family: Arial, Baskerville, monospace; } .mfp-close:hover, .mfp-close:focus { - opacity: 1; + opacity: 1; } .mfp-close:active { - top: 1px; + top: 1px; } .mfp-close-btn-in .mfp-close { - color: #333; + color: #333; } .mfp-image-holder .mfp-close, .mfp-iframe-holder .mfp-close { - color: #fff; - right: -6px; - text-align: right; - padding-right: 6px; - width: 100%; + color: #fff; + right: -6px; + text-align: right; + padding-right: 6px; + width: 100%; } .mfp-counter { - position: absolute; - top: 0; - right: 0; - color: #ccc; - font-size: 12px; - line-height: 18px; - white-space: nowrap; + position: absolute; + top: 0; + right: 0; + color: #ccc; + font-size: 12px; + line-height: 18px; + white-space: nowrap; } .mfp-arrow { - position: absolute; - opacity: 0.65; - margin: 0; - top: 50%; - margin-top: -55px; - padding: 0; - width: 90px; - height: 110px; - -webkit-tap-highlight-color: transparent; + position: absolute; + opacity: 0.65; + margin: 0; + top: 50%; + margin-top: -55px; + padding: 0; + width: 90px; + height: 110px; + -webkit-tap-highlight-color: transparent; } .mfp-arrow:active { - margin-top: -54px; + margin-top: -54px; } .mfp-arrow:hover, .mfp-arrow:focus { - opacity: 1; + opacity: 1; } .mfp-arrow:before, .mfp-arrow:after { - content: ""; - display: block; - width: 0; - height: 0; - position: absolute; - left: 0; - top: 0; - margin-top: 35px; - margin-left: 35px; - border: medium inset transparent; + content: ""; + display: block; + width: 0; + height: 0; + position: absolute; + left: 0; + top: 0; + margin-top: 35px; + margin-left: 35px; + border: medium inset transparent; } .mfp-arrow:after { - border-top-width: 13px; - border-bottom-width: 13px; - top: 8px; + border-top-width: 13px; + border-bottom-width: 13px; + top: 8px; } .mfp-arrow:before { - border-top-width: 21px; - border-bottom-width: 21px; - opacity: 0.7; + border-top-width: 21px; + border-bottom-width: 21px; + opacity: 0.7; } .mfp-arrow-left { - left: 0; + left: 0; } .mfp-arrow-left:after { - border-right: 17px solid #fff; - margin-left: 31px; + border-right: 17px solid #fff; + margin-left: 31px; } .mfp-arrow-left:before { - margin-left: 25px; - border-right: 27px solid #3f3f3f; + margin-left: 25px; + border-right: 27px solid #3f3f3f; } .mfp-arrow-right { - right: 0; + right: 0; } .mfp-arrow-right:after { - border-left: 17px solid #fff; - margin-left: 39px; + border-left: 17px solid #fff; + margin-left: 39px; } .mfp-arrow-right:before { - border-left: 27px solid #3f3f3f; + border-left: 27px solid #3f3f3f; } .mfp-iframe-holder { - padding-top: 40px; - padding-bottom: 40px; + padding-top: 40px; + padding-bottom: 40px; } .mfp-iframe-holder .mfp-content { - line-height: 0; - width: 100%; - max-width: 900px; + line-height: 0; + width: 100%; + max-width: 900px; } .mfp-iframe-holder .mfp-close { - top: -40px; + top: -40px; } .mfp-iframe-scaler { - width: 100%; - height: 0; - overflow: hidden; - padding-top: 56.25%; + width: 100%; + height: 0; + overflow: hidden; + padding-top: 56.25%; } .mfp-iframe-scaler button:hover { - background-color: transparent; + background-color: transparent; } -.mfp-iframe-scaler button:focus{ - outline: 0; +.mfp-iframe-scaler button:focus { + outline: 0; } .mfp-iframe-scaler iframe { - position: absolute; - display: block; - top: 0; - left: 0; - width: 100%; - height: 100%; - box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); - background: #000; + position: absolute; + display: block; + top: 0; + left: 0; + width: 100%; + height: 100%; + box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); + background: #000; } /* Main image in popup */ img.mfp-img { - width: auto; - max-width: 100%; - height: auto; - display: block; - line-height: 0; - box-sizing: border-box; - padding: 40px 0 40px; - margin: 0 auto; + width: auto; + max-width: 100%; + height: auto; + display: block; + line-height: 0; + box-sizing: border-box; + padding: 40px 0 40px; + margin: 0 auto; } /* The shadow behind the image */ .mfp-figure { - line-height: 0; + line-height: 0; } .mfp-figure:after { - content: ""; - position: absolute; - left: 0; - top: 40px; - bottom: 40px; - display: block; - right: 0; - width: auto; - height: auto; - z-index: -1; - box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); - background: #444; + content: ""; + position: absolute; + left: 0; + top: 40px; + bottom: 40px; + display: block; + right: 0; + width: auto; + height: auto; + z-index: -1; + box-shadow: 0 0 8px rgba(0, 0, 0, 0.6); + background: #444; } .mfp-figure small { - color: #bdbdbd; - display: block; - font-size: 12px; - line-height: 14px; + color: #bdbdbd; + display: block; + font-size: 12px; + line-height: 14px; } .mfp-figure figure { - margin: 0; + margin: 0; } .mfp-bottom-bar { - margin-top: -36px; - position: absolute; - top: 100%; - left: 0; - width: 100%; - cursor: auto; + margin-top: -36px; + position: absolute; + top: 100%; + left: 0; + width: 100%; + cursor: auto; } .mfp-title { - text-align: left; - line-height: 18px; - color: #f3f3f3; - word-wrap: break-word; - padding-right: 36px; + text-align: left; + line-height: 18px; + color: #f3f3f3; + word-wrap: break-word; + padding-right: 36px; } .mfp-image-holder .mfp-content { - max-width: 100%; + max-width: 100%; } .mfp-gallery .mfp-image-holder .mfp-figure { - cursor: pointer; + cursor: pointer; } -@media screen and (max-width: 800px) and (orientation: landscape), - screen and (max-height: 300px) { - /** +@media screen and (max-width: 800px) and (orientation: landscape), screen and (max-height: 300px) { + /** * Remove all paddings around the image on small screen */ - .mfp-img-mobile .mfp-image-holder { - padding-left: 0; - padding-right: 0; - } - .mfp-img-mobile img.mfp-img { - padding: 0; - } - .mfp-img-mobile .mfp-figure:after { - top: 0; - bottom: 0; - } - .mfp-img-mobile .mfp-figure small { - display: inline; - margin-left: 5px; - } - .mfp-img-mobile .mfp-bottom-bar { - background: rgba(0, 0, 0, 0.6); - bottom: 0; - margin: 0; - top: auto; - padding: 3px 5px; - position: fixed; - box-sizing: border-box; - } - .mfp-img-mobile .mfp-bottom-bar:empty { - padding: 0; - } - .mfp-img-mobile .mfp-counter { - right: 5px; - top: 3px; - } - .mfp-img-mobile .mfp-close { - top: 0; - right: 0; - width: 35px; - height: 35px; - line-height: 35px; - background: rgba(0, 0, 0, 0.6); - position: fixed; - text-align: center; - padding: 0; - } + .mfp-img-mobile .mfp-image-holder { + padding-left: 0; + padding-right: 0; + } + .mfp-img-mobile img.mfp-img { + padding: 0; + } + .mfp-img-mobile .mfp-figure:after { + top: 0; + bottom: 0; + } + .mfp-img-mobile .mfp-figure small { + display: inline; + margin-left: 5px; + } + .mfp-img-mobile .mfp-bottom-bar { + background: rgba(0, 0, 0, 0.6); + bottom: 0; + margin: 0; + top: auto; + padding: 3px 5px; + position: fixed; + box-sizing: border-box; + } + .mfp-img-mobile .mfp-bottom-bar:empty { + padding: 0; + } + .mfp-img-mobile .mfp-counter { + right: 5px; + top: 3px; + } + .mfp-img-mobile .mfp-close { + top: 0; + right: 0; + width: 35px; + height: 35px; + line-height: 35px; + background: rgba(0, 0, 0, 0.6); + position: fixed; + text-align: center; + padding: 0; + } } @media all and (max-width: 900px) { - .mfp-arrow { - -webkit-transform: scale(0.75); - transform: scale(0.75); - } - .mfp-arrow-left { - -webkit-transform-origin: 0; - transform-origin: 0; - } - .mfp-arrow-right { - -webkit-transform-origin: 100%; - transform-origin: 100%; - } - .mfp-container { - padding-left: 6px; - padding-right: 6px; - } -} - -#adminmenu .toplevel_page_qubely-settings .wp-menu-image > img{ - width: 19px !important; - margin: 7.5px 9px; - display: block; - padding: 0; -} \ No newline at end of file + .mfp-arrow { + -webkit-transform: scale(0.75); + transform: scale(0.75); + } + .mfp-arrow-left { + -webkit-transform-origin: 0; + transform-origin: 0; + } + .mfp-arrow-right { + -webkit-transform-origin: 100%; + transform-origin: 100%; + } + .mfp-container { + padding-left: 6px; + padding-right: 6px; + } +} + +#adminmenu .toplevel_page_qubely-settings .wp-menu-image > img { + width: 19px !important; + margin: 7.5px 9px; + display: block; + padding: 0; +} diff --git a/assets/css/options.css b/assets/css/options.css index 0c86f5fe..6465c4b4 100644 --- a/assets/css/options.css +++ b/assets/css/options.css @@ -192,7 +192,7 @@ p { } .qubely-getting-started { font-family: "Lato", sans-serif; - color: rgba(36, 47, 87, 0.70); + color: rgba(36, 47, 87, 0.7); font-size: 14px; } .qubely-getting-started img { @@ -226,7 +226,6 @@ p { } @media only screen and (max-width: 700px) { - .qubely-column-3, .qubely-column-2 { grid-template-columns: 1fr; @@ -250,8 +249,8 @@ p { .qubely-cta-card > img { position: absolute; - right: -10px; - bottom: -60px; + right: -10px; + bottom: -60px; z-index: -1; height: 90%; width: auto; @@ -280,13 +279,13 @@ p { transition: 300ms; } .qubely-gs-card-compact:hover { - box-shadow: 0 30px 30px -10px rgba(28, 41, 90, 0.10), 0 0 0 2px #2e98ff inset; + box-shadow: 0 30px 30px -10px rgba(28, 41, 90, 0.1), 0 0 0 2px #2e98ff inset; } .qubely-gs-card-compact > span { height: 60px; flex-basis: 60px; max-width: 60px; - background: rgba(213, 234, 255, 0.20); + background: rgba(213, 234, 255, 0.2); border: 1px solid #d5eaff; display: flex; align-items: center; @@ -295,18 +294,18 @@ p { font-size: 25px; color: #2e98ff; } -.qubely-gs-card-compact > span > img{ +.qubely-gs-card-compact > span > img { width: 1em; } .qubely-gs-card-compact:nth-child(2n) > span { - background: rgba(218, 247, 240, 0.20); + background: rgba(218, 247, 240, 0.2); border: 1px solid #daf7f0; color: #1fd0a3; } .qubely-gs-card-compact:nth-child(3n) > span { - background: rgba(231, 230, 254, 0.20); + background: rgba(231, 230, 254, 0.2); border: 1px solid #e7e6fe; color: #665cfe; } @@ -343,7 +342,7 @@ p { .qubely-gs-card .qubely-gs-card-title.is-large { padding: 0 30px 30px; margin: 0 -30px 28px; - border-bottom: 1px solid #EAEDF7; + border-bottom: 1px solid #eaedf7; } .qubely-gs-card .qubely-gs-card-title h2 { font-size: 26px; @@ -357,7 +356,7 @@ p { } .qubely-gs-card .qubely-gs-card-title a { font-size: 16px; - color: #007AFF; + color: #007aff; text-decoration: none; transition: 300ms; } @@ -400,7 +399,7 @@ p { .qubely-gs-card-content.qubely-gs-changelog h3 { font-size: 18px; font-weight: 400; - color: #242F57; + color: #242f57; } .qubely-gs-card-content.qubely-gs-changelog h3:first-child { margin-top: 0; @@ -482,7 +481,7 @@ p { .qubely-gs-button:hover { color: #007aff; - box-shadow: 0 20px 30px rgba(19, 42, 67, 0.20); + box-shadow: 0 20px 30px rgba(19, 42, 67, 0.2); } .qubely-gs-button.link:hover { box-shadow: none !important; @@ -507,7 +506,7 @@ p { background: none; } -.qubely-gs-card-footer{ +.qubely-gs-card-footer { margin-top: 24px; } @@ -523,10 +522,10 @@ p { border-radius: 5px; } .qubely-gs-post-card a:first-child:hover { - box-shadow: 0 10px 20px -10px rgba(19, 42, 67, 0.20); + box-shadow: 0 10px 20px -10px rgba(19, 42, 67, 0.2); } .qubely-gs-post-card a { - color: #242F57; + color: #242f57; display: block; text-decoration: none; line-height: 20px; @@ -538,7 +537,7 @@ p { } .qubely-gs-post-card a:hover { - color: #007AFF; + color: #007aff; } .qubely-gs-post-card span { @@ -549,7 +548,7 @@ p { } .qubely-gs-post-card.card-placeholder span, -.qubely-gs-post-card.card-placeholder a{ +.qubely-gs-post-card.card-placeholder a { background: #f1f1f1; color: transparent !important; pointer-events: none; @@ -571,6 +570,6 @@ p { transition: 200ms; } -.qubely-gs-social-links a:hover{ - color: #007AFF; +.qubely-gs-social-links a:hover { + color: #007aff; } diff --git a/assets/css/qubely.animatedheadline.css b/assets/css/qubely.animatedheadline.css index 5e6589e2..d13aab48 100755 --- a/assets/css/qubely.animatedheadline.css +++ b/assets/css/qubely.animatedheadline.css @@ -1,4 +1,3 @@ - /* text animation for animated heading addon */ .animated-text-words-wrapper { position: relative; @@ -13,7 +12,8 @@ left: 0; top: 0; } -.animated-text i, .animated-text em{ +.animated-text i, +.animated-text em { font-style: normal; } .animated-text-words-wrapper span.is-visible { @@ -147,7 +147,7 @@ Delete typing } .animated-heading-text.type .animated-text-words-wrapper::after { /* vertical bar */ - content: ''; + content: ""; position: absolute; right: 0; top: 50%; @@ -229,7 +229,8 @@ Wave -webkit-perspective: 300px; perspective: 300px; } -.animated-heading-text.animation-wave i, .animated-heading-text.animation-wave em { +.animated-heading-text.animation-wave i, +.animated-heading-text.animation-wave em { display: inline-block; -webkit-backface-visibility: hidden; backface-visibility: hidden; @@ -355,7 +356,7 @@ Loading Bar } .animated-heading-text.loading-bar .animated-text-words-wrapper::after { /* loading bar */ - content: ''; + content: ""; position: absolute; left: 0; bottom: 0; @@ -394,7 +395,7 @@ Slide } .animated-heading-text.slide .animated-text { opacity: 0; - top: .2em; + top: 0.2em; } .animated-heading-text.slide span.is-visible { top: 0; @@ -484,7 +485,7 @@ Clip } .animated-heading-text.text-clip .animated-text-words-wrapper::after { /* line */ - content: ''; + content: ""; position: absolute; top: 0; right: 0; diff --git a/assets/img/.DS_Store b/assets/img/.DS_Store deleted file mode 100644 index 76204d53..00000000 Binary files a/assets/img/.DS_Store and /dev/null differ diff --git a/assets/img/Qubely-Q.svg b/assets/img/Qubely-Q.svg deleted file mode 100644 index 93aa08f4..00000000 --- a/assets/img/Qubely-Q.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - Asset 29@2x - Created with Sketch. - - - - - - - - - - - - \ No newline at end of file diff --git a/assets/img/admin/blocks.svg b/assets/img/admin/blocks.svg index 463283ab..2df365e4 100644 --- a/assets/img/admin/blocks.svg +++ b/assets/img/admin/blocks.svg @@ -1,19 +1 @@ - - - - -Group 29 - - - - - - + \ No newline at end of file diff --git a/assets/img/admin/cta-1.png b/assets/img/admin/cta-1.png index e62ed306..b35ac162 100644 Binary files a/assets/img/admin/cta-1.png and b/assets/img/admin/cta-1.png differ diff --git a/assets/img/admin/cta-2.png b/assets/img/admin/cta-2.png index b1208371..3aa74cb8 100644 Binary files a/assets/img/admin/cta-2.png and b/assets/img/admin/cta-2.png differ diff --git a/assets/img/admin/join-fb.svg b/assets/img/admin/join-fb.svg index 736d2ae5..86523e33 100644 --- a/assets/img/admin/join-fb.svg +++ b/assets/img/admin/join-fb.svg @@ -1,113 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/assets/img/admin/keep-in-touch.svg b/assets/img/admin/keep-in-touch.svg index c49fdf74..941060aa 100644 --- a/assets/img/admin/keep-in-touch.svg +++ b/assets/img/admin/keep-in-touch.svg @@ -1,89 +1 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + \ No newline at end of file diff --git a/assets/img/admin/pointer@1x.png b/assets/img/admin/pointer@1x.png index bf9de46c..4379de29 100644 Binary files a/assets/img/admin/pointer@1x.png and b/assets/img/admin/pointer@1x.png differ diff --git a/assets/img/admin/pointer@2x.png b/assets/img/admin/pointer@2x.png index 78c40dca..45d4eb50 100644 Binary files a/assets/img/admin/pointer@2x.png and b/assets/img/admin/pointer@2x.png differ diff --git a/assets/img/admin/qubely-option-logo.jpg b/assets/img/admin/qubely-option-logo.jpg index ad2326cb..0e29a6d9 100644 Binary files a/assets/img/admin/qubely-option-logo.jpg and b/assets/img/admin/qubely-option-logo.jpg differ diff --git a/assets/img/admin/sections.svg b/assets/img/admin/sections.svg index ec36cdbf..a490cc54 100644 --- a/assets/img/admin/sections.svg +++ b/assets/img/admin/sections.svg @@ -1,18 +1 @@ - - - - -Group 29 - - - - - - + \ No newline at end of file diff --git a/assets/img/admin/starter-pack.svg b/assets/img/admin/starter-pack.svg index 3d510482..f404ba58 100644 --- a/assets/img/admin/starter-pack.svg +++ b/assets/img/admin/starter-pack.svg @@ -1,17 +1 @@ - - - - -Group 29 - - - - - - + \ No newline at end of file diff --git a/assets/img/admin/thumbs-up@1x.png b/assets/img/admin/thumbs-up@1x.png index b99f054f..628de508 100644 Binary files a/assets/img/admin/thumbs-up@1x.png and b/assets/img/admin/thumbs-up@1x.png differ diff --git a/assets/img/admin/thumbs-up@2x.png b/assets/img/admin/thumbs-up@2x.png index 214327ed..7fc65ee5 100644 Binary files a/assets/img/admin/thumbs-up@2x.png and b/assets/img/admin/thumbs-up@2x.png differ diff --git a/assets/img/blocks/map/aqua-light.jpg b/assets/img/blocks/map/aqua-light.jpg index 090395e3..ab4752ff 100644 Binary files a/assets/img/blocks/map/aqua-light.jpg and b/assets/img/blocks/map/aqua-light.jpg differ diff --git a/assets/img/blocks/map/greyscale.jpg b/assets/img/blocks/map/greyscale.jpg index 66922216..7136144a 100644 Binary files a/assets/img/blocks/map/greyscale.jpg and b/assets/img/blocks/map/greyscale.jpg differ diff --git a/assets/img/blocks/map/inturlam.jpg b/assets/img/blocks/map/inturlam.jpg index 3f7da853..f1286f01 100644 Binary files a/assets/img/blocks/map/inturlam.jpg and b/assets/img/blocks/map/inturlam.jpg differ diff --git a/assets/img/blocks/map/lunar.jpg b/assets/img/blocks/map/lunar.jpg index 1eee8406..a39541b5 100644 Binary files a/assets/img/blocks/map/lunar.jpg and b/assets/img/blocks/map/lunar.jpg differ diff --git a/assets/img/blocks/map/midnight.jpg b/assets/img/blocks/map/midnight.jpg index b54e747d..80cc3120 100644 Binary files a/assets/img/blocks/map/midnight.jpg and b/assets/img/blocks/map/midnight.jpg differ diff --git a/assets/img/blocks/map/multi-brand.jpg b/assets/img/blocks/map/multi-brand.jpg index 967e3454..1535c995 100644 Binary files a/assets/img/blocks/map/multi-brand.jpg and b/assets/img/blocks/map/multi-brand.jpg differ diff --git a/assets/img/blocks/map/purple.jpg b/assets/img/blocks/map/purple.jpg index 22405294..72479776 100644 Binary files a/assets/img/blocks/map/purple.jpg and b/assets/img/blocks/map/purple.jpg differ diff --git a/assets/img/blocks/map/purple.png b/assets/img/blocks/map/purple.png index 3d0f3e21..4f67dbab 100644 Binary files a/assets/img/blocks/map/purple.png and b/assets/img/blocks/map/purple.png differ diff --git a/assets/img/blocks/map/shadow-grey.jpg b/assets/img/blocks/map/shadow-grey.jpg index f2b2c09c..e6ea573e 100644 Binary files a/assets/img/blocks/map/shadow-grey.jpg and b/assets/img/blocks/map/shadow-grey.jpg differ diff --git a/assets/img/blocks/map/style-default.jpg b/assets/img/blocks/map/style-default.jpg index 471f3c89..ad290e2a 100644 Binary files a/assets/img/blocks/map/style-default.jpg and b/assets/img/blocks/map/style-default.jpg differ diff --git a/assets/img/blocks/map/ultra-light.jpg b/assets/img/blocks/map/ultra-light.jpg index 9a7e48fb..6bce1ffe 100644 Binary files a/assets/img/blocks/map/ultra-light.jpg and b/assets/img/blocks/map/ultra-light.jpg differ diff --git a/assets/img/blocks/pieprogress/_template-pro-notice.jpg b/assets/img/blocks/pieprogress/_template-pro-notice.jpg deleted file mode 100644 index 69ba3efb..00000000 Binary files a/assets/img/blocks/pieprogress/_template-pro-notice.jpg and /dev/null differ diff --git a/assets/img/blocks/pieprogress/fill.svg b/assets/img/blocks/pieprogress/fill.svg index 17a98fd2..35f7fb66 100644 --- a/assets/img/blocks/pieprogress/fill.svg +++ b/assets/img/blocks/pieprogress/fill.svg @@ -1,29 +1,3 @@ - - - - - - - - - - - - - - - - - - - - - - - - + PRO - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/pieprogress/outline-fill.svg b/assets/img/blocks/pieprogress/outline-fill.svg index d30e3ac9..d576260a 100644 --- a/assets/img/blocks/pieprogress/outline-fill.svg +++ b/assets/img/blocks/pieprogress/outline-fill.svg @@ -1,25 +1,3 @@ - - - - - - - - - - - - - - - - - - - - + PRO - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/pieprogress/outline.svg b/assets/img/blocks/pieprogress/outline.svg index 7ae36a5d..97031cf3 100644 --- a/assets/img/blocks/pieprogress/outline.svg +++ b/assets/img/blocks/pieprogress/outline.svg @@ -1,12 +1 @@ - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/pieprogress/template-pro-notice.jpg b/assets/img/blocks/pieprogress/template-pro-notice.jpg index a93f28a5..d0f427dc 100644 Binary files a/assets/img/blocks/pieprogress/template-pro-notice.jpg and b/assets/img/blocks/pieprogress/template-pro-notice.jpg differ diff --git a/assets/img/blocks/postgrid/1.svg b/assets/img/blocks/postgrid/1.svg index f70a3466..bc50d3a1 100644 --- a/assets/img/blocks/postgrid/1.svg +++ b/assets/img/blocks/postgrid/1.svg @@ -1,25 +1 @@ - - - - Group 73 Copy - Created with Sketch. - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/11.svg b/assets/img/blocks/postgrid/11.svg index d1e559c1..83e01d9a 100644 --- a/assets/img/blocks/postgrid/11.svg +++ b/assets/img/blocks/postgrid/11.svg @@ -1,11 +1 @@ - - - - Rectangle Copy 461 - Created with Sketch. - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/12.svg b/assets/img/blocks/postgrid/12.svg index 21dd6331..28ffaf1d 100644 --- a/assets/img/blocks/postgrid/12.svg +++ b/assets/img/blocks/postgrid/12.svg @@ -1,15 +1 @@ - - - - Group 24 Copy 5 - Created with Sketch. - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/13.svg b/assets/img/blocks/postgrid/13.svg index f6572409..df291edb 100644 --- a/assets/img/blocks/postgrid/13.svg +++ b/assets/img/blocks/postgrid/13.svg @@ -1,15 +1 @@ - - - - Group 24 Copy 3 - Created with Sketch. - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/14.svg b/assets/img/blocks/postgrid/14.svg index cfc72695..130827da 100644 --- a/assets/img/blocks/postgrid/14.svg +++ b/assets/img/blocks/postgrid/14.svg @@ -1,15 +1 @@ - - - - Group 22 Copy 5 - Created with Sketch. - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/15.svg b/assets/img/blocks/postgrid/15.svg index d50b7042..2255477e 100644 --- a/assets/img/blocks/postgrid/15.svg +++ b/assets/img/blocks/postgrid/15.svg @@ -1,15 +1 @@ - - - - Group 22 Copy 3 - Created with Sketch. - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/16.svg b/assets/img/blocks/postgrid/16.svg index 28b37955..a946f860 100644 --- a/assets/img/blocks/postgrid/16.svg +++ b/assets/img/blocks/postgrid/16.svg @@ -1,15 +1 @@ - - - - Group 25 - Created with Sketch. - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/2.svg b/assets/img/blocks/postgrid/2.svg index 3e492465..025ce988 100644 --- a/assets/img/blocks/postgrid/2.svg +++ b/assets/img/blocks/postgrid/2.svg @@ -1,19 +1 @@ - - - - Group 74 Copy - Created with Sketch. - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/3.svg b/assets/img/blocks/postgrid/3.svg index 1799d947..031ec4e7 100644 --- a/assets/img/blocks/postgrid/3.svg +++ b/assets/img/blocks/postgrid/3.svg @@ -1,17 +1 @@ - - - - Group 76 Copy - Created with Sketch. - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/4.svg b/assets/img/blocks/postgrid/4.svg index 3ceca061..a03117c4 100644 --- a/assets/img/blocks/postgrid/4.svg +++ b/assets/img/blocks/postgrid/4.svg @@ -1,19 +1 @@ - - - - Group 75 Copy - Created with Sketch. - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/5.svg b/assets/img/blocks/postgrid/5.svg index 84907182..30ee7486 100644 --- a/assets/img/blocks/postgrid/5.svg +++ b/assets/img/blocks/postgrid/5.svg @@ -1,23 +1 @@ - - - - Group 77 Copy - Created with Sketch. - - - - - - - - - - - - - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/pro1.svg b/assets/img/blocks/postgrid/pro1.svg index a56273ab..52e7e0fe 100644 --- a/assets/img/blocks/postgrid/pro1.svg +++ b/assets/img/blocks/postgrid/pro1.svg @@ -1,33 +1,3 @@ - - - - Group 18 - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - + PRO - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/pro2.svg b/assets/img/blocks/postgrid/pro2.svg index fdab4e10..113b32af 100644 --- a/assets/img/blocks/postgrid/pro2.svg +++ b/assets/img/blocks/postgrid/pro2.svg @@ -1,35 +1,3 @@ - - - - Group 19 - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - + PRO - - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/assets/img/blocks/postgrid/pro3.svg b/assets/img/blocks/postgrid/pro3.svg index 0655d44f..c89aa770 100644 --- a/assets/img/blocks/postgrid/pro3.svg +++ b/assets/img/blocks/postgrid/pro3.svg @@ -1,61 +1 @@ - - - - -Group 77 Copy -Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - PRO - - - - - +PRO \ No newline at end of file diff --git a/assets/img/blocks/testimonial/3.svg b/assets/img/blocks/testimonial/3.svg index eee74873..f8e7079f 100644 --- a/assets/img/blocks/testimonial/3.svg +++ b/assets/img/blocks/testimonial/3.svg @@ -1,41 +1,11 @@ - - - - Group 16 - Created with Sketch. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + + + + + + + + + + + \ No newline at end of file diff --git a/assets/img/disable-pattern.png b/assets/img/disable-pattern.png index 7390d488..3618fc20 100644 Binary files a/assets/img/disable-pattern.png and b/assets/img/disable-pattern.png differ diff --git a/assets/img/logo.svg b/assets/img/logo.svg deleted file mode 100644 index 1c616c8c..00000000 --- a/assets/img/logo.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - Artboard - Created with Sketch. - - - - \ No newline at end of file diff --git a/assets/img/options-logo.png b/assets/img/options-logo.png index 841f40ce..9e49fce3 100644 Binary files a/assets/img/options-logo.png and b/assets/img/options-logo.png differ diff --git a/assets/img/qubely-logo.svg b/assets/img/qubely-logo.svg new file mode 100644 index 00000000..dfd7de03 --- /dev/null +++ b/assets/img/qubely-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/img/qubely-medium.jpg b/assets/img/qubely-medium.jpg index da50a07c..ad47945f 100644 Binary files a/assets/img/qubely-medium.jpg and b/assets/img/qubely-medium.jpg differ diff --git a/assets/js/blocks/contactform.js b/assets/js/blocks/contactform.js index cf3e0e54..93c5edce 100644 --- a/assets/js/blocks/contactform.js +++ b/assets/js/blocks/contactform.js @@ -3,7 +3,7 @@ */ -jQuery(function ($) { + jQuery(function ($) { $('.qubely-block-contact-form form.qubely-form:not(.qubely-form-ready)').each(function () { const $form = $(this); $form.addClass('qubely-form-ready'); @@ -98,7 +98,7 @@ jQuery(function ($) { //FORM VALIDATION function checkFormValidation($form) { - const fieldErrorMessage = atob($form.find('input[name="field-error-message"]').val()); + const fieldErrorMessage = $form.find('input[name="field-error-message"]').val(); let onChange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; let isRequired = false; $form.find(' input[type=text], input[type=email], input[type=radio], input[type=checkbox], textarea, select').each(function () { @@ -162,4 +162,4 @@ jQuery(function ($) { var regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return regex.test(String(email).toLowerCase()); } -}) +}) \ No newline at end of file diff --git a/assets/js/common-script.js b/assets/js/common-script.js index 82057a9f..685902a0 100644 --- a/assets/js/common-script.js +++ b/assets/js/common-script.js @@ -1,11 +1,11 @@ jQuery(function ($) { - 'use strict'; + "use strict"; // Magnific Popup - if (typeof $(document).magnificPopup !== 'undefined') { - $('.qubely-video-popup').magnificPopup({ - type: 'iframe', + if (typeof $(document).magnificPopup !== "undefined") { + $(".qubely-video-popup").magnificPopup({ + type: "iframe", rtl: true, - mainClass: 'mfp-fade', + mainClass: "mfp-fade", removalDelay: 300, preloader: false, fixedContentPos: false, @@ -13,110 +13,95 @@ jQuery(function ($) { } //Table of Contents - if (document.getElementsByClassName('qubely-table-of-contents').length > 0) { - let tocOffsetTop = $('.qubely-table-of-contents').data('scroll-offset'); - tocOffsetTop = - typeof tocOffsetTop !== 'undefined' && tocOffsetTop - ? parseInt(tocOffsetTop) - : 0; - - // $('.qubely-table-of-contents-body a').on('click', function () { - // let currentAnchor = $(this).attr('href'); - // currentAnchor = $(`${currentAnchor}`)[0].offsetTop - // $("html, body").animate({ - // scrollTop: currentAnchor > tocOffsetTop ? currentAnchor + tocOffsetTop : currentAnchor - // }, 400); - - // }) - - $('.qubely-table-of-contents-toggle a').on('click', function () { - const parentElem = $(this).parent('.qubely-table-of-contents-toggle'); - parentElem.toggleClass('qubely-toc-collapsed'); - - parentElem - .closest('.qubely-table-of-contents') - .find('.qubely-table-of-contents-body') - .slideToggle(300); + if (document.getElementsByClassName("qubely-table-of-contents").length > 0) { + let tocOffsetTop = $(".qubely-table-of-contents").data("scroll-offset"); + tocOffsetTop = typeof tocOffsetTop !== "undefined" && tocOffsetTop ? parseInt(tocOffsetTop) : 0; + + $(".qubely-table-of-contents-body a").on("click", function () { + let currentAnchor = $(this).attr("href"); + currentAnchor = $(`${currentAnchor}`)[0].offsetTop; + $("html, body").animate( + { + scrollTop: currentAnchor > tocOffsetTop ? currentAnchor + tocOffsetTop : currentAnchor, + }, + 400 + ); + }); + + $(".qubely-table-of-contents-toggle a").on("click", function () { + const parentElem = $(this).parent(".qubely-table-of-contents-toggle"); + parentElem.toggleClass("qubely-toc-collapsed"); + + parentElem.closest(".qubely-table-of-contents").find(".qubely-table-of-contents-body").slideToggle(300); }); - if (!$('.block-editor-block-list__layout').length) { - $('.qubely-back-to-top-button').on('click', function (e) { + if (!$(".block-editor-block-list__layout").length) { + $(".qubely-back-to-top-button").on("click", function (e) { e.preventDefault(); - $('html, body').animate( + $("html, body").animate( { scrollTop: 0, }, - 800, + 800 ); }); - const backToTop = $('.qubely-back-to-top-button'); + const backToTop = $(".qubely-back-to-top-button"); - if (typeof backToTop[0] !== 'undefined') { + if (typeof backToTop[0] !== "undefined") { window.onscroll = () => { if ($(window).scrollTop() > 300) { - backToTop[0].classList.add('qubely-show-scroll'); + backToTop[0].classList.add("qubely-show-scroll"); } else { - backToTop[0].classList.remove('qubely-show-scroll'); + backToTop[0].classList.remove("qubely-show-scroll"); } }; } } } //ACCORDION BLOCK - $('.qubely-block-accordion:not(.qubely-accordion-ready)').each(function () { + $(".qubely-block-accordion:not(.qubely-accordion-ready)").each(function () { const $accordion = $(this); - const itemToggle = $accordion.attr('data-item-toggle'); - $accordion.addClass('qubely-accordion-ready'); - $accordion.on( - 'click', - '.qubely-accordion-item .qubely-accordion-panel', - function (e) { - e.preventDefault(); - - const $selectedItem = $(this).parent('.qubely-accordion-item'); - const $selectedItemContent = $selectedItem.find( - '.qubely-accordion-body', - ); - const isActive = $selectedItem.hasClass('qubely-accordion-active'); - - if (isActive) { - $selectedItemContent.css('display', 'block').slideUp(150); - $selectedItem.removeClass('qubely-accordion-active'); - } else { - $selectedItemContent.css('display', 'none').slideDown(150); - $selectedItem.addClass('qubely-accordion-active'); - } + const itemToggle = $accordion.attr("data-item-toggle"); + $accordion.addClass("qubely-accordion-ready"); + $accordion.on("click", ".qubely-accordion-item .qubely-accordion-panel", function (e) { + e.preventDefault(); + + const $selectedItem = $(this).parent(".qubely-accordion-item"); + const $selectedItemContent = $selectedItem.find(".qubely-accordion-body"); + const isActive = $selectedItem.hasClass("qubely-accordion-active"); + + if (isActive) { + $selectedItemContent.css("display", "block").slideUp(150); + $selectedItem.removeClass("qubely-accordion-active"); + } else { + $selectedItemContent.css("display", "none").slideDown(150); + $selectedItem.addClass("qubely-accordion-active"); + } - if (itemToggle == 'true') { - const $collapseItems = $accordion - .find('.qubely-accordion-active') - .not($selectedItem); - if ($collapseItems.length) { - $collapseItems - .find('.qubely-accordion-body') - .css('display', 'block') - .slideUp(150); - $collapseItems.removeClass('qubely-accordion-active'); - } + if (itemToggle == "true") { + const $collapseItems = $accordion.find(".qubely-accordion-active").not($selectedItem); + if ($collapseItems.length) { + $collapseItems.find(".qubely-accordion-body").css("display", "block").slideUp(150); + $collapseItems.removeClass("qubely-accordion-active"); } - }, - ); + } + }); }); //TAB BLOCK function progress(parentElement, elem, delay) { - if (typeof elem === 'undefined') { + if (typeof elem === "undefined") { return; } - $('.qubely-tab-item', parentElement).each(function () { - $(this).find('.progress').css({ - width: '0%', - transition: 'width 0s', + $(".qubely-tab-item", parentElement).each(function () { + $(this).find(".progress").css({ + width: "0%", + transition: "width 0s", }); }); - elem.style.width = '100%'; - elem.style.transition = 'width ' + delay + 's'; + elem.style.width = "100%"; + elem.style.transition = "width " + delay + "s"; } var timeouts = []; @@ -125,173 +110,138 @@ jQuery(function ($) { clearTimeout(timeouts[i]); } } - $('.qubely-tab-title').on('click', function (event) { + $(".qubely-tab-title").on("click", function (event) { clearTimeouts(); var $qubelyTab = $(this).parent(); var qubelyTabNav = $($qubelyTab).parent(); - $('.qubely-tab-item.qubely-active .progress', qubelyTabNav).css({ - width: '0%', - transition: 'width 0s', + $(".qubely-tab-item.qubely-active .progress", qubelyTabNav).css({ + width: "0%", + transition: "width 0s", }); var qubelyIndex = $qubelyTab.index(); - if ($qubelyTab.hasClass('qubely-active')) { + if ($qubelyTab.hasClass("qubely-active")) { return; } - $qubelyTab - .closest('.qubely-tab-nav') - .find('.qubely-active') - .removeClass('qubely-active'); - $qubelyTab.addClass('qubely-active'); - $qubelyTab - .closest('.qubely-block-tab') - .find('.qubely-tab-content.qubely-active') - .removeClass('qubely-active'); - $qubelyTab - .closest('.qubely-block-tab') - .find('.qubely-tab-content') - .eq(qubelyIndex) - .addClass('qubely-active'); + $qubelyTab.closest(".qubely-tab-nav").find(".qubely-active").removeClass("qubely-active"); + $qubelyTab.addClass("qubely-active"); + $qubelyTab.closest(".qubely-block-tab").find(".qubely-tab-content.qubely-active").removeClass("qubely-active"); + $qubelyTab.closest(".qubely-block-tab").find(".qubely-tab-content").eq(qubelyIndex).addClass("qubely-active"); }); - $('.qubely-block-tab.with-auto-swithing').each(function () { + $(".qubely-block-tab.with-auto-swithing").each(function () { const currentElement = $(this)[0]; let defaultdelay = parseInt(currentElement.dataset.defaultdelay); let tabs = parseInt(currentElement.dataset.tabs); let effectiveDelays = Array(tabs).fill(defaultdelay); let tabIndex = 0; - $('.qubely-tab-item', currentElement).each(function (index) { - if (typeof $(this)[0].dataset.customdelay !== 'undefined') { + $(".qubely-tab-item", currentElement).each(function (index) { + if (typeof $(this)[0].dataset.customdelay !== "undefined") { effectiveDelays[index] = parseInt($(this)[0].dataset.customdelay); } }); let changeTab = function () { - let activeTab = $('.qubely-tab-item.qubely-active', currentElement); - let current = $('.qubely-tab-item', currentElement).index(activeTab); + let activeTab = $(".qubely-tab-item.qubely-active", currentElement); + let current = $(".qubely-tab-item", currentElement).index(activeTab); tabIndex++; let idx = current; - let max = $('.qubely-tab-item', currentElement).length - 1; + let max = $(".qubely-tab-item", currentElement).length - 1; idx = current < max ? idx + 1 : 0; // $('.qubely-tab-item:not(.qubely-backend):eq(' + idx + ') .qubely-tab-title', currentElement).click(); var $qubelyTab = $( - '.qubely-tab-item:not(.qubely-backend):eq(' + - idx + - ') .qubely-tab-title', - currentElement, + ".qubely-tab-item:not(.qubely-backend):eq(" + idx + ") .qubely-tab-title", + currentElement ).parent(); var qubelyIndex = $qubelyTab.index(); - if ($qubelyTab.hasClass('qubely-active')) { + if ($qubelyTab.hasClass("qubely-active")) { return; } + $qubelyTab.closest(".qubely-tab-nav").find(".qubely-active").removeClass("qubely-active"); + $qubelyTab.addClass("qubely-active"); $qubelyTab - .closest('.qubely-tab-nav') - .find('.qubely-active') - .removeClass('qubely-active'); - $qubelyTab.addClass('qubely-active'); + .closest(".qubely-block-tab") + .find(".qubely-tab-content.qubely-active") + .removeClass("qubely-active"); $qubelyTab - .closest('.qubely-block-tab') - .find('.qubely-tab-content.qubely-active') - .removeClass('qubely-active'); - $qubelyTab - .closest('.qubely-block-tab') - .find('.qubely-tab-content') + .closest(".qubely-block-tab") + .find(".qubely-tab-content") .eq(qubelyIndex) - .addClass('qubely-active'); - progress( - currentElement, - $qubelyTab.find('.progress')[0], - parseInt($qubelyTab[0].dataset.customdelay), - ); - timeouts.push( - setTimeout(changeTab, effectiveDelays[tabIndex % tabs] * 1000), - ); + .addClass("qubely-active"); + progress(currentElement, $qubelyTab.find(".progress")[0], parseInt($qubelyTab[0].dataset.customdelay)); + timeouts.push(setTimeout(changeTab, effectiveDelays[tabIndex % tabs] * 1000)); }; timeouts.push(setTimeout(changeTab, effectiveDelays[0] * 1000)); progress( currentElement, - $('.qubely-tab-item.qubely-active', currentElement).find('.progress')[0], - effectiveDelays[0], + $(".qubely-tab-item.qubely-active", currentElement).find(".progress")[0], + effectiveDelays[0] ); }); //Vertical TAB BLOCK - $('.qubely-vertical-tab-item-button').on('click', function (event) { + $(".qubely-vertical-tab-item-button").on("click", function (event) { var $that = $(this); var $currentNav = $that.parent(); - if ($currentNav.hasClass('qubely-vertical-active')) { + if ($currentNav.hasClass("qubely-vertical-active")) { return; } - var $parentTab = $that.closest('.qubely-block-vertical-tab'); + var $parentTab = $that.closest(".qubely-block-vertical-tab"); var $currentNavIndex = $currentNav.index(); // nav - $parentTab - .find('.qubely-vertical-tab-item') - .removeClass('qubely-vertical-active'); - $currentNav.addClass('qubely-vertical-active'); + $parentTab.find(".qubely-vertical-tab-item").removeClass("qubely-vertical-active"); + $currentNav.addClass("qubely-vertical-active"); // nav content - $parentTab.find('.qubely-vertical-tab-nav-text').slideUp(300); - $that.find('.qubely-vertical-tab-nav-text').slideDown(300); + $parentTab.find(".qubely-vertical-tab-nav-text").slideUp(300); + $that.find(".qubely-vertical-tab-nav-text").slideDown(300); // body - var $currentTabBody = $currentNav - .closest('.qubely-vertical-tab-nav') - .next(); - var $currentVerticalContent = $currentTabBody - .find('.qubely-tab-content') - .eq($currentNavIndex); - - $parentTab - .find('.qubely-tab-content') - .removeClass('qubely-vertical-active') - .fadeOut(0); - $currentVerticalContent.addClass('qubely-vertical-active').fadeIn(); + var $currentTabBody = $currentNav.closest(".qubely-vertical-tab-nav").next(); + var $currentVerticalContent = $currentTabBody.find(".qubely-tab-content").eq($currentNavIndex); + + $parentTab.find(".qubely-tab-content").removeClass("qubely-vertical-active").fadeOut(0); + $currentVerticalContent.addClass("qubely-vertical-active").fadeIn(); }); //Carousel BLOCK - $('.qubely-carousel-title').on('click', function (event) { + $(".qubely-carousel-title").on("click", function (event) { var $qubelyCarousel = $(this).parent(); var qubelyCarouselIndex = $qubelyCarousel.index(); - if ($qubelyCarousel.hasClass('qubely-active')) { + if ($qubelyCarousel.hasClass("qubely-active")) { return; } + $qubelyCarousel.closest(".qubely-carousel-nav-wraper").find(".qubely-active").removeClass("qubely-active"); + $qubelyCarousel.addClass("qubely-active"); $qubelyCarousel - .closest('.qubely-carousel-nav-wraper') - .find('.qubely-active') - .removeClass('qubely-active'); - $qubelyCarousel.addClass('qubely-active'); - $qubelyCarousel - .closest('.qubely-block-carousel') - .find('.qubely-carousel-item.qubely-active') + .closest(".qubely-block-carousel") + .find(".qubely-carousel-item.qubely-active") .hide() - .removeClass('qubely-active'); + .removeClass("qubely-active"); $qubelyCarousel - .closest('.qubely-block-carousel') - .find('.qubely-carousel-item') + .closest(".qubely-block-carousel") + .find(".qubely-carousel-item") .eq(qubelyCarouselIndex) .fadeIn(400, function () { - $(this).addClass('qubely-active'); + $(this).addClass("qubely-active"); }); }); - $('.qubely-carousel-nav').on('click', function (event) { + $(".qubely-carousel-nav").on("click", function (event) { let $qubelyCarouselBody = $(this).parent(); - let $qubelyCarouselBlock = $qubelyCarouselBody.closest( - '.qubely-block-carousel', - ); + let $qubelyCarouselBlock = $qubelyCarouselBody.closest(".qubely-block-carousel"); let $nav = $(this); - let direction = $nav.attr('data-direction'); - let items = $nav.attr('data-items'); + let direction = $nav.attr("data-direction"); + let items = $nav.attr("data-items"); - let activeItemlIndex = $( - '.qubely-carousel-item-indicator.qubely-active', - ).index('.qubely-carousel-item-indicator'); + let activeItemlIndex = $(".qubely-carousel-item-indicator.qubely-active").index( + ".qubely-carousel-item-indicator" + ); let nextActiveItem = - direction === 'next' + direction === "next" ? activeItemlIndex < items - 1 ? activeItemlIndex + 1 : 0 @@ -299,23 +249,15 @@ jQuery(function ($) { ? activeItemlIndex - 1 : items - 1; + $qubelyCarouselBlock.find(".qubely-carousel-item.qubely-active").hide().removeClass("qubely-active"); + $qubelyCarouselBlock.find(".qubely-carousel-item-indicator.qubely-active").removeClass("qubely-active"); $qubelyCarouselBlock - .find('.qubely-carousel-item.qubely-active') - .hide() - .removeClass('qubely-active'); - $qubelyCarouselBlock - .find('.qubely-carousel-item-indicator.qubely-active') - .removeClass('qubely-active'); - $qubelyCarouselBlock - .find('.qubely-carousel-item') + .find(".qubely-carousel-item") .eq(nextActiveItem) .fadeIn(400, function () { - $(this).addClass('qubely-active'); + $(this).addClass("qubely-active"); }); - $qubelyCarouselBlock - .find('.qubely-carousel-item-indicator') - .eq(nextActiveItem) - .addClass('qubely-active'); + $qubelyCarouselBlock.find(".qubely-carousel-item-indicator").eq(nextActiveItem).addClass("qubely-active"); }); }); @@ -331,10 +273,7 @@ jQuery(function ($) { $.event.special.inview = { add: function (data) { - inviewObjects[data.guid + '-' + this[expando]] = { - data: data, - $element: $(this), - }; + inviewObjects[data.guid + "-" + this[expando]] = { data: data, $element: $(this) }; if (!timer && !$.isEmptyObject(inviewObjects)) { timer = setInterval(checkInView, 250); } @@ -342,7 +281,7 @@ jQuery(function ($) { remove: function (data) { try { - delete inviewObjects[data.guid + '-' + this[expando]]; + delete inviewObjects[data.guid + "-" + this[expando]]; } catch (e) {} if ($.isEmptyObject(inviewObjects)) { clearInterval(timer); @@ -360,7 +299,7 @@ jQuery(function ($) { if (mode || !$.support.boxModel) { // IE, Gecko domObject = - mode === 'CSS1Compat' + mode === "CSS1Compat" ? documentElement // Standards : d.body; // Quirks size = { @@ -404,7 +343,7 @@ jQuery(function ($) { var $element = $($elements[i]), elementSize = { height: $element.height(), width: $element.width() }, elementOffset = $element.offset(), - inView = $element.data('inview'), + inView = $element.data("inview"), visiblePartX, visiblePartY, visiblePartsMerged; @@ -421,69 +360,58 @@ jQuery(function ($) { ) { visiblePartX = viewportOffset.left > elementOffset.left - ? 'right' - : viewportOffset.left + viewportSize.width < - elementOffset.left + elementSize.width - ? 'left' - : 'both'; + ? "right" + : viewportOffset.left + viewportSize.width < elementOffset.left + elementSize.width + ? "left" + : "both"; visiblePartY = viewportOffset.top > elementOffset.top - ? 'bottom' - : viewportOffset.top + viewportSize.height < - elementOffset.top + elementSize.height - ? 'top' - : 'both'; - visiblePartsMerged = visiblePartX + '-' + visiblePartY; + ? "bottom" + : viewportOffset.top + viewportSize.height < elementOffset.top + elementSize.height + ? "top" + : "both"; + visiblePartsMerged = visiblePartX + "-" + visiblePartY; if (!inView || inView !== visiblePartsMerged) { $element - .data('inview', visiblePartsMerged) - .trigger('inview', [true, visiblePartX, visiblePartY]); + .data("inview", visiblePartsMerged) + .trigger("inview", [true, visiblePartX, visiblePartY]); } } else if (inView) { - $element.data('inview', false).trigger('inview', [false]); + $element.data("inview", false).trigger("inview", [false]); } } } } - $(w).bind('scroll resize scrollstop', function () { + $(w).bind("scroll resize scrollstop", function () { viewportSize = viewportOffset = null; }); if (!documentElement.addEventListener && documentElement.attachEvent) { - documentElement.attachEvent('onfocusin', function () { + documentElement.attachEvent("onfocusin", function () { viewportOffset = null; }); } - $(document).on( - 'inview', - '[data-qubelyanimation]', - function (event, visible, visiblePartX, visiblePartY) { - var $this = $(this); - if (visible) { - let animation = $this.data('qubelyanimation'); - if ( - animation && - typeof animation.name != 'undefined' && - animation.openAnimation != 0 - ) { - setTimeout(() => { - $this.css({ opacity: 1 }); - }, parseInt(animation.delay) + 100); - $this.css({ - 'animation-name': animation.name, - 'animation-timing-function': animation.curve, - 'animation-duration': animation.duration + 'ms', - 'animation-delay': animation.delay + 'ms', - 'animation-iteration-count': - animation.repeat === 'once' ? 1 : 'infinite', - }); - } + $(document).on("inview", "[data-qubelyanimation]", function (event, visible, visiblePartX, visiblePartY) { + var $this = $(this); + if (visible) { + let animation = $this.data("qubelyanimation"); + if (animation && typeof animation.name != "undefined" && animation.openAnimation != 0) { + setTimeout(() => { + $this.css({ opacity: 1 }); + }, parseInt(animation.delay) + 100); + $this.css({ + "animation-name": animation.name, + "animation-timing-function": animation.curve, + "animation-duration": animation.duration + "ms", + "animation-delay": animation.delay + "ms", + "animation-iteration-count": animation.repeat === "once" ? 1 : "infinite", + }); } - $this.unbind('inview'); - }, - ); + } + $this.unbind("inview"); + }); // Parallax var $window = $(window); @@ -507,7 +435,7 @@ jQuery(function ($) { return jqo.height(); }; } - if (arguments.length < 1 || xpos === null) xpos = '50%'; + if (arguments.length < 1 || xpos === null) xpos = "50%"; if (arguments.length < 2 || speedFactor === null) speedFactor = 0.1; if (arguments.length < 3 || outerHeight === null) outerHeight = true; function update() { @@ -519,19 +447,16 @@ jQuery(function ($) { if (top + height < pos || top > pos + windowHeight) { return; } - $this.css( - 'backgroundPosition', - xpos + ' ' + Math.round((firstTop - pos) * speedFactor) + 'px', - ); + $this.css("backgroundPosition", xpos + " " + Math.round((firstTop - pos) * speedFactor) + "px"); }); } - $window.bind('scroll', update).resize(update); + $window.bind("scroll", update).resize(update); update(); }; - if (typeof jQuery.fn.parallax !== 'undefined') { + if (typeof jQuery.fn.parallax !== "undefined") { $(document).ready(function () { - $('.qubely-row-parallax').each(function () { - $(this).parallax('center', 0.4); + $(".qubely-row-parallax").each(function () { + $(this).parallax("center", 0.4); }); }); } @@ -542,35 +467,34 @@ jQuery(function ($) { return ( rect.top >= 0 && rect.left >= 0 && - rect.bottom <= - (window.innerHeight || document.documentElement.clientHeight) && + rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && rect.right <= (window.innerWidth || document.documentElement.clientWidth) ); } - $(document).on('ready', function () { + $(document).on("ready", function () { //Countdown Block - $('.qubely-block-pie-progress').each(function () { + $(".qubely-block-pie-progress").each(function () { var $that = $(this); - var circle = $that.find('circle:last-child'); - var pieOffset = circle.data('dashoffset'); - var transition = circle.data('transition'); - var duration = circle.data('transition-duration'); - var progressCount = $that.find('.qubely-pie-counter'); - var number = parseInt(circle.data('percent')); + var circle = $that.find("circle:last-child"); + var pieOffset = circle.data("dashoffset"); + var transition = circle.data("transition"); + var duration = circle.data("transition-duration"); + var progressCount = $that.find(".qubely-pie-counter"); + var number = parseInt(circle.data("percent")); if (parseInt(duration) > 0) { progressCount.html(0); } var pieEvent = function () { - if (isElementInViewport($that.find('svg')[0])) { - circle.css('transition', transition); - circle.attr('stroke-dashoffset', pieOffset); + if (isElementInViewport($that.find("svg")[0])) { + circle.css("transition", transition); + circle.attr("stroke-dashoffset", pieOffset); if (parseInt(duration) > 0) { progressCounter(); } - window.removeEventListener('scroll', pieEvent, true); + window.removeEventListener("scroll", pieEvent, true); } }; @@ -589,12 +513,12 @@ jQuery(function ($) { var intvlId = setInterval(timer, interval); }; - window.addEventListener('scroll', pieEvent, true); + window.addEventListener("scroll", pieEvent, true); pieEvent(); }); //Counter Block - $('.qubely-block-counter-number').each(function () { + $(".qubely-block-counter-number").each(function () { const currentElement = $(this)[0]; let start = parseInt(currentElement.dataset.start), limit = parseInt(currentElement.dataset.limit), @@ -606,22 +530,18 @@ jQuery(function ($) { if (start < limit) { let intervalId = setInterval(function () { let difference = limit - start; - difference >= increment - ? (start += increment) - : difference >= 50 - ? (start += 50) - : start++; + difference >= increment ? (start += increment) : difference >= 50 ? (start += 50) : start++; currentElement.innerText = start; if (start >= limit) { clearInterval(intervalId); } }, 10); } - window.removeEventListener('scroll', invokeCounter, true); + window.removeEventListener("scroll", invokeCounter, true); } }; invokeCounter(); - window.addEventListener('scroll', invokeCounter, true); + window.addEventListener("scroll", invokeCounter, true); }); }); @@ -629,33 +549,31 @@ jQuery(function ($) { * Settings tab */ - var qubelySettingsTabContent = $('#qubely-settings-tabs-content'); - var qubelySettingTabs = $('#qubely-settings-tabs a'); + var qubelySettingsTabContent = $("#qubely-settings-tabs-content"); + var qubelySettingTabs = $("#qubely-settings-tabs a"); - qubelySettingTabs.on('click', function (e) { + qubelySettingTabs.on("click", function (e) { e.preventDefault(); - history.pushState({}, '', this.href); - var anchor = $(this).attr('href'); - qubelySettingsTabContent.find('.qubely-settings-inner').hide(); + history.pushState({}, "", this.href); + var anchor = $(this).attr("href"); + qubelySettingsTabContent.find(".qubely-settings-inner").hide(); qubelySettingsTabContent.find(anchor).show(); - qubelySettingTabs.removeClass('nav-tab-active'); - $(this).addClass('nav-tab-active'); + qubelySettingTabs.removeClass("nav-tab-active"); + $(this).addClass("nav-tab-active"); }); if (qubelySettingsTabContent.length) { if (window.location.hash) { - qubelySettingTabs.removeClass('nav-tab-active'); - $('#qubely-settings-tabs a[href=' + window.location.hash + ']').addClass( - 'nav-tab-active', - ); - qubelySettingsTabContent.find('.qubely-settings-inner').hide(); + qubelySettingTabs.removeClass("nav-tab-active"); + $("#qubely-settings-tabs a[href=" + window.location.hash + "]").addClass("nav-tab-active"); + qubelySettingsTabContent.find(".qubely-settings-inner").hide(); qubelySettingsTabContent.find(window.location.hash).show(); } else { - qubelySettingTabs.removeClass('nav-tab-active'); - qubelySettingTabs.first().addClass('nav-tab-active'); - qubelySettingsTabContent.find('.qubely-settings-inner').hide(); - qubelySettingsTabContent.find('.qubely-settings-inner').first().show(); + qubelySettingTabs.removeClass("nav-tab-active"); + qubelySettingTabs.first().addClass("nav-tab-active"); + qubelySettingsTabContent.find(".qubely-settings-inner").hide(); + qubelySettingsTabContent.find(".qubely-settings-inner").first().show(); } } // postgrid-pro loadmore @@ -680,34 +598,28 @@ jQuery(function ($) { }) });*/ - var qubelyGsPostWrap = $('.qubely-gs-card-blog-posts'); + var qubelyGsPostWrap = $(".qubely-gs-card-blog-posts"); if (qubelyGsPostWrap.length) { function generatePostMarkup(post) { - var div = document.createElement('div'); - div.classList.add('qubely-gs-post-card'); - - var anchor1 = document.createElement('a'); - anchor1.setAttribute('href', post.link); - - var img = document.createElement('img'); - if ( - post.qubely_featured_image_url && - post.qubely_featured_image_url.medium_large - ) { - img.setAttribute( - 'src', - post.qubely_featured_image_url.medium_large[0], - ); + var div = document.createElement("div"); + div.classList.add("qubely-gs-post-card"); + + var anchor1 = document.createElement("a"); + anchor1.setAttribute("href", post.link); + + var img = document.createElement("img"); + if (post.qubely_featured_image_url && post.qubely_featured_image_url.medium_large) { + img.setAttribute("src", post.qubely_featured_image_url.medium_large[0]); } anchor1.appendChild(img); - var span = document.createElement('span'); + var span = document.createElement("span"); var date = new Date(post.date); span.innerText = `${date.getUTCDate()}/${date.getUTCMonth()}/${date.getUTCFullYear()}`; - var anchor2 = document.createElement('a'); - anchor2.setAttribute('href', post.link); + var anchor2 = document.createElement("a"); + anchor2.setAttribute("href", post.link); $(anchor2).html(post.title.rendered); @@ -718,32 +630,26 @@ jQuery(function ($) { } function printPostMarkup(posts) { - $('.qubely-gs-post-items-wrap').empty(); + $(".qubely-gs-post-items-wrap").empty(); posts.forEach((post) => { - $('.qubely-gs-post-items-wrap').append(generatePostMarkup(post)); + $(".qubely-gs-post-items-wrap").append(generatePostMarkup(post)); }); } function fetchPost() { - var cacheTime = localStorage.getItem('__qubely_themeum_post_time'); - var cachedPost = localStorage.getItem('__qubely_themeum_post'); + var cacheTime = localStorage.getItem("__qubely_themeum_post_time"); + var cachedPost = localStorage.getItem("__qubely_themeum_post"); if (!cachedPost || !parseInt(cacheTime) > Date.now()) { var endpoint = - 'https://www.themeum.com/wp-json/wp/v2/posts?per_page=3&status=publish&orderby=date&categories=1486'; + "https://www.themeum.com/wp-json/wp/v2/posts?per_page=3&status=publish&orderby=date&categories=1486"; fetch(endpoint) .then((response) => response.json()) .then((res) => { if (Array.isArray(res)) { printPostMarkup(res); - localStorage.setItem( - '__qubely_themeum_post_time', - Date.now() + 3600e3, - ); - localStorage.setItem( - '__qubely_themeum_post', - JSON.stringify(res), - ); + localStorage.setItem("__qubely_themeum_post_time", Date.now() + 3600e3); + localStorage.setItem("__qubely_themeum_post", JSON.stringify(res)); } else { qubelyGsPostWrap.remove(); } @@ -760,23 +666,20 @@ jQuery(function ($) { // fetchPost(); } - var sectionCount = $('.qubely-gs-section-count'); + var sectionCount = $(".qubely-gs-section-count"); if (sectionCount.length) { - var endpoint = 'https://qubely.io/wp-json/wp/v2/sections'; - var cacheTime = localStorage.getItem('__qubely_section_count_time'); - var cachedCount = localStorage.getItem('__qubely_section_count'); + var endpoint = "https://qubely.io/wp-json/wp/v2/sections"; + var cacheTime = localStorage.getItem("__qubely_section_count_time"); + var cachedCount = localStorage.getItem("__qubely_section_count"); if (!cachedCount || !parseInt(cacheTime) > Date.now()) { fetch(endpoint) .then((response) => { - var count = response.headers.get('X-WP-Total'); + var count = response.headers.get("X-WP-Total"); if (count) { - count = count + '+'; + count = count + "+"; sectionCount.html(count); - localStorage.setItem( - '__qubely_section_count_time', - Date.now() + 3600e3, - ); - localStorage.setItem('__qubely_section_count', count); + localStorage.setItem("__qubely_section_count_time", Date.now() + 3600e3); + localStorage.setItem("__qubely_section_count", count); } }) .catch((e) => { @@ -787,23 +690,20 @@ jQuery(function ($) { } } - var blockCount = $('.qubely-gs-block-count'); + var blockCount = $(".qubely-gs-block-count"); if (blockCount.length) { - var endpoint = 'https://qubely.io/wp-json/wp/v2/block'; - var cacheTime = localStorage.getItem('__qubely_block_count_time'); - var cachedCount = localStorage.getItem('__qubely_block_count'); + var endpoint = "https://qubely.io/wp-json/wp/v2/block"; + var cacheTime = localStorage.getItem("__qubely_block_count_time"); + var cachedCount = localStorage.getItem("__qubely_block_count"); if (!cachedCount || !parseInt(cacheTime) > Date.now()) { fetch(endpoint) .then((response) => { - var count = response.headers.get('X-WP-Total'); + var count = response.headers.get("X-WP-Total"); if (count) { - count = count + '+'; + count = count + "+"; blockCount.html(count); - localStorage.setItem( - '__qubely_block_count_time', - Date.now() + 3600e3, - ); - localStorage.setItem('__qubely_block_count', count); + localStorage.setItem("__qubely_block_count_time", Date.now() + 3600e3); + localStorage.setItem("__qubely_block_count", count); } }) .catch((e) => { @@ -814,25 +714,21 @@ jQuery(function ($) { } } - var layoutCount = $('.qubely-gs-layout-count'); + var layoutCount = $(".qubely-gs-layout-count"); if (layoutCount.length) { - var endpoint = 'https://qubely.io/wp-json/restapi/v2/layouts'; - var cacheTime = localStorage.getItem('__qubely_layout_count_time'); - var cachedCount = localStorage.getItem('__qubely_layout_count'); + var endpoint = "https://qubely.io/wp-json/restapi/v2/layouts"; + var cacheTime = localStorage.getItem("__qubely_layout_count_time"); + var cachedCount = localStorage.getItem("__qubely_layout_count"); if (!cachedCount || !parseInt(cacheTime) > Date.now()) { fetch(endpoint, { - method: 'post', + method: "post", }) .then((response) => { response.json().then((response) => { - var count = - response.filter((item) => item.parentID === 0).length + '+'; + var count = response.filter((item) => item.parentID === 0).length + "+"; layoutCount.html(count); - localStorage.setItem( - '__qubely_layout_count_time', - Date.now() + 3600e3, - ); - localStorage.setItem('__qubely_layout_count', count); + localStorage.setItem("__qubely_layout_count_time", Date.now() + 3600e3); + localStorage.setItem("__qubely_layout_count", count); }); }) .catch((e) => { diff --git a/assets/js/interaction.js b/assets/js/interaction.js index e119aabd..70893fc3 100644 --- a/assets/js/interaction.js +++ b/assets/js/interaction.js @@ -1,824 +1,891 @@ (function ($) { - 'use strict'; - if( typeof qubelyInteraction === 'undefined') - return - /* - * ==================== - * INTERACTION MATH - * ==================== - */ - - function InteractionMath (animationProperty){ - this.actions = animationProperty - this.actionProperty = ['move','rotate','scale','skew','opacity', 'blur'] - this.actionSortList = {} - } - InteractionMath.prototype.bindCustomAnimation = function(){ - this.actionProperty.map(ActionName=> { - this.actionSortList[ActionName] = this.actions.filter(action => action.name === ActionName) - }) - } - InteractionMath.prototype.getCustomAnimationActionByName = function(actionName, keyframe=null){ - if( keyframe === null ) { - return typeof this.actionSortList[actionName] !== "undefined" ? this.actionSortList[actionName] : [] - }else{ - let animation = { from: null, to: null } - let actions = typeof this.actionSortList[actionName] !== "undefined" ? this.actionSortList[actionName] : [] - if( actions.length === 0 ){ - return animation; - } - let found = false; - actions.map((action, index)=> { - if(keyframe < parseInt(action.keyframe) && animation.to === null ){ - if( typeof animation.fixed !== 'undefined' ) delete animation.fixed; - action.toKF = 0 - animation.to = action - if(typeof actions[index-1] !== 'undefined'){ - actions[index-1].scroll = 0 - animation.from = actions[index-1] - } - found = true - } - if( index === actions.length-1 && found === false ){ - animation.fixed = true - animation.to = action - if(typeof actions[index-1] !== 'undefined'){ - actions[index-1].scroll = 0 - animation.from = actions[index-1] - } - } - }) - return animation; - } - } - InteractionMath.prototype.getTAxis = function(from, to, scrollPercentage, combinedPercentage){ - let { toKF, fromKF } = combinedPercentage - let tf = fromKF === 0 ? scrollPercentage : scrollPercentage - fromKF - return from - (((from-to)/toKF)*tf) - } - - InteractionMath.prototype.getMoveTransform = function(key, nextTriggerActions, scrollPercentage){ - let keyframe = nextTriggerActions.to.keyframe - let Fkeyframe = nextTriggerActions.from.keyframe - let toKF = (isNaN(keyframe)) ? 100 : Math.abs(Fkeyframe-keyframe) - let combinedPercentage = {toKF, fromKF: Fkeyframe, totalKF: keyframe } - - let Xfrom = nextTriggerActions.from.x - let Xto = nextTriggerActions.to.x - let Yfrom = nextTriggerActions.from.y - let Yto = nextTriggerActions.to.y - let Zfrom = nextTriggerActions.from.z - let Zto = nextTriggerActions.to.z - nextTriggerActions.goal.x = this.getTAxis(Xfrom, Xto, scrollPercentage, combinedPercentage) - nextTriggerActions.goal.y = this.getTAxis(Yfrom, Yto, scrollPercentage, combinedPercentage) //IM.getTAxis(Yfrom, Yto, scrollPercentage, combinedPercentage) - nextTriggerActions.goal.z = this.getTAxis(Zfrom, Zto, scrollPercentage, combinedPercentage) - return nextTriggerActions - } - InteractionMath.prototype.getSkew = function(key, nextTriggerActions, scrollPercentage){ - let keyframe = nextTriggerActions.to.keyframe - let Fkeyframe = nextTriggerActions.from.keyframe - let toKF = (isNaN(keyframe)) ? 100 : Math.abs(Fkeyframe-keyframe) - - let combinedPercentage = {toKF, fromKF: Fkeyframe, totalKF: keyframe } - let Xfrom = nextTriggerActions.from.x - let Xto = nextTriggerActions.to.x - let Yfrom = nextTriggerActions.from.y - let Yto = nextTriggerActions.to.y - nextTriggerActions.goal.x = this.getTAxis(Xfrom, Xto, scrollPercentage, combinedPercentage) - nextTriggerActions.goal.y = this.getTAxis(Yfrom, Yto, scrollPercentage, combinedPercentage) - return nextTriggerActions - } - InteractionMath.prototype.getOpacity = function(key, nextTriggerActions, scrollPercentage){ - let keyframe = nextTriggerActions.to.keyframe - let Fkeyframe = nextTriggerActions.from.keyframe - let toKF = (isNaN(keyframe)) ? 100 : Math.abs(Fkeyframe-keyframe) - - let combinedPercentage = {toKF, fromKF: Fkeyframe, totalKF: keyframe } - let Ofrom = nextTriggerActions.from.value - let Oto = nextTriggerActions.to.value - nextTriggerActions.goal.value = this.getTAxis(Ofrom, Oto, scrollPercentage, combinedPercentage) - return nextTriggerActions - } - - class MouseTilt { - constructor(element, settings = {}) { - - this.width = null; - this.height = null; - this.clientWidth = null; - this.clientHeight = null; - this.left = null; - this.top = null; - - // for Gyroscope sampling - this.gammazero = null; - this.betazero = null; - this.lastgammazero = null; - this.lastbetazero = null; - - this.transitionTimeout = null; - this.updateCall = null; - this.event = null; - - this.updateBind = this.update.bind(this); - this.resetBind = this.reset.bind(this); - - this.element = element; - - this.settings = this.extendSettings(settings); - - this.reverse = this.settings.reverse ? -1 : 1; - this.glare = MouseTilt.isSettingTrue(this.settings.glare); - this.glarePrerender = MouseTilt.isSettingTrue(this.settings["glare-prerender"]); - this.fullPageListening = MouseTilt.isSettingTrue(this.settings["full-page-listening"]); - this.gyroscope = MouseTilt.isSettingTrue(this.settings.gyroscope); - this.gyroscopeSamples = this.settings.gyroscopeSamples; - - this.elementListener = this.getElementListener(); - - if (this.glare) { - this.prepareGlare(); - } - - if (this.fullPageListening) { - this.updateClientSize(); - } - - this.addEventListeners(); - this.updateInitialPosition(); - } - - static isSettingTrue(setting) { - return setting === "" || setting === true || setting === 1; - } - - /** - * Method returns element what will be listen mouse events - * @return {Node} - */ - getElementListener() { - return this.element; - } - - /** - * Method set listen methods for this.elementListener - * @return {Node} - */ - addEventListeners() { - this.onMouseEnterBind = this.onMouseEnter.bind(this); - this.onMouseMoveBind = this.onMouseMove.bind(this); - this.onMouseLeaveBind = this.onMouseLeave.bind(this); - this.onWindowResizeBind = this.onWindowResize.bind(this); - this.onDeviceOrientationBind = this.onDeviceOrientation.bind(this); - - this.elementListener.addEventListener("mouseenter", this.onMouseEnterBind); - this.elementListener.addEventListener("mouseleave", this.onMouseLeaveBind); - this.elementListener.addEventListener("mousemove", this.onMouseMoveBind); - - if (this.glare || this.fullPageListening) { - window.addEventListener("resize", this.onWindowResizeBind); - } - - if (this.gyroscope) { - window.addEventListener("deviceorientation", this.onDeviceOrientationBind); - } - } - - /** - * Method remove event listeners from current this.elementListener - */ - removeEventListeners() { - this.elementListener.removeEventListener("mouseenter", this.onMouseEnterBind); - this.elementListener.removeEventListener("mouseleave", this.onMouseLeaveBind); - this.elementListener.removeEventListener("mousemove", this.onMouseMoveBind); - - if (this.gyroscope) { - window.removeEventListener("deviceorientation", this.onDeviceOrientationBind); - } - - if (this.glare || this.fullPageListening) { - window.removeEventListener("resize", this.onWindowResizeBind); - } - } - - destroy() { - clearTimeout(this.transitionTimeout); - if (this.updateCall !== null) { - cancelAnimationFrame(this.updateCall); - } - - this.reset(); - - this.removeEventListeners(); - this.element.vanillaTilt = null; - delete this.element.vanillaTilt; - - this.element = null; - } - - onDeviceOrientation(event) { - if (event.gamma === null || event.beta === null) { - return; - } - - this.updateElementPosition(); - - if (this.gyroscopeSamples > 0) { - this.lastgammazero = this.gammazero; - this.lastbetazero = this.betazero; - - if (this.gammazero === null) { - this.gammazero = event.gamma; - this.betazero = event.beta; - } else { - this.gammazero = (event.gamma + this.lastgammazero) / 2; - this.betazero = (event.beta + this.lastbetazero) / 2; - } - - this.gyroscopeSamples -= 1; - } - - const totalAngleX = this.settings.gyroscopeMaxAngleX - this.settings.gyroscopeMinAngleX; - const totalAngleY = this.settings.gyroscopeMaxAngleY - this.settings.gyroscopeMinAngleY; - - const degreesPerPixelX = totalAngleX / this.width; - const degreesPerPixelY = totalAngleY / this.height; - - const angleX = event.gamma - (this.settings.gyroscopeMinAngleX + this.gammazero); - const angleY = event.beta - (this.settings.gyroscopeMinAngleY + this.betazero); - - const posX = angleX / degreesPerPixelX; - const posY = angleY / degreesPerPixelY; - - if (this.updateCall !== null) { - cancelAnimationFrame(this.updateCall); - } - - this.event = { - clientX: posX + this.left, - clientY: posY + this.top, - }; - - this.updateCall = requestAnimationFrame(this.updateBind); - } - - onMouseEnter() { - this.updateElementPosition(); - this.element.style.willChange = "transform"; - this.setTransition(); - } - - onMouseMove(event) { - if (this.updateCall !== null) { - cancelAnimationFrame(this.updateCall); - } - - this.event = event; - this.updateCall = requestAnimationFrame(this.updateBind); - } - - onMouseLeave() { - this.setTransition(); - - if (this.settings.reset) { - requestAnimationFrame(this.resetBind); - } - } - - reset() { - this.event = { - clientX: this.left + this.width / 2, - clientY: this.top + this.height / 2 - }; - - if(this.element.parentElement !== null && this.element.parentElement.className === 'qubley-interaction-wrapper' ){ - this.element = this.element.parentElement - } - if( this.element.className !== 'qubley-interaction-wrapper'){ - return - } - - if (this.element && this.element.style) { - this.element.style.transform = `perspective(${this.settings.perspective}px) ` + - `rotateX(0deg) ` + - `rotateY(0deg) ` + - `scale3d(1, 1, 1)`; - } - - this.resetGlare(); - } - - resetGlare() { - if (this.glare) { - this.glareElement.style.transform = "rotate(180deg) translate(-50%, -50%)"; - this.glareElement.style.opacity = "0"; - } - } - - updateInitialPosition() { - if (this.settings.startX === 0 && this.settings.startY === 0) { - return; - } - - - this.onMouseEnter(); - - if (this.fullPageListening) { - this.event = { - clientX: (this.settings.startX + this.settings.max) / (2 * this.settings.max) * this.clientWidth, - clientY: (this.settings.startY + this.settings.max) / (2 * this.settings.max) * this.clientHeight - }; - } else { - this.event = { - clientX: this.left + ((this.settings.startX + this.settings.max) / (2 * this.settings.max) * this.width), - clientY: this.top + ((this.settings.startY + this.settings.max) / (2 * this.settings.max) * this.height) - }; - } - - - let backupScale = this.settings.scale; - this.settings.scale = 1; - this.update(); - this.settings.scale = backupScale; - this.resetGlare(); - } - - getValues() { - let x, y; - - if (this.fullPageListening) { - x = this.event.clientX / this.clientWidth; - y = this.event.clientY / this.clientHeight; - } else { - x = (this.event.clientX - this.left) / this.width; - y = (this.event.clientY - this.top) / this.height; - } - - x = Math.min(Math.max(x, 0), 1); - y = Math.min(Math.max(y, 0), 1); - - let tiltX = (this.reverse * (this.settings.max - x * this.settings.max * 2)).toFixed(2); - let tiltY = (this.reverse * (y * this.settings.max * 2 - this.settings.max)).toFixed(2); - let angle = Math.atan2(this.event.clientX - (this.left + this.width / 2), -(this.event.clientY - (this.top + this.height / 2))) * (180 / Math.PI); - - return { - tiltX: tiltX, - tiltY: tiltY, - percentageX: x * 100, - percentageY: y * 100, - angle: angle - }; - } - - updateElementPosition() { - let rect = this.element.getBoundingClientRect(); - - this.width = this.element.offsetWidth; - this.height = this.element.offsetHeight; - this.left = rect.left; - this.top = rect.top; - } - - update() { - let values = this.getValues(); - - this.element.style.transform = "perspective(" + this.settings.perspective + "px) " + - "rotateX(" + (this.settings.axis === "x" ? 0 : values.tiltY) + "deg) " + - "rotateY(" + (this.settings.axis === "y" ? 0 : values.tiltX) + "deg) " + - "scale3d(" + this.settings.scale + ", " + this.settings.scale + ", " + this.settings.scale + ")"; - - if (this.glare) { - this.glareElement.style.transform = `rotate(${values.angle}deg) translate(-50%, -50%)`; - this.glareElement.style.opacity = `${values.percentageY * this.settings["max-glare"] / 100}`; - } - - this.element.dispatchEvent(new CustomEvent("tiltChange", { - "detail": values - })); - - this.updateCall = null; - } - - /** - * Appends the glare element (if glarePrerender equals false) - * and sets the default style - */ - prepareGlare() { - // If option pre-render is enabled we assume all html/css is present for an optimal glare effect. - if (!this.glarePrerender) { - // Create glare element - const jsTiltGlare = document.createElement("div"); - jsTiltGlare.classList.add("js-tilt-glare"); - - const jsTiltGlareInner = document.createElement("div"); - jsTiltGlareInner.classList.add("js-tilt-glare-inner"); - - jsTiltGlare.appendChild(jsTiltGlareInner); - this.element.appendChild(jsTiltGlare); - } - - this.glareElementWrapper = this.element.querySelector(".js-tilt-glare"); - this.glareElement = this.element.querySelector(".js-tilt-glare-inner"); - - if (this.glarePrerender) { - return; - } - - Object.assign(this.glareElementWrapper.style, { - "position": "absolute", - "top": "0", - "left": "0", - "width": "100%", - "height": "100%", - "overflow": "hidden", - "pointer-events": "none" - }); - - Object.assign(this.glareElement.style, { - "position": "absolute", - "top": "50%", - "left": "50%", - "pointer-events": "none", - "background-image": `linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%)`, - "width": `${this.element.offsetWidth * 2}px`, - "height": `${this.element.offsetWidth * 2}px`, - "transform": "rotate(180deg) translate(-50%, -50%)", - "transform-origin": "0% 0%", - "opacity": "0", - }); - } - - updateGlareSize() { - if (this.glare) { - Object.assign(this.glareElement.style, { - "width": `${this.element.offsetWidth * 2}`, - "height": `${this.element.offsetWidth * 2}`, - }); - } - } - - updateClientSize() { - this.clientWidth = window.innerWidth - || document.documentElement.clientWidth - || document.body.clientWidth; - - this.clientHeight = window.innerHeight - || document.documentElement.clientHeight - || document.body.clientHeight; - } - - onWindowResize() { - this.updateGlareSize(); - this.updateClientSize(); - } - - setTransition() { - clearTimeout(this.transitionTimeout); - this.element.style.transition = this.settings.speed + "ms " + this.settings.easing; - if (this.glare) this.glareElement.style.transition = `opacity ${this.settings.speed}ms ${this.settings.easing}`; - - this.transitionTimeout = setTimeout(() => { - this.element.style.transition = ""; - if (this.glare) { - this.glareElement.style.transition = ""; - } - }, this.settings.speed); - - } - - - extendSettings(settings) { - let defaultSettings = { - reverse: false, - max: 15, - startX: 0, - startY: 0, - perspective: 1000, - easing: "cubic-bezier(.03,.98,.52,.99)", - scale: 1, - speed: 300, - transition: true, - axis: null, - glare: false, - "max-glare": 1, - "glare-prerender": false, - "full-page-listening": false, - "mouse-event-element": null, - reset: true, - gyroscope: true, - gyroscopeMinAngleX: -45, - gyroscopeMaxAngleX: 45, - gyroscopeMinAngleY: -45, - gyroscopeMaxAngleY: 45, - gyroscopeSamples: 10 - }; - - let newSettings = {}; - for (var property in defaultSettings) { - if (property in settings) { - newSettings[property] = settings[property]; - } else if (this.element.hasAttribute("data-tilt-" + property)) { - let attribute = this.element.getAttribute("data-tilt-" + property); - try { - newSettings[property] = JSON.parse(attribute); - } catch (e) { - newSettings[property] = attribute; - } - - } else { - newSettings[property] = defaultSettings[property]; - } - } - - return newSettings; - } - - static init(element, settings) { - element.vanillaTilt = new MouseTilt(element, settings); - } - } - - - /* - * =========== - * START - * =========== - */ - let $window = $(window); - let windowWidth = $window.width(); - - // Calculate percentage when element on-view - function percentageSeen ($element, $window ) { - var viewportHeight = $(window).height(), - scrollTop = $window.scrollTop(), - elementOffsetTop = $element.offset().top, - elementHeight = $element.height(); - if (elementOffsetTop > (scrollTop + viewportHeight)) { - return -1; - } else if ((elementOffsetTop + elementHeight) < scrollTop) { - return 101; - } else { - var distance = (scrollTop + viewportHeight) - elementOffsetTop; - var percentage = distance / ((viewportHeight + elementHeight) / 100); - return percentage > 100 ? 100 : percentage; - } - } - - let mouseTiltInstance = {} - - initiateTiltAnimation(windowWidth) - - function initiateTiltAnimation( windowWidth ){ - if( typeof qubelyInteraction['mouse_movement'] !== 'undefined' ){ - let mouseMovementList = qubelyInteraction['mouse_movement'] - mouseMovementList.map( tiltOpt => { - let $addonElem = $(`.qubely-block-${tiltOpt.blockId}`) - if( !$addonElem.parent().hasClass('qubley-interaction-wrapper')){ - $addonElem.wrap('
') - } - - //For mobile viewport - if( windowWidth < 768 && ( typeof tiltOpt.animation.enable_mobile === 'undefined' || tiltOpt.animation.enable_mobile === false) ){ - if( typeof mouseTiltInstance[tiltOpt.blockId] !== 'undefined' ){ - mouseTiltInstance[tiltOpt.blockId].tiltIntance.destroy() - delete mouseTiltInstance[tiltOpt.blockId] - } - return false; - } - //For tablet viewport - if( windowWidth > 767 && windowWidth < 991 && ( typeof tiltOpt.animation.enable_tablet === 'undefined' || tiltOpt.animation.enable_tablet === false )){ - if( typeof mouseTiltInstance[tiltOpt.blockId] !== 'undefined' ){ - mouseTiltInstance[tiltOpt.blockId].tiltIntance.destroy() - delete mouseTiltInstance[tiltOpt.blockId] - } - return false; - } - - - if( typeof mouseTiltInstance[tiltOpt.blockId] !== 'undefined' ){ - return false; - } - - let element = document.getElementsByClassName(`qubely-block-${tiltOpt.blockId}`) - if( element.length > 0 ){ - element = element[0].parentElement - let settings = { - speed: parseFloat(tiltOpt.animation.mouse_tilt_speed)*1000, - max: parseFloat(tiltOpt.animation.mouse_tilt_max), - reverse: tiltOpt.animation.mouse_tilt_direction === 'opposite', - easing: "cubic-bezier(.03,.98,.52,.99)", - scale: 1.05, - transition: true, - perspective: 1000 - } - const tiltIntance = new MouseTilt( element, settings ) // MouseTilt.init(element, settings) - mouseTiltInstance[tiltOpt.blockId] = {tiltIntance: tiltIntance} - } - }) - } - } - - if(typeof qubelyInteraction['while_scroll_view'] !== 'undefined'){ - - // /** - // * Do auto scroll 5 px up and down for fix the element position with jquery animate function on window.load - // * set initialLoader = false and when element position fixed then enable it to true for load element smothly in view - // * Make initialLoader = true on second animation - // */ - // let initialLoader = false - // window.onload = function() { - // var doc = document.documentElement; - // var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); - // $('html, body').animate({ scrollTop: top-5 }, 10, function(){ - // $('html, body').animate({ scrollTop: top },'slow', ()=> { initialLoader = true }) - // }) - // } - - //Cache the global animation action object - let scrollActionList = qubelyInteraction['while_scroll_view'] - let $window = $(window) - - /** - * Set the initial position of each element when page load - * Hide the element to avoid zigzag trouble for the element - * Trigger animation with scrollPercentage if element in view port - * When object fit show the element with some smoth animate after 5 milisecond - */ - $(document).ready(function(){ - scrollActionList.map( animationProperty => { - if( windowWidth < 768 && (typeof animationProperty.enable_mobile === 'undefined' || animationProperty.enable_mobile === false) ){ - return false; - } - if( windowWidth > 767 && windowWidth < 991 && ( typeof animationProperty.enable_tablet === 'undefined' || animationProperty.enable_tablet === false) ){ - return false; - } - let $addonElem = $(`.qubely-block-${animationProperty.blockId}`) - $addonElem.addClass('qubley-interaction-hide') - if( !$addonElem.parent().hasClass('qubley-interaction-wrapper')){ - $addonElem.wrap('
') - } - let scrollPercentage = percentageSeen($addonElem.parent('.qubley-interaction-wrapper'), $window) - initiateOnScrollTrigger($addonElem, animationProperty, scrollPercentage, true) - setTimeout(()=>{ - $addonElem.removeClass('qubley-interaction-hide') - }, 500) - }) - }) - - /** - * When scroll document calculate each element view-port position with exact percentage - * And triger the scroll animation based on properties (move, scale, rotate, opacity, skew) - */ - $(window).on('load',function(){ - $(document).on("scroll", function () { - windowWidth = $window.width(); - scrollActionList.map( animationProperty => { - let $addonElem = $(`.qubely-block-${animationProperty.blockId}`) - - if( windowWidth < 768 && (typeof animationProperty.enable_mobile === 'undefined' || animationProperty.enable_mobile === false) ){ - $addonElem.removeAttr('style'); - return false; - } - if( windowWidth > 767 && windowWidth < 991 && ( typeof animationProperty.enable_tablet === 'undefined' || animationProperty.enable_tablet === false) ){ - $addonElem.removeAttr('style'); - return false; - } - if( $addonElem.parent().hasClass('qubley-interaction-wrapper')){ - let scrollPercentage = percentageSeen($addonElem.parent('.qubley-interaction-wrapper'), $window) - initiateOnScrollTrigger($addonElem, animationProperty, scrollPercentage) - } - }) - }) - }) - - - function initiateOnScrollTrigger($addonElem, animationProperty, scrollPercentage, withoutPercentage = false ){ - if( withoutPercentage ){ - let cssProperty = parseInteractionCss(animationProperty, scrollPercentage) - cssProperty['transitionDuration'] = '.1s' - $addonElem.css( cssProperty ) - } - if( scrollPercentage > -1 && scrollPercentage <= 100){ - $addonElem.css( parseInteractionCss(animationProperty, scrollPercentage) ) - } - } - - function parseInteractionCss(animationProperty, scrollPercentage){ - let nextTriggerActions = { - move: { - from: { x:0, y:0, z:0, keyframe:0, f: false }, - to: { x:0, y:0, z:0, keyframe:0, f: false }, - goal: { x:0, y:0, z:0, keyframe:0 } - }, - scale: { - from: { x:1, y:1, z:1, keyframe:0 }, - to: { x:1, y:1, z:1, keyframe:0 }, - goal: { x:1, y:1, z:1, keyframe:0 }, - }, - skew: { - from: { x:0, y:0, keyframe:0 }, - to: { x:0, y:0, keyframe:0 }, - goal: { x:0, y:0, keyframe:0 }, - }, - rotate: { - from: { x:0, y:0, z:0, keyframe:0 }, - to: { x:0, y:0, z:0, keyframe:0 }, - goal: { x:0, y:0, z:0, keyframe:0 }, - }, - opacity: { - from: { value:0, keyframe:0 }, - to: { value:0, keyframe:0 }, - goal: { value:1, keyframe:0 }, - }, - blur: { - from: { value:0, keyframe:0 }, - to: { value:0, keyframe:0 }, - goal: { value: 0, keyframe:0 }, - } - } - - let { animation, origin } = animationProperty - if( typeof origin === 'undefined' ){ - origin = { x_offset: 'center', y_offset: 'center' } - } - let IM = new InteractionMath(animation) - IM.bindCustomAnimation() - IM.actionProperty.map(key=> { - let action = IM.getCustomAnimationActionByName(key, scrollPercentage) // Grater than current keyframe/scrollPercentage - - if( action.from !== null ) { - - Object.assign(nextTriggerActions[key].from, action.from.property) - - nextTriggerActions[key].from.f = true - nextTriggerActions[key].from.keyframe = parseInt(action.from.keyframe) - - if( typeof nextTriggerActions[key].from.x !== "undefined" ) - nextTriggerActions[key].from.x = nextTriggerActions[key].from.x === "" || nextTriggerActions[key].from.x === null ? 0 : parseFloat(nextTriggerActions[key].from.x) - if( typeof nextTriggerActions[key].from.y !== "undefined" ) - nextTriggerActions[key].from.y = nextTriggerActions[key].from.y === "" || nextTriggerActions[key].from.y === null ? 0 : parseFloat(nextTriggerActions[key].from.y) - if( typeof nextTriggerActions[key].from.z !== "undefined" ){ - nextTriggerActions[key].from.z = nextTriggerActions[key].from.z === "" || nextTriggerActions[key].from.z === null ? 0 : parseFloat(nextTriggerActions[key].from.z) - } - if( typeof nextTriggerActions[key].from.value !== "undefined" ) - nextTriggerActions[key].from.value = nextTriggerActions[key].from.value === "" ? 0 : parseFloat(nextTriggerActions[key].from.value) - } - if( action.to !== null ) { - Object.assign(nextTriggerActions[key].to, action.to.property) - - if( typeof nextTriggerActions[key].to.x !== "undefined" ) { - nextTriggerActions[key].to.x = nextTriggerActions[key].to.x === "" || nextTriggerActions[key].to.x === null ? 0 : parseFloat(nextTriggerActions[key].to.x) - nextTriggerActions[key].goal.x = nextTriggerActions[key].to.x - } - if( typeof nextTriggerActions[key].to.y !== "undefined" ) { - nextTriggerActions[key].to.y = nextTriggerActions[key].to.y === "" || nextTriggerActions[key].to.y === null ? 0 : parseFloat(nextTriggerActions[key].to.y) - nextTriggerActions[key].goal.y = nextTriggerActions[key].to.y - } - if( typeof nextTriggerActions[key].to.z !== "undefined" ) { - nextTriggerActions[key].to.z = nextTriggerActions[key].to.z === "" || nextTriggerActions[key].to.z === null? 0 : parseFloat(nextTriggerActions[key].to.z) - nextTriggerActions[key].goal.z = nextTriggerActions[key].to.z - } - if( typeof nextTriggerActions[key].to.value !== "undefined" ) { - nextTriggerActions[key].to.value = nextTriggerActions[key].to.value === "" || nextTriggerActions[key].to.value === null ? 0 : parseFloat(nextTriggerActions[key].to.value) - nextTriggerActions[key].goal.value = nextTriggerActions[key].to.value - } - nextTriggerActions[key].to.keyframe = parseInt(action.to.keyframe) - nextTriggerActions[key].to.f = true - } - - if( nextTriggerActions[key].to.f === true && nextTriggerActions[key].from.f === true && typeof action.fixed === 'undefined'){ - if( key === 'opacity' || key === 'blur' ){ - nextTriggerActions[key] = IM.getOpacity(key,nextTriggerActions[key], scrollPercentage) - }else if( key === 'skew'){ - nextTriggerActions[key] = IM.getSkew(key,nextTriggerActions[key], scrollPercentage) - }else{ - nextTriggerActions[key] = IM.getMoveTransform(key,nextTriggerActions[key], scrollPercentage) - } - } - - }) - - return { - "willChange":"transform", - // "transitionDuration": initialLoader ? '0s' : '0.1s', - '-webkit-transition-timing-function':'linear', - "transitionProperty": "transform, opacity, filter", - "transformOrigin":`${origin.x_offset} ${origin.y_offset}`, - "transformStyle":"preserve-3d", - 'opacity': `${nextTriggerActions.opacity.goal.value}`, - "filter": `blur(${nextTriggerActions.blur.goal.value}px)`, - "-webkit-filter": `blur(${nextTriggerActions.blur.goal.value}px)`, - 'transform':`perspective(1000px) translate3d(${nextTriggerActions.move.goal.x}px, ${nextTriggerActions.move.goal.y}px, ${nextTriggerActions.move.goal.z}px) - scale3d(${nextTriggerActions.scale.goal.x}, ${nextTriggerActions.scale.goal.y}, ${nextTriggerActions.scale.goal.z}) - rotateX(${nextTriggerActions.rotate.goal.x}deg) rotateY(${nextTriggerActions.rotate.goal.y}deg) rotateZ(${nextTriggerActions.rotate.goal.z}deg) - skew(${nextTriggerActions.skew.goal.x}deg, ${nextTriggerActions.skew.goal.y}deg)` - } - } + "use strict"; + if (typeof qubelyInteraction === "undefined") return; + /* + * ==================== + * INTERACTION MATH + * ==================== + */ + + function InteractionMath(animationProperty) { + this.actions = animationProperty; + this.actionProperty = ["move", "rotate", "scale", "skew", "opacity", "blur"]; + this.actionSortList = {}; + } + InteractionMath.prototype.bindCustomAnimation = function () { + this.actionProperty.map((ActionName) => { + this.actionSortList[ActionName] = this.actions.filter((action) => action.name === ActionName); + }); + }; + InteractionMath.prototype.getCustomAnimationActionByName = function (actionName, keyframe = null) { + if (keyframe === null) { + return typeof this.actionSortList[actionName] !== "undefined" ? this.actionSortList[actionName] : []; + } else { + let animation = { from: null, to: null }; + let actions = typeof this.actionSortList[actionName] !== "undefined" ? this.actionSortList[actionName] : []; + if (actions.length === 0) { + return animation; + } + let found = false; + actions.map((action, index) => { + if (keyframe < parseInt(action.keyframe) && animation.to === null) { + if (typeof animation.fixed !== "undefined") delete animation.fixed; + action.toKF = 0; + animation.to = action; + if (typeof actions[index - 1] !== "undefined") { + actions[index - 1].scroll = 0; + animation.from = actions[index - 1]; + } + found = true; + } + if (index === actions.length - 1 && found === false) { + animation.fixed = true; + animation.to = action; + if (typeof actions[index - 1] !== "undefined") { + actions[index - 1].scroll = 0; + animation.from = actions[index - 1]; + } + } + }); + return animation; + } + }; + InteractionMath.prototype.getTAxis = function (from, to, scrollPercentage, combinedPercentage) { + let { toKF, fromKF } = combinedPercentage; + let tf = fromKF === 0 ? scrollPercentage : scrollPercentage - fromKF; + return from - ((from - to) / toKF) * tf; + }; + + InteractionMath.prototype.getMoveTransform = function (key, nextTriggerActions, scrollPercentage) { + let keyframe = nextTriggerActions.to.keyframe; + let Fkeyframe = nextTriggerActions.from.keyframe; + let toKF = isNaN(keyframe) ? 100 : Math.abs(Fkeyframe - keyframe); + let combinedPercentage = { toKF, fromKF: Fkeyframe, totalKF: keyframe }; + + let Xfrom = nextTriggerActions.from.x; + let Xto = nextTriggerActions.to.x; + let Yfrom = nextTriggerActions.from.y; + let Yto = nextTriggerActions.to.y; + let Zfrom = nextTriggerActions.from.z; + let Zto = nextTriggerActions.to.z; + nextTriggerActions.goal.x = this.getTAxis(Xfrom, Xto, scrollPercentage, combinedPercentage); + nextTriggerActions.goal.y = this.getTAxis(Yfrom, Yto, scrollPercentage, combinedPercentage); //IM.getTAxis(Yfrom, Yto, scrollPercentage, combinedPercentage) + nextTriggerActions.goal.z = this.getTAxis(Zfrom, Zto, scrollPercentage, combinedPercentage); + return nextTriggerActions; + }; + InteractionMath.prototype.getSkew = function (key, nextTriggerActions, scrollPercentage) { + let keyframe = nextTriggerActions.to.keyframe; + let Fkeyframe = nextTriggerActions.from.keyframe; + let toKF = isNaN(keyframe) ? 100 : Math.abs(Fkeyframe - keyframe); + + let combinedPercentage = { toKF, fromKF: Fkeyframe, totalKF: keyframe }; + let Xfrom = nextTriggerActions.from.x; + let Xto = nextTriggerActions.to.x; + let Yfrom = nextTriggerActions.from.y; + let Yto = nextTriggerActions.to.y; + nextTriggerActions.goal.x = this.getTAxis(Xfrom, Xto, scrollPercentage, combinedPercentage); + nextTriggerActions.goal.y = this.getTAxis(Yfrom, Yto, scrollPercentage, combinedPercentage); + return nextTriggerActions; + }; + InteractionMath.prototype.getOpacity = function (key, nextTriggerActions, scrollPercentage) { + let keyframe = nextTriggerActions.to.keyframe; + let Fkeyframe = nextTriggerActions.from.keyframe; + let toKF = isNaN(keyframe) ? 100 : Math.abs(Fkeyframe - keyframe); + + let combinedPercentage = { toKF, fromKF: Fkeyframe, totalKF: keyframe }; + let Ofrom = nextTriggerActions.from.value; + let Oto = nextTriggerActions.to.value; + nextTriggerActions.goal.value = this.getTAxis(Ofrom, Oto, scrollPercentage, combinedPercentage); + return nextTriggerActions; + }; + + class MouseTilt { + constructor(element, settings = {}) { + this.width = null; + this.height = null; + this.clientWidth = null; + this.clientHeight = null; + this.left = null; + this.top = null; + + // for Gyroscope sampling + this.gammazero = null; + this.betazero = null; + this.lastgammazero = null; + this.lastbetazero = null; + + this.transitionTimeout = null; + this.updateCall = null; + this.event = null; + + this.updateBind = this.update.bind(this); + this.resetBind = this.reset.bind(this); + + this.element = element; + + this.settings = this.extendSettings(settings); + + this.reverse = this.settings.reverse ? -1 : 1; + this.glare = MouseTilt.isSettingTrue(this.settings.glare); + this.glarePrerender = MouseTilt.isSettingTrue(this.settings["glare-prerender"]); + this.fullPageListening = MouseTilt.isSettingTrue(this.settings["full-page-listening"]); + this.gyroscope = MouseTilt.isSettingTrue(this.settings.gyroscope); + this.gyroscopeSamples = this.settings.gyroscopeSamples; + + this.elementListener = this.getElementListener(); + + if (this.glare) { + this.prepareGlare(); + } + + if (this.fullPageListening) { + this.updateClientSize(); + } + + this.addEventListeners(); + this.updateInitialPosition(); + } + + static isSettingTrue(setting) { + return setting === "" || setting === true || setting === 1; + } + + /** + * Method returns element what will be listen mouse events + * @return {Node} + */ + getElementListener() { + return this.element; + } + + /** + * Method set listen methods for this.elementListener + * @return {Node} + */ + addEventListeners() { + this.onMouseEnterBind = this.onMouseEnter.bind(this); + this.onMouseMoveBind = this.onMouseMove.bind(this); + this.onMouseLeaveBind = this.onMouseLeave.bind(this); + this.onWindowResizeBind = this.onWindowResize.bind(this); + this.onDeviceOrientationBind = this.onDeviceOrientation.bind(this); + + this.elementListener.addEventListener("mouseenter", this.onMouseEnterBind); + this.elementListener.addEventListener("mouseleave", this.onMouseLeaveBind); + this.elementListener.addEventListener("mousemove", this.onMouseMoveBind); + + if (this.glare || this.fullPageListening) { + window.addEventListener("resize", this.onWindowResizeBind); + } + + if (this.gyroscope) { + window.addEventListener("deviceorientation", this.onDeviceOrientationBind); + } + } + + /** + * Method remove event listeners from current this.elementListener + */ + removeEventListeners() { + this.elementListener.removeEventListener("mouseenter", this.onMouseEnterBind); + this.elementListener.removeEventListener("mouseleave", this.onMouseLeaveBind); + this.elementListener.removeEventListener("mousemove", this.onMouseMoveBind); + + if (this.gyroscope) { + window.removeEventListener("deviceorientation", this.onDeviceOrientationBind); + } + + if (this.glare || this.fullPageListening) { + window.removeEventListener("resize", this.onWindowResizeBind); + } + } + + destroy() { + clearTimeout(this.transitionTimeout); + if (this.updateCall !== null) { + cancelAnimationFrame(this.updateCall); + } + + this.reset(); + + this.removeEventListeners(); + this.element.vanillaTilt = null; + delete this.element.vanillaTilt; + + this.element = null; + } + + onDeviceOrientation(event) { + if (event.gamma === null || event.beta === null) { + return; + } + + this.updateElementPosition(); + + if (this.gyroscopeSamples > 0) { + this.lastgammazero = this.gammazero; + this.lastbetazero = this.betazero; + + if (this.gammazero === null) { + this.gammazero = event.gamma; + this.betazero = event.beta; + } else { + this.gammazero = (event.gamma + this.lastgammazero) / 2; + this.betazero = (event.beta + this.lastbetazero) / 2; + } + + this.gyroscopeSamples -= 1; + } + + const totalAngleX = this.settings.gyroscopeMaxAngleX - this.settings.gyroscopeMinAngleX; + const totalAngleY = this.settings.gyroscopeMaxAngleY - this.settings.gyroscopeMinAngleY; + + const degreesPerPixelX = totalAngleX / this.width; + const degreesPerPixelY = totalAngleY / this.height; + + const angleX = event.gamma - (this.settings.gyroscopeMinAngleX + this.gammazero); + const angleY = event.beta - (this.settings.gyroscopeMinAngleY + this.betazero); + + const posX = angleX / degreesPerPixelX; + const posY = angleY / degreesPerPixelY; + + if (this.updateCall !== null) { + cancelAnimationFrame(this.updateCall); + } + + this.event = { + clientX: posX + this.left, + clientY: posY + this.top, + }; + + this.updateCall = requestAnimationFrame(this.updateBind); + } + + onMouseEnter() { + this.updateElementPosition(); + this.element.style.willChange = "transform"; + this.setTransition(); + } + + onMouseMove(event) { + if (this.updateCall !== null) { + cancelAnimationFrame(this.updateCall); + } + + this.event = event; + this.updateCall = requestAnimationFrame(this.updateBind); + } + + onMouseLeave() { + this.setTransition(); + + if (this.settings.reset) { + requestAnimationFrame(this.resetBind); + } + } + + reset() { + this.event = { + clientX: this.left + this.width / 2, + clientY: this.top + this.height / 2, + }; + + if ( + this.element.parentElement !== null && + this.element.parentElement.className === "qubley-interaction-wrapper" + ) { + this.element = this.element.parentElement; + } + if (this.element.className !== "qubley-interaction-wrapper") { + return; + } + + if (this.element && this.element.style) { + this.element.style.transform = + `perspective(${this.settings.perspective}px) ` + + `rotateX(0deg) ` + + `rotateY(0deg) ` + + `scale3d(1, 1, 1)`; + } + + this.resetGlare(); + } + + resetGlare() { + if (this.glare) { + this.glareElement.style.transform = "rotate(180deg) translate(-50%, -50%)"; + this.glareElement.style.opacity = "0"; + } + } + + updateInitialPosition() { + if (this.settings.startX === 0 && this.settings.startY === 0) { + return; + } - } + this.onMouseEnter(); - $window.resize( function(){ - initiateTiltAnimation($window.width()); - }) + if (this.fullPageListening) { + this.event = { + clientX: ((this.settings.startX + this.settings.max) / (2 * this.settings.max)) * this.clientWidth, + clientY: ((this.settings.startY + this.settings.max) / (2 * this.settings.max)) * this.clientHeight, + }; + } else { + this.event = { + clientX: + this.left + ((this.settings.startX + this.settings.max) / (2 * this.settings.max)) * this.width, + clientY: + this.top + ((this.settings.startY + this.settings.max) / (2 * this.settings.max)) * this.height, + }; + } + + let backupScale = this.settings.scale; + this.settings.scale = 1; + this.update(); + this.settings.scale = backupScale; + this.resetGlare(); + } + + getValues() { + let x, y; + + if (this.fullPageListening) { + x = this.event.clientX / this.clientWidth; + y = this.event.clientY / this.clientHeight; + } else { + x = (this.event.clientX - this.left) / this.width; + y = (this.event.clientY - this.top) / this.height; + } + + x = Math.min(Math.max(x, 0), 1); + y = Math.min(Math.max(y, 0), 1); + + let tiltX = (this.reverse * (this.settings.max - x * this.settings.max * 2)).toFixed(2); + let tiltY = (this.reverse * (y * this.settings.max * 2 - this.settings.max)).toFixed(2); + let angle = + Math.atan2( + this.event.clientX - (this.left + this.width / 2), + -(this.event.clientY - (this.top + this.height / 2)) + ) * + (180 / Math.PI); + + return { + tiltX: tiltX, + tiltY: tiltY, + percentageX: x * 100, + percentageY: y * 100, + angle: angle, + }; + } + + updateElementPosition() { + let rect = this.element.getBoundingClientRect(); + + this.width = this.element.offsetWidth; + this.height = this.element.offsetHeight; + this.left = rect.left; + this.top = rect.top; + } + + update() { + let values = this.getValues(); + + this.element.style.transform = + "perspective(" + + this.settings.perspective + + "px) " + + "rotateX(" + + (this.settings.axis === "x" ? 0 : values.tiltY) + + "deg) " + + "rotateY(" + + (this.settings.axis === "y" ? 0 : values.tiltX) + + "deg) " + + "scale3d(" + + this.settings.scale + + ", " + + this.settings.scale + + ", " + + this.settings.scale + + ")"; + + if (this.glare) { + this.glareElement.style.transform = `rotate(${values.angle}deg) translate(-50%, -50%)`; + this.glareElement.style.opacity = `${(values.percentageY * this.settings["max-glare"]) / 100}`; + } + + this.element.dispatchEvent( + new CustomEvent("tiltChange", { + detail: values, + }) + ); + + this.updateCall = null; + } + + /** + * Appends the glare element (if glarePrerender equals false) + * and sets the default style + */ + prepareGlare() { + // If option pre-render is enabled we assume all html/css is present for an optimal glare effect. + if (!this.glarePrerender) { + // Create glare element + const jsTiltGlare = document.createElement("div"); + jsTiltGlare.classList.add("js-tilt-glare"); + + const jsTiltGlareInner = document.createElement("div"); + jsTiltGlareInner.classList.add("js-tilt-glare-inner"); + + jsTiltGlare.appendChild(jsTiltGlareInner); + this.element.appendChild(jsTiltGlare); + } + + this.glareElementWrapper = this.element.querySelector(".js-tilt-glare"); + this.glareElement = this.element.querySelector(".js-tilt-glare-inner"); + + if (this.glarePrerender) { + return; + } + + Object.assign(this.glareElementWrapper.style, { + position: "absolute", + top: "0", + left: "0", + width: "100%", + height: "100%", + overflow: "hidden", + "pointer-events": "none", + }); + + Object.assign(this.glareElement.style, { + position: "absolute", + top: "50%", + left: "50%", + "pointer-events": "none", + "background-image": `linear-gradient(0deg, rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%)`, + width: `${this.element.offsetWidth * 2}px`, + height: `${this.element.offsetWidth * 2}px`, + transform: "rotate(180deg) translate(-50%, -50%)", + "transform-origin": "0% 0%", + opacity: "0", + }); + } + + updateGlareSize() { + if (this.glare) { + Object.assign(this.glareElement.style, { + width: `${this.element.offsetWidth * 2}`, + height: `${this.element.offsetWidth * 2}`, + }); + } + } + + updateClientSize() { + this.clientWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth; + + this.clientHeight = + window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight; + } + + onWindowResize() { + this.updateGlareSize(); + this.updateClientSize(); + } + + setTransition() { + clearTimeout(this.transitionTimeout); + this.element.style.transition = this.settings.speed + "ms " + this.settings.easing; + if (this.glare) + this.glareElement.style.transition = `opacity ${this.settings.speed}ms ${this.settings.easing}`; + + this.transitionTimeout = setTimeout(() => { + this.element.style.transition = ""; + if (this.glare) { + this.glareElement.style.transition = ""; + } + }, this.settings.speed); + } + + extendSettings(settings) { + let defaultSettings = { + reverse: false, + max: 15, + startX: 0, + startY: 0, + perspective: 1000, + easing: "cubic-bezier(.03,.98,.52,.99)", + scale: 1, + speed: 300, + transition: true, + axis: null, + glare: false, + "max-glare": 1, + "glare-prerender": false, + "full-page-listening": false, + "mouse-event-element": null, + reset: true, + gyroscope: true, + gyroscopeMinAngleX: -45, + gyroscopeMaxAngleX: 45, + gyroscopeMinAngleY: -45, + gyroscopeMaxAngleY: 45, + gyroscopeSamples: 10, + }; + + let newSettings = {}; + for (var property in defaultSettings) { + if (property in settings) { + newSettings[property] = settings[property]; + } else if (this.element.hasAttribute("data-tilt-" + property)) { + let attribute = this.element.getAttribute("data-tilt-" + property); + try { + newSettings[property] = JSON.parse(attribute); + } catch (e) { + newSettings[property] = attribute; + } + } else { + newSettings[property] = defaultSettings[property]; + } + } + + return newSettings; + } + + static init(element, settings) { + element.vanillaTilt = new MouseTilt(element, settings); + } + } + + /* + * =========== + * START + * =========== + */ + let $window = $(window); + let windowWidth = $window.width(); + + // Calculate percentage when element on-view + function percentageSeen($element, $window) { + var viewportHeight = $(window).height(), + scrollTop = $window.scrollTop(), + elementOffsetTop = $element.offset().top, + elementHeight = $element.height(); + if (elementOffsetTop > scrollTop + viewportHeight) { + return -1; + } else if (elementOffsetTop + elementHeight < scrollTop) { + return 101; + } else { + var distance = scrollTop + viewportHeight - elementOffsetTop; + var percentage = distance / ((viewportHeight + elementHeight) / 100); + return percentage > 100 ? 100 : percentage; + } + } + + let mouseTiltInstance = {}; + + initiateTiltAnimation(windowWidth); + + function initiateTiltAnimation(windowWidth) { + if (typeof qubelyInteraction["mouse_movement"] !== "undefined") { + let mouseMovementList = qubelyInteraction["mouse_movement"]; + mouseMovementList.map((tiltOpt) => { + let $addonElem = $(`.qubely-block-${tiltOpt.blockId}`); + if (!$addonElem.parent().hasClass("qubley-interaction-wrapper")) { + $addonElem.wrap('
'); + } + + //For mobile viewport + if ( + windowWidth < 768 && + (typeof tiltOpt.animation.enable_mobile === "undefined" || + tiltOpt.animation.enable_mobile === false) + ) { + if (typeof mouseTiltInstance[tiltOpt.blockId] !== "undefined") { + mouseTiltInstance[tiltOpt.blockId].tiltIntance.destroy(); + delete mouseTiltInstance[tiltOpt.blockId]; + } + return false; + } + //For tablet viewport + if ( + windowWidth > 767 && + windowWidth < 991 && + (typeof tiltOpt.animation.enable_tablet === "undefined" || + tiltOpt.animation.enable_tablet === false) + ) { + if (typeof mouseTiltInstance[tiltOpt.blockId] !== "undefined") { + mouseTiltInstance[tiltOpt.blockId].tiltIntance.destroy(); + delete mouseTiltInstance[tiltOpt.blockId]; + } + return false; + } + + if (typeof mouseTiltInstance[tiltOpt.blockId] !== "undefined") { + return false; + } + + let element = document.getElementsByClassName(`qubely-block-${tiltOpt.blockId}`); + if (element.length > 0) { + element = element[0].parentElement; + let settings = { + speed: parseFloat(tiltOpt.animation.mouse_tilt_speed) * 1000, + max: parseFloat(tiltOpt.animation.mouse_tilt_max), + reverse: tiltOpt.animation.mouse_tilt_direction === "opposite", + easing: "cubic-bezier(.03,.98,.52,.99)", + scale: 1.05, + transition: true, + perspective: 1000, + }; + const tiltIntance = new MouseTilt(element, settings); // MouseTilt.init(element, settings) + mouseTiltInstance[tiltOpt.blockId] = { tiltIntance: tiltIntance }; + } + }); + } + } + + if (typeof qubelyInteraction["while_scroll_view"] !== "undefined") { + // /** + // * Do auto scroll 5 px up and down for fix the element position with jquery animate function on window.load + // * set initialLoader = false and when element position fixed then enable it to true for load element smothly in view + // * Make initialLoader = true on second animation + // */ + // let initialLoader = false + // window.onload = function() { + // var doc = document.documentElement; + // var top = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0); + // $('html, body').animate({ scrollTop: top-5 }, 10, function(){ + // $('html, body').animate({ scrollTop: top },'slow', ()=> { initialLoader = true }) + // }) + // } + + //Cache the global animation action object + let scrollActionList = qubelyInteraction["while_scroll_view"]; + let $window = $(window); + + /** + * Set the initial position of each element when page load + * Hide the element to avoid zigzag trouble for the element + * Trigger animation with scrollPercentage if element in view port + * When object fit show the element with some smoth animate after 5 milisecond + */ + $(document).ready(function () { + scrollActionList.map((animationProperty) => { + if ( + windowWidth < 768 && + (typeof animationProperty.enable_mobile === "undefined" || + animationProperty.enable_mobile === false) + ) { + return false; + } + if ( + windowWidth > 767 && + windowWidth < 991 && + (typeof animationProperty.enable_tablet === "undefined" || + animationProperty.enable_tablet === false) + ) { + return false; + } + let $addonElem = $(`.qubely-block-${animationProperty.blockId}`); + $addonElem.addClass("qubley-interaction-hide"); + if (!$addonElem.parent().hasClass("qubley-interaction-wrapper")) { + $addonElem.wrap('
'); + } + let scrollPercentage = percentageSeen($addonElem.parent(".qubley-interaction-wrapper"), $window); + initiateOnScrollTrigger($addonElem, animationProperty, scrollPercentage, true); + setTimeout(() => { + $addonElem.removeClass("qubley-interaction-hide"); + }, 500); + }); + }); + + /** + * When scroll document calculate each element view-port position with exact percentage + * And triger the scroll animation based on properties (move, scale, rotate, opacity, skew) + */ + $(window).on("load", function () { + $(document).on("scroll", function () { + windowWidth = $window.width(); + scrollActionList.map((animationProperty) => { + let $addonElem = $(`.qubely-block-${animationProperty.blockId}`); + + if ( + windowWidth < 768 && + (typeof animationProperty.enable_mobile === "undefined" || + animationProperty.enable_mobile === false) + ) { + $addonElem.removeAttr("style"); + return false; + } + if ( + windowWidth > 767 && + windowWidth < 991 && + (typeof animationProperty.enable_tablet === "undefined" || + animationProperty.enable_tablet === false) + ) { + $addonElem.removeAttr("style"); + return false; + } + if ($addonElem.parent().hasClass("qubley-interaction-wrapper")) { + let scrollPercentage = percentageSeen( + $addonElem.parent(".qubley-interaction-wrapper"), + $window + ); + initiateOnScrollTrigger($addonElem, animationProperty, scrollPercentage); + } + }); + }); + }); + + function initiateOnScrollTrigger($addonElem, animationProperty, scrollPercentage, withoutPercentage = false) { + if (withoutPercentage) { + let cssProperty = parseInteractionCss(animationProperty, scrollPercentage); + cssProperty["transitionDuration"] = ".1s"; + $addonElem.css(cssProperty); + } + if (scrollPercentage > -1 && scrollPercentage <= 100) { + $addonElem.css(parseInteractionCss(animationProperty, scrollPercentage)); + } + } + + function parseInteractionCss(animationProperty, scrollPercentage) { + let nextTriggerActions = { + move: { + from: { x: 0, y: 0, z: 0, keyframe: 0, f: false }, + to: { x: 0, y: 0, z: 0, keyframe: 0, f: false }, + goal: { x: 0, y: 0, z: 0, keyframe: 0 }, + }, + scale: { + from: { x: 1, y: 1, z: 1, keyframe: 0 }, + to: { x: 1, y: 1, z: 1, keyframe: 0 }, + goal: { x: 1, y: 1, z: 1, keyframe: 0 }, + }, + skew: { + from: { x: 0, y: 0, keyframe: 0 }, + to: { x: 0, y: 0, keyframe: 0 }, + goal: { x: 0, y: 0, keyframe: 0 }, + }, + rotate: { + from: { x: 0, y: 0, z: 0, keyframe: 0 }, + to: { x: 0, y: 0, z: 0, keyframe: 0 }, + goal: { x: 0, y: 0, z: 0, keyframe: 0 }, + }, + opacity: { + from: { value: 0, keyframe: 0 }, + to: { value: 0, keyframe: 0 }, + goal: { value: 1, keyframe: 0 }, + }, + blur: { + from: { value: 0, keyframe: 0 }, + to: { value: 0, keyframe: 0 }, + goal: { value: 0, keyframe: 0 }, + }, + }; + + let { animation, origin } = animationProperty; + if (typeof origin === "undefined") { + origin = { x_offset: "center", y_offset: "center" }; + } + let IM = new InteractionMath(animation); + IM.bindCustomAnimation(); + IM.actionProperty.map((key) => { + let action = IM.getCustomAnimationActionByName(key, scrollPercentage); // Grater than current keyframe/scrollPercentage + + if (action.from !== null) { + Object.assign(nextTriggerActions[key].from, action.from.property); + + nextTriggerActions[key].from.f = true; + nextTriggerActions[key].from.keyframe = parseInt(action.from.keyframe); + + if (typeof nextTriggerActions[key].from.x !== "undefined") + nextTriggerActions[key].from.x = + nextTriggerActions[key].from.x === "" || nextTriggerActions[key].from.x === null + ? 0 + : parseFloat(nextTriggerActions[key].from.x); + if (typeof nextTriggerActions[key].from.y !== "undefined") + nextTriggerActions[key].from.y = + nextTriggerActions[key].from.y === "" || nextTriggerActions[key].from.y === null + ? 0 + : parseFloat(nextTriggerActions[key].from.y); + if (typeof nextTriggerActions[key].from.z !== "undefined") { + nextTriggerActions[key].from.z = + nextTriggerActions[key].from.z === "" || nextTriggerActions[key].from.z === null + ? 0 + : parseFloat(nextTriggerActions[key].from.z); + } + if (typeof nextTriggerActions[key].from.value !== "undefined") + nextTriggerActions[key].from.value = + nextTriggerActions[key].from.value === "" + ? 0 + : parseFloat(nextTriggerActions[key].from.value); + } + if (action.to !== null) { + Object.assign(nextTriggerActions[key].to, action.to.property); + + if (typeof nextTriggerActions[key].to.x !== "undefined") { + nextTriggerActions[key].to.x = + nextTriggerActions[key].to.x === "" || nextTriggerActions[key].to.x === null + ? 0 + : parseFloat(nextTriggerActions[key].to.x); + nextTriggerActions[key].goal.x = nextTriggerActions[key].to.x; + } + if (typeof nextTriggerActions[key].to.y !== "undefined") { + nextTriggerActions[key].to.y = + nextTriggerActions[key].to.y === "" || nextTriggerActions[key].to.y === null + ? 0 + : parseFloat(nextTriggerActions[key].to.y); + nextTriggerActions[key].goal.y = nextTriggerActions[key].to.y; + } + if (typeof nextTriggerActions[key].to.z !== "undefined") { + nextTriggerActions[key].to.z = + nextTriggerActions[key].to.z === "" || nextTriggerActions[key].to.z === null + ? 0 + : parseFloat(nextTriggerActions[key].to.z); + nextTriggerActions[key].goal.z = nextTriggerActions[key].to.z; + } + if (typeof nextTriggerActions[key].to.value !== "undefined") { + nextTriggerActions[key].to.value = + nextTriggerActions[key].to.value === "" || nextTriggerActions[key].to.value === null + ? 0 + : parseFloat(nextTriggerActions[key].to.value); + nextTriggerActions[key].goal.value = nextTriggerActions[key].to.value; + } + nextTriggerActions[key].to.keyframe = parseInt(action.to.keyframe); + nextTriggerActions[key].to.f = true; + } + + if ( + nextTriggerActions[key].to.f === true && + nextTriggerActions[key].from.f === true && + typeof action.fixed === "undefined" + ) { + if (key === "opacity" || key === "blur") { + nextTriggerActions[key] = IM.getOpacity(key, nextTriggerActions[key], scrollPercentage); + } else if (key === "skew") { + nextTriggerActions[key] = IM.getSkew(key, nextTriggerActions[key], scrollPercentage); + } else { + nextTriggerActions[key] = IM.getMoveTransform(key, nextTriggerActions[key], scrollPercentage); + } + } + }); + + return { + willChange: "transform", + // "transitionDuration": initialLoader ? '0s' : '0.1s', + "-webkit-transition-timing-function": "linear", + transitionProperty: "transform, opacity, filter", + transformOrigin: `${origin.x_offset} ${origin.y_offset}`, + transformStyle: "preserve-3d", + opacity: `${nextTriggerActions.opacity.goal.value}`, + filter: `blur(${nextTriggerActions.blur.goal.value}px)`, + "-webkit-filter": `blur(${nextTriggerActions.blur.goal.value}px)`, + transform: `perspective(1000px) translate3d(${nextTriggerActions.move.goal.x}px, ${nextTriggerActions.move.goal.y}px, ${nextTriggerActions.move.goal.z}px) + scale3d(${nextTriggerActions.scale.goal.x}, ${nextTriggerActions.scale.goal.y}, ${nextTriggerActions.scale.goal.z}) + rotateX(${nextTriggerActions.rotate.goal.x}deg) rotateY(${nextTriggerActions.rotate.goal.y}deg) rotateZ(${nextTriggerActions.rotate.goal.z}deg) + skew(${nextTriggerActions.skew.goal.x}deg, ${nextTriggerActions.skew.goal.y}deg)`, + }; + } + } -})(jQuery); \ No newline at end of file + $window.resize(function () { + initiateTiltAnimation($window.width()); + }); +})(jQuery); diff --git a/assets/js/jquery.animatedheadline.js b/assets/js/jquery.animatedheadline.js index 6bb2beb0..35859122 100644 --- a/assets/js/jquery.animatedheadline.js +++ b/assets/js/jquery.animatedheadline.js @@ -1,238 +1,258 @@ //Addon Animated Heading (function ($) { - var animatedHeading = function (options) { - this.$heading = options.heading; - this.type = typeof options.type === 'undefined' ? 'word' : options.type; - this.animationDelay = 2500; - //loading bar effect - this.barAnimationDelay = 3800; - this.barWaiting = this.barAnimationDelay - 3000; //3000 is the duration of the transition on the loading bar - set in the scss/css file - //letters effect - this.lettersDelay = 50; - //type effect - this.typeLettersDelay = 150; - this.selectionDuration = 500; - this.typeAnimationDelay = this.selectionDuration + 800; - //text-clip effect - this.revealDuration = 600; - this.revealAnimationDelay = 1500; - this.interval = 0; - this._destroy = false; - this.init() - } - animatedHeading.prototype.init = function () { - //insert element for each letter of a changing word - var element = this.$heading.parent().find('.letters') - this.singleLetters(element.find('.animated-text')); - this.animateHeadline(this.$heading); - } - - animatedHeading.prototype.destroy = function () { - this.$heading.find('.animated-text').each(function (i) { - $(this).addClass('is-hidden') - $(this).removeClass('is-visible') - if (i === 0) { - $(this).removeClass('is-hidden').addClass('is-visible') - } - $(this).attr('style', '') - }) - - const $wrapperElement = this.$heading.find('.qubely-animated-text .animated-text-words-wrapper'); - $wrapperElement.attr('style', ''); - this._destroy = true; - this.$heading = null; - } - - animatedHeading.prototype.singleLetters = function ($words) { - if (this._destroy) { - return; - } - $words.each(function () { - var word = $(this), - letters = word.text().split(''), - selected = word.hasClass('is-visible'); - for (i in letters) { - if (word.parents('.animation-wave').length > 0) letters[i] = '' + letters[i] + ''; - letters[i] = (selected) ? '' + letters[i] + '' : '' + letters[i] + ''; - } - var newLetters = letters.join(''); - word.html(newLetters).css('opacity', 1); - }); - } - - animatedHeading.prototype.animateHeadline = function ($headlines) { - var duration = this.animationDelay; - var self = this; - $headlines.each(function () { - var headline = $(this); - - if (headline.hasClass('loading-bar')) { - duration = self.barAnimationDelay; - setTimeout(function () { headline.find('.qubely-animated-text .animated-text-words-wrapper').addClass('is-loading') }, self.barWaiting); - } else if (headline.hasClass('text-clip')) { - var spanWrapper = headline.find('.qubely-animated-text .animated-text-words-wrapper'), - newWidth = spanWrapper.width() + 5 - if (!$('.block-editor-block-list__layout').length) { - spanWrapper.css('width', newWidth); - } - - } else if (!headline.hasClass('type')) { - //assign to .animated-text-words-wrapper the width of its longest word - var words = headline.find('.qubely-animated-text .animated-text-words-wrapper .animated-text.is-visible'); - self.setParentClassWidth(words, delay = false); - }; - - //trigger animation - setTimeout(function () { - self.hideWord(headline.find('span.is-visible').eq(0)); - }, duration); - - }); - } - - animatedHeading.prototype.hideWord = function ($word) { - var nextWord = this.takeNext($word); - var self = this; - if (this._destroy) { - return; - } - if ($word.parents('.animated-heading-text').hasClass('type')) { - var parentSpan = $word.parent('.animated-text-words-wrapper'); - parentSpan.addClass('selected').removeClass('waiting'); - setTimeout(function () { - parentSpan.removeClass('selected'); - $word.removeClass('is-visible').addClass('is-hidden').children('i').removeClass('in').addClass('out'); - }, self.selectionDuration); - setTimeout(function () { self.showWord(nextWord, self.typeLettersDelay) }, self.typeAnimationDelay); - - } else if ($word.parents('.animated-heading-text').hasClass('letters')) { - var bool = ($word.children('i').length >= nextWord.children('i').length) ? true : false; - self.hideLetter($word.find('i').eq(0), $word, bool, self.lettersDelay); - self.showLetter(nextWord.find('i').eq(0), nextWord, bool, self.lettersDelay); - self.setParentClassWidth(nextWord); - - } else if ($word.parents('.animated-heading-text').hasClass('text-clip')) { - $word.parents('.animated-text-words-wrapper').animate({ width: '2px' }, self.revealDuration, function () { - self.switchWord($word, nextWord); - self.showWord(nextWord); - }); - - } else if ($word.parents('.animated-heading-text').hasClass('loading-bar')) { - $word.parents('.animated-text-words-wrapper').removeClass('is-loading'); - this.switchWord($word, nextWord); - setTimeout(function () { self.hideWord(nextWord) }, self.barAnimationDelay); - setTimeout(function () { $word.parents('.animated-text-words-wrapper').addClass('is-loading') }, self.barWaiting); - this.setParentClassWidth(nextWord); - - } else { - this.switchWord($word, nextWord); - setTimeout(function () { self.hideWord(nextWord) }, self.animationDelay); - this.setParentClassWidth(nextWord); - } - - } - - animatedHeading.prototype.showWord = function ($word, $duration) { - var self = this; - if (this._destroy) { - return; - } - if ($word.parents('.animated-heading-text').hasClass('type')) { - self.showLetter($word.find('i').eq(0), $word, false, $duration); - $word.addClass('is-visible').removeClass('is-hidden'); - - } else if ($word.parents('.animated-heading-text').hasClass('text-clip')) { - $word.parents('.animated-text-words-wrapper').animate({ 'width': $word.width() + 5 }, self.revealDuration, function () { - setTimeout(function () { self.hideWord($word) }, self.revealAnimationDelay); - }); - } - } - - animatedHeading.prototype.hideLetter = function ($letter, $word, $bool, $duration) { - if (this._destroy) { - return; - } - $letter.removeClass('in').addClass('out'); - var self = this; - if (!$letter.is(':last-child')) { - setTimeout(function () { self.hideLetter($letter.next(), $word, $bool, $duration); }, $duration); - } else if ($bool) { - setTimeout(function () { self.hideWord(self.takeNext($word)) }, self.animationDelay); - } - - if ($letter.is(':last-child') && $('html').hasClass('no-csstransitions')) { - var nextWord = self.takeNext($word); - self.switchWord($word, nextWord); - } - } - - animatedHeading.prototype.showLetter = function ($letter, $word, $bool, $duration) { - if (this._destroy) { - return; - } - $letter.addClass('in').removeClass('out'); - var self = this; - if (!$letter.is(':last-child')) { - setTimeout(function () { self.showLetter($letter.next(), $word, $bool, $duration); }, $duration); - } else { - if ($word.parents('.animated-heading-text').hasClass('type')) { setTimeout(function () { $word.parents('.animated-text-words-wrapper').addClass('waiting'); }, 200); } - if (!$bool) { setTimeout(function () { self.hideWord($word) }, self.animationDelay) } - } - } - - animatedHeading.prototype.takeNext = function ($word) { - if (this._destroy) { - return; - } - return (!$word.is(':last-child')) ? $word.next() : $word.parent().children().eq(0); - } - - animatedHeading.prototype.takePrev = function ($word) { - if (this._destroy) { - return; - } - return (!$word.is(':first-child')) ? $word.prev() : $word.parent().children().last(); - } - - animatedHeading.prototype.switchWord = function ($oldWord, $newWord) { - if (this._destroy) { - return; - } - $oldWord.removeClass('is-visible').addClass('is-hidden'); - $newWord.removeClass('is-hidden').addClass('is-visible'); - } - - animatedHeading.prototype.setParentClassWidth = function ($nextWord) { - if (this._destroy) { - return; - } - var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; - var parent = $nextWord.parents('.animated-text-words-wrapper'); - var currentWordWidth = $nextWord.width(); - var customDuration = delay ? this.revealDuration / 2 : 0; - if (this.interval > 0) { - clearInterval(this.interval); - this.interval = 0; - } - var self = this; - setTimeout(function () { - parent.css({ - 'transition-function': 'ease', - 'transitionDuration': self.revealDuration + 'ms', - 'transitionProperty': 'width', - 'width': currentWordWidth + 'px' - }); - }, customDuration); - }; - window.animatedHeading = animatedHeading; - - - //ANIMATED HEADLINE BLOCK - $(':not(.block-editor-block-list__layout) .qubely-block-animated-heading .animated-heading-text').each(function () { - let animatedHeadline = $(this) - if (window.animatedHeading ) { - new window.animatedHeading({ heading: $(animatedHeadline) }) - } - }); - -})(jQuery); \ No newline at end of file + var animatedHeading = function (options) { + this.$heading = options.heading; + this.type = typeof options.type === "undefined" ? "word" : options.type; + this.animationDelay = 2500; + //loading bar effect + this.barAnimationDelay = 3800; + this.barWaiting = this.barAnimationDelay - 3000; //3000 is the duration of the transition on the loading bar - set in the scss/css file + //letters effect + this.lettersDelay = 50; + //type effect + this.typeLettersDelay = 150; + this.selectionDuration = 500; + this.typeAnimationDelay = this.selectionDuration + 800; + //text-clip effect + this.revealDuration = 600; + this.revealAnimationDelay = 1500; + this.interval = 0; + this._destroy = false; + this.init(); + }; + animatedHeading.prototype.init = function () { + //insert element for each letter of a changing word + var element = this.$heading.parent().find(".letters"); + this.singleLetters(element.find(".animated-text")); + this.animateHeadline(this.$heading); + }; + + animatedHeading.prototype.destroy = function () { + this.$heading.find(".animated-text").each(function (i) { + $(this).addClass("is-hidden"); + $(this).removeClass("is-visible"); + if (i === 0) { + $(this).removeClass("is-hidden").addClass("is-visible"); + } + $(this).attr("style", ""); + }); + + const $wrapperElement = this.$heading.find(".qubely-animated-text .animated-text-words-wrapper"); + $wrapperElement.attr("style", ""); + this._destroy = true; + this.$heading = null; + }; + + animatedHeading.prototype.singleLetters = function ($words) { + if (this._destroy) { + return; + } + $words.each(function () { + var word = $(this), + letters = word.text().split(""), + selected = word.hasClass("is-visible"); + for (i in letters) { + if (word.parents(".animation-wave").length > 0) letters[i] = "" + letters[i] + ""; + letters[i] = selected ? '' + letters[i] + "" : "" + letters[i] + ""; + } + var newLetters = letters.join(""); + word.html(newLetters).css("opacity", 1); + }); + }; + + animatedHeading.prototype.animateHeadline = function ($headlines) { + var duration = this.animationDelay; + var self = this; + $headlines.each(function () { + var headline = $(this); + + if (headline.hasClass("loading-bar")) { + duration = self.barAnimationDelay; + setTimeout(function () { + headline.find(".qubely-animated-text .animated-text-words-wrapper").addClass("is-loading"); + }, self.barWaiting); + } else if (headline.hasClass("text-clip")) { + var spanWrapper = headline.find(".qubely-animated-text .animated-text-words-wrapper"), + newWidth = spanWrapper.width() + 5; + if (!$(".block-editor-block-list__layout").length) { + spanWrapper.css("width", newWidth); + } + } else if (!headline.hasClass("type")) { + //assign to .animated-text-words-wrapper the width of its longest word + var words = headline.find( + ".qubely-animated-text .animated-text-words-wrapper .animated-text.is-visible" + ); + self.setParentClassWidth(words, (delay = false)); + } + + //trigger animation + setTimeout(function () { + self.hideWord(headline.find("span.is-visible").eq(0)); + }, duration); + }); + }; + + animatedHeading.prototype.hideWord = function ($word) { + var nextWord = this.takeNext($word); + var self = this; + if (this._destroy) { + return; + } + if ($word.parents(".animated-heading-text").hasClass("type")) { + var parentSpan = $word.parent(".animated-text-words-wrapper"); + parentSpan.addClass("selected").removeClass("waiting"); + setTimeout(function () { + parentSpan.removeClass("selected"); + $word.removeClass("is-visible").addClass("is-hidden").children("i").removeClass("in").addClass("out"); + }, self.selectionDuration); + setTimeout(function () { + self.showWord(nextWord, self.typeLettersDelay); + }, self.typeAnimationDelay); + } else if ($word.parents(".animated-heading-text").hasClass("letters")) { + var bool = $word.children("i").length >= nextWord.children("i").length ? true : false; + self.hideLetter($word.find("i").eq(0), $word, bool, self.lettersDelay); + self.showLetter(nextWord.find("i").eq(0), nextWord, bool, self.lettersDelay); + self.setParentClassWidth(nextWord); + } else if ($word.parents(".animated-heading-text").hasClass("text-clip")) { + $word.parents(".animated-text-words-wrapper").animate({ width: "2px" }, self.revealDuration, function () { + self.switchWord($word, nextWord); + self.showWord(nextWord); + }); + } else if ($word.parents(".animated-heading-text").hasClass("loading-bar")) { + $word.parents(".animated-text-words-wrapper").removeClass("is-loading"); + this.switchWord($word, nextWord); + setTimeout(function () { + self.hideWord(nextWord); + }, self.barAnimationDelay); + setTimeout(function () { + $word.parents(".animated-text-words-wrapper").addClass("is-loading"); + }, self.barWaiting); + this.setParentClassWidth(nextWord); + } else { + this.switchWord($word, nextWord); + setTimeout(function () { + self.hideWord(nextWord); + }, self.animationDelay); + this.setParentClassWidth(nextWord); + } + }; + + animatedHeading.prototype.showWord = function ($word, $duration) { + var self = this; + if (this._destroy) { + return; + } + if ($word.parents(".animated-heading-text").hasClass("type")) { + self.showLetter($word.find("i").eq(0), $word, false, $duration); + $word.addClass("is-visible").removeClass("is-hidden"); + } else if ($word.parents(".animated-heading-text").hasClass("text-clip")) { + $word + .parents(".animated-text-words-wrapper") + .animate({ width: $word.width() + 5 }, self.revealDuration, function () { + setTimeout(function () { + self.hideWord($word); + }, self.revealAnimationDelay); + }); + } + }; + + animatedHeading.prototype.hideLetter = function ($letter, $word, $bool, $duration) { + if (this._destroy) { + return; + } + $letter.removeClass("in").addClass("out"); + var self = this; + if (!$letter.is(":last-child")) { + setTimeout(function () { + self.hideLetter($letter.next(), $word, $bool, $duration); + }, $duration); + } else if ($bool) { + setTimeout(function () { + self.hideWord(self.takeNext($word)); + }, self.animationDelay); + } + + if ($letter.is(":last-child") && $("html").hasClass("no-csstransitions")) { + var nextWord = self.takeNext($word); + self.switchWord($word, nextWord); + } + }; + + animatedHeading.prototype.showLetter = function ($letter, $word, $bool, $duration) { + if (this._destroy) { + return; + } + $letter.addClass("in").removeClass("out"); + var self = this; + if (!$letter.is(":last-child")) { + setTimeout(function () { + self.showLetter($letter.next(), $word, $bool, $duration); + }, $duration); + } else { + if ($word.parents(".animated-heading-text").hasClass("type")) { + setTimeout(function () { + $word.parents(".animated-text-words-wrapper").addClass("waiting"); + }, 200); + } + if (!$bool) { + setTimeout(function () { + self.hideWord($word); + }, self.animationDelay); + } + } + }; + + animatedHeading.prototype.takeNext = function ($word) { + if (this._destroy) { + return; + } + return !$word.is(":last-child") ? $word.next() : $word.parent().children().eq(0); + }; + + animatedHeading.prototype.takePrev = function ($word) { + if (this._destroy) { + return; + } + return !$word.is(":first-child") ? $word.prev() : $word.parent().children().last(); + }; + + animatedHeading.prototype.switchWord = function ($oldWord, $newWord) { + if (this._destroy) { + return; + } + $oldWord.removeClass("is-visible").addClass("is-hidden"); + $newWord.removeClass("is-hidden").addClass("is-visible"); + }; + + animatedHeading.prototype.setParentClassWidth = function ($nextWord) { + if (this._destroy) { + return; + } + var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + var parent = $nextWord.parents(".animated-text-words-wrapper"); + var currentWordWidth = $nextWord.width(); + var customDuration = delay ? this.revealDuration / 2 : 0; + if (this.interval > 0) { + clearInterval(this.interval); + this.interval = 0; + } + var self = this; + setTimeout(function () { + parent.css({ + "transition-function": "ease", + transitionDuration: self.revealDuration + "ms", + transitionProperty: "width", + width: currentWordWidth + "px", + }); + }, customDuration); + }; + window.animatedHeading = animatedHeading; + + //ANIMATED HEADLINE BLOCK + $(":not(.block-editor-block-list__layout) .qubely-block-animated-heading .animated-heading-text").each(function () { + let animatedHeadline = $(this); + if (window.animatedHeading) { + new window.animatedHeading({ heading: $(animatedHeadline) }); + } + }); +})(jQuery); diff --git a/assets/reactjs/gulpfile.js b/assets/reactjs/gulpfile.js index 8ca5f6b0..72e63c4c 100644 --- a/assets/reactjs/gulpfile.js +++ b/assets/reactjs/gulpfile.js @@ -1,21 +1,24 @@ -const gulp = require('gulp'); -const sass = require('gulp-sass'); -const concat = require('gulp-concat'); -const minifyCSS = require('gulp-minify-css'); -const autoprefixer = require('gulp-autoprefixer'); +const gulp = require("gulp"); +const sass = require("gulp-sass"); +const concat = require("gulp-concat"); +const minifyCSS = require("gulp-minify-css"); +const autoprefixer = require("gulp-autoprefixer"); -gulp.task('sass', function() { - return gulp.src(['./src/blocks/**/style.scss','./src/blocks/scss/style.scss']) - .pipe(sass()) - .pipe(autoprefixer({ - browsers: ['last 2 versions'], - cascade: false - })) - .pipe(minifyCSS()) - .pipe(concat('style.min.css')) - .pipe(gulp.dest('../css')) -}) - -gulp.task('watch', function(){ - gulp.watch('src/blocks/**/*.scss', gulp.series('sass')); -}) \ No newline at end of file +gulp.task("sass", function () { + return gulp + .src(["./src/blocks/**/style.scss", "./src/blocks/scss/style.scss"]) + .pipe(sass()) + .pipe( + autoprefixer({ + overrideBrowserslist: ["last 2 versions"], + cascade: false, + }) + ) + .pipe(minifyCSS()) + .pipe(concat("style.min.css")) + .pipe(gulp.dest("../css")); +}); + +gulp.task("watch", function () { + gulp.watch("src/blocks/**/*.scss", gulp.series("sass")); +}); diff --git a/assets/reactjs/package.json b/assets/reactjs/package.json index e167f4c3..5b59eba3 100755 --- a/assets/reactjs/package.json +++ b/assets/reactjs/package.json @@ -50,10 +50,10 @@ "gulp-sass": "^4.0.2", "imports-loader": "^1.2.0", "jquery": "^3.3.1", - "node-sass": "^5.0.0", "path": "^0.12.7", "react": "^17.0.1", "react-dom": "^17.0.1", + "sass": "1.32.13", "sass-loader": "^10.0.5", "style-loader": "^2.0.0", "webpack": "^4.28.1", diff --git a/assets/reactjs/src/blocks/accordion/Edit.js b/assets/reactjs/src/blocks/accordion/Edit.js index d86647d6..ee74f8fe 100644 --- a/assets/reactjs/src/blocks/accordion/Edit.js +++ b/assets/reactjs/src/blocks/accordion/Edit.js @@ -5,99 +5,121 @@ const { InspectorControls, InnerBlocks } = wp.blockEditor; const { createBlock } = wp.blocks; const { compose } = wp.compose; const { withSelect, withDispatch } = wp.data; -const { gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings } } = wp.qubelyComponents -import { accordionItemSettings } from './innerItem'; +const { + gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, +} = wp.qubelyComponents; +import { accordionItemSettings } from "./innerItem"; class AccordionBlock extends Component { + insertAccordionItem() { + let newBlockAttributes; + const { clientId, insertBlock, block } = this.props; + if (block.innerBlocks && block.innerBlocks.length) { + const lastBlockAttributes = block.innerBlocks[block.innerBlocks.length - 1].attributes; + const itemNumber = lastBlockAttributes.itemNumber + 1; + const heading = accordionItemSettings.heading; + newBlockAttributes = Object.assign({}, lastBlockAttributes, { + itemNumber, + heading, + active: false, + defaultText: "", + }); + } else { + newBlockAttributes = accordionItemSettings; + } + insertBlock(createBlock("qubely/accordion-item", newBlockAttributes), undefined, clientId); + } - componentDidMount() { - const { setAttributes, clientId, attributes: { uniqueId } } = this.props - const _client = clientId.substr(0, 6) - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - } + getAccordionTemplate = (attributes) => { + const result = []; + const defaultItems = attributes.defaultItems; + for (let k = 0; k < defaultItems; k++) { + const content = + "Create stylish call-to-action buttons with Qubely Buttons. Play around with typography, design, border and more. Add animations and personalize it to engage visitors instantly."; + result.push(["qubely/accordion-item", { itemNumber: k, defaultText: content }]); + } + return result; + }; - insertAccordionItem() { - let newBlockAttributes; - const { clientId, insertBlock, block } = this.props; - if (block.innerBlocks && block.innerBlocks.length) { - const lastBlockAttributes = block.innerBlocks[block.innerBlocks.length - 1].attributes; - const itemNumber = lastBlockAttributes.itemNumber + 1; - const heading = accordionItemSettings.heading; - newBlockAttributes = Object.assign({}, lastBlockAttributes, { itemNumber, heading, active: false, defaultText: '' }); - } else { - newBlockAttributes = accordionItemSettings; - } - insertBlock(createBlock('qubely/accordion-item', newBlockAttributes), undefined, clientId); - } + render() { + const { + name, + attributes, + isSelectedBlockInRoot, + setAttributes, + attributes: { + uniqueId, + className, + animation, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + interaction, + }, + } = this.props; - getAccordionTemplate = (attributes) => { - const result = [] - const defaultItems = attributes.defaultItems - for (let k = 0; k < defaultItems; k++) { - const content = 'Create stylish call-to-action buttons with Qubely Buttons. Play around with typography, design, border and more. Add animations and personalize it to engage visitors instantly.'; - result.push(['qubely/accordion-item', { itemNumber: k, defaultText: content }]); - } - return result - } + return ( + + + {animationSettings(uniqueId, animation, setAttributes)} + {interactionSettings(uniqueId, interaction, setAttributes)} + - render() { + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} - const { name, attributes, isSelectedBlockInRoot, setAttributes, attributes: { uniqueId, className, animation, enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, interaction } } = this.props; +
+ +
- return ( - - - - {animationSettings(uniqueId, animation, setAttributes)} - {interactionSettings(uniqueId, interaction, setAttributes)} - - - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} - -
- -
- - { - isSelectedBlockInRoot && ( -
- { - this.insertAccordionItem(); - }} - > - {__('Add Accordion Item')} - -
- ) - } -
- ); - } + {isSelectedBlockInRoot && ( +
+ { + this.insertAccordionItem(); + }} + > + {__("Add Accordion Item")} + +
+ )} +
+ ); + } } export default compose([ - withSelect((select, ownProps) => { - const { clientId } = ownProps; - const { getBlock, isBlockSelected, hasSelectedInnerBlock } = select('core/block-editor'); - return { - block: getBlock(clientId), - isSelectedBlockInRoot: isBlockSelected(clientId) || hasSelectedInnerBlock(clientId, true), - }; - }), - withDispatch((dispatch) => { - const { insertBlock, updateBlockAttributes } = dispatch('core/block-editor'); - return { - insertBlock, - updateBlockAttributes - }; - }), -])(AccordionBlock) + withSelect((select, ownProps) => { + const { clientId } = ownProps; + const { getBlock, isBlockSelected, hasSelectedInnerBlock } = select("core/block-editor"); + return { + block: getBlock(clientId), + isSelectedBlockInRoot: isBlockSelected(clientId) || hasSelectedInnerBlock(clientId, true), + }; + }), + withDispatch((dispatch) => { + const { insertBlock, updateBlockAttributes } = dispatch("core/block-editor"); + return { + insertBlock, + updateBlockAttributes, + }; + }), +])(AccordionBlock); diff --git a/assets/reactjs/src/blocks/accordion/Save.js b/assets/reactjs/src/blocks/accordion/Save.js index 55edfa91..c3675c4a 100644 --- a/assets/reactjs/src/blocks/accordion/Save.js +++ b/assets/reactjs/src/blocks/accordion/Save.js @@ -1,16 +1,18 @@ const { Component } = wp.element; const { InnerBlocks } = wp.blockEditor; -const { HelperFunction: { animationAttr, IsInteraction } } = wp.qubelyComponents +const { + HelperFunction: { animationAttr, IsInteraction }, +} = wp.qubelyComponents; class Save extends Component { - render() { - const { animation, uniqueId, itemToggle, interaction} = this.props.attributes; - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - const className = `qubely-block-accordion ${interactionClass} qubely-block-${uniqueId}`; - return ( -
- -
- ); - } + render() { + const { animation, uniqueId, itemToggle, interaction } = this.props.attributes; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + const className = `qubely-block-accordion ${interactionClass} qubely-block-${uniqueId}`; + return ( +
+ +
+ ); + } } -export default Save; \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/accordion/index.js b/assets/reactjs/src/blocks/accordion/index.js index 5953a719..b7fbf791 100755 --- a/assets/reactjs/src/blocks/accordion/index.js +++ b/assets/reactjs/src/blocks/accordion/index.js @@ -1,47 +1,47 @@ -import './style.scss' -import Edit from './Edit' -import Save from './Save'; -const { __ } = wp.i18n -const { registerBlockType } = wp.blocks -const { gloalSettings: { globalAttributes } } = wp.qubelyComponents +import "./style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +const { __ } = wp.i18n; +const { registerBlockType } = wp.blocks; +const { + gloalSettings: { globalAttributes }, +} = wp.qubelyComponents; -registerBlockType('qubely/accordion', { - title: __('Accordion'), - description: 'Display creative collapsible texts with Qubely Accordion.', - category: 'qubely', - icon: {__('Accordion, - keywords: [__('accordion'), __('collapsible'), __('collapse')], - supports: { - html: false, - className: false, - align: ['center', 'wide', 'full'], - }, - example: { - attributes: { - - }, - innerBlocks: [ - { - name: 'qubely/accordion-item', - innerBlocks: [ - { - name: 'qubely/heading', - attributes: { - content: 'Qubely - A Full-fledged Gutenberg Builder', - alignment: { md: "center" } - }, - }, - ], - } - ], - }, - attributes: { - uniqueId: { type: 'string', default: '' }, - defaultItems: { type: 'number', default: 2 }, - itemToggle: { type: 'boolean', default: true }, - ...globalAttributes - }, +registerBlockType("qubely/accordion", { + title: __("Accordion"), + description: "Display creative collapsible texts with Qubely Accordion.", + category: "qubely", + icon: {__("Accordion, + keywords: [__("accordion"), __("collapsible"), __("collapse")], + supports: { + html: false, + className: false, + align: ["center", "wide", "full"], + }, + example: { + attributes: {}, + innerBlocks: [ + { + name: "qubely/accordion-item", + innerBlocks: [ + { + name: "qubely/heading", + attributes: { + content: "Qubely - A Full-fledged Gutenberg Builder", + alignment: { md: "center" }, + }, + }, + ], + }, + ], + }, + attributes: { + uniqueId: { type: "string", default: "" }, + defaultItems: { type: "number", default: 2 }, + itemToggle: { type: "boolean", default: true }, + ...globalAttributes, + }, - edit: Edit, - save: Save + edit: Edit, + save: Save, }); diff --git a/assets/reactjs/src/blocks/accordion/innerItem/Edit.js b/assets/reactjs/src/blocks/accordion/innerItem/Edit.js index 324c41a6..ff80ca66 100755 --- a/assets/reactjs/src/blocks/accordion/innerItem/Edit.js +++ b/assets/reactjs/src/blocks/accordion/innerItem/Edit.js @@ -4,396 +4,530 @@ const { withSelect, withDispatch } = wp.data; const { Component, Fragment } = wp.element; const { PanelBody, SelectControl, Button } = wp.components; const { InspectorControls, InnerBlocks, RichText } = wp.blockEditor; -const { Styles, ColorAdvanced, Range, Typography, BoxShadow, RadioAdvanced, Tabs, Tab, Color, Toggle, Padding, Border, BorderRadius, withCSSGenerator, InspectorTabs, InspectorTab } = wp.qubelyComponents -import icons from '../../../helpers/icons'; - +const { + Styles, + ColorAdvanced, + Range, + Typography, + BoxShadow, + RadioAdvanced, + Tabs, + Tab, + Color, + Toggle, + Padding, + Border, + BorderRadius, + withCSSGenerator, + InspectorTabs, + InspectorTab, +} = wp.qubelyComponents; +import icons from "../../../helpers/icons"; class AccordionItemBlockEdit extends Component { - constructor() { - super(...arguments); - this.findParentAccordion = this.findParentAccordion.bind(this); - this.state = { device: 'md' } - } - componentDidMount() { - const { setAttributes, clientId, attributes: { uniqueId } } = this.props - const _client = clientId.substr(0, 6) - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - } + constructor() { + super(...arguments); + this.findParentAccordion = this.findParentAccordion.bind(this); + this.state = { device: "md" }; + } - findParentAccordion(rootBlock) { - const { block } = this.props; - let result = false; - if (rootBlock.innerBlocks && rootBlock.innerBlocks.length) { - rootBlock.innerBlocks.forEach((item) => { - if (!result && item.clientId === block.clientId) { - result = rootBlock; - } else if (!result) { - result = this.findParentAccordion(item); - } - }); - } - return result; - } + findParentAccordion(rootBlock) { + const { block } = this.props; + let result = false; + if (rootBlock.innerBlocks && rootBlock.innerBlocks.length) { + rootBlock.innerBlocks.forEach((item) => { + if (!result && item.clientId === block.clientId) { + result = rootBlock; + } else if (!result) { + result = this.findParentAccordion(item); + } + }); + } + return result; + } - setGlobalSettings(type, val) { - const { updateBlockAttributes } = this.props; - const parentAccordion = this.findParentAccordion(this.props.rootBlock); - if (parentAccordion.innerBlocks && parentAccordion.innerBlocks.length) { - parentAccordion.innerBlocks.forEach((item) => { - updateBlockAttributes(item.clientId, { [type]: val }); - }); - } - } + setGlobalSettings(type, val) { + const { updateBlockAttributes } = this.props; + const parentAccordion = this.findParentAccordion(this.props.rootBlock); + if (parentAccordion.innerBlocks && parentAccordion.innerBlocks.length) { + parentAccordion.innerBlocks.forEach((item) => { + updateBlockAttributes(item.clientId, { [type]: val }); + }); + } + } - updateRootBlock(type, val) { - const { updateBlockAttributes } = this.props; - const parentAccordion = this.findParentAccordion(this.props.rootBlock); - updateBlockAttributes(parentAccordion.clientId, { [type]: val }); - } + updateRootBlock(type, val) { + const { updateBlockAttributes } = this.props; + const parentAccordion = this.findParentAccordion(this.props.rootBlock); + updateBlockAttributes(parentAccordion.clientId, { [type]: val }); + } - updateItemNumber(index) { - const { updateBlockAttributes } = this.props; - const parentAccordion = this.findParentAccordion(this.props.rootBlock); - while (index < parentAccordion.innerBlocks.length) { - updateBlockAttributes(parentAccordion.innerBlocks[index].clientId, { itemNumber: parentAccordion.innerBlocks[index].attributes.itemNumber - 1 }); - index++ - } - } + updateItemNumber(index) { + const { updateBlockAttributes } = this.props; + const parentAccordion = this.findParentAccordion(this.props.rootBlock); + while (index < parentAccordion.innerBlocks.length) { + updateBlockAttributes(parentAccordion.innerBlocks[index].clientId, { + itemNumber: parentAccordion.innerBlocks[index].attributes.itemNumber - 1, + }); + index++; + } + } - _onClickLabel() { - const { clientId, rootBlock, attributes, setAttributes, updateBlockAttributes } = this.props; - const parentAccordion = this.findParentAccordion(this.props.rootBlock); - const { itemToggle } = rootBlock.attributes; - if (itemToggle) { - parentAccordion.innerBlocks.forEach((item) => { - const val = (item.clientId != clientId) ? false : !attributes.active; - updateBlockAttributes(item.clientId, { active: val }); - }); - } else { - setAttributes({ active: !attributes.active }); - } - } + _onClickLabel() { + const { clientId, rootBlock, attributes, setAttributes, updateBlockAttributes } = this.props; + const parentAccordion = this.findParentAccordion(this.props.rootBlock); + const { itemToggle } = rootBlock.attributes; + if (itemToggle) { + parentAccordion.innerBlocks.forEach((item) => { + const val = item.clientId != clientId ? false : !attributes.active; + updateBlockAttributes(item.clientId, { active: val }); + }); + } else { + setAttributes({ active: !attributes.active }); + } + } - render() { - const { - rootBlock, - attributes, - setAttributes, - isSelected, - isSelectedBlockInRoot - } = this.props; - const { - uniqueId, - className, - itemNumber, - defaultText, - fillType, - heading, - panelColor, - panelColorActive, - iconColor, - iconColorActive, - panelColorActive2, - panelBg, - panelBgActive, - active, - panelIcon, - typography, - bodyBoxShadow, - spacing, - spacingBorder, - spacingBorderColor, - panelPadding, - iconSize, - customIconSize, - iconPosition, - borderRadius, - bodyBg, - bodyPadding, - bodyPaddingAlt, - iconSpacing, - openFirstItem, - richSnippet, - panelBorder, - panelBorderColorActive, - panelBorderRadius, - panelBorderRadiusActive, - panelBoxShadow, - panelBoxShadowActive, - bodyBorder - } = attributes; - const { itemToggle } = rootBlock.attributes; - const { device } = this.state; + render() { + const { rootBlock, attributes, setAttributes, isSelected, isSelectedBlockInRoot } = this.props; + const { + uniqueId, + className, + itemNumber, + defaultText, + fillType, + heading, + panelColor, + panelColorActive, + iconColor, + iconColorActive, + panelColorActive2, + panelBg, + panelBgActive, + active, + panelIcon, + typography, + bodyBoxShadow, + spacing, + spacingBorder, + spacingBorderColor, + panelPadding, + iconSize, + customIconSize, + iconPosition, + borderRadius, + bodyBg, + bodyPadding, + bodyPaddingAlt, + iconSpacing, + openFirstItem, + richSnippet, + panelBorder, + panelBorderColorActive, + panelBorderRadius, + panelBorderRadiusActive, + panelBoxShadow, + panelBoxShadowActive, + bodyBorder, + } = attributes; + const { itemToggle } = rootBlock.attributes; + const { device } = this.state; - return ( - - - - - - this.setGlobalSettings('fillType', val)} - options={[ - { value: 'fill', svg: icons.accordion_fill, label: __('Fill') }, - { value: 'nofill', svg: icons.accordion_classic, label: __('Classic') }, - ]} - /> - this.updateRootBlock('itemToggle', val)} /> - this.setGlobalSettings('openFirstItem', val)} /> - this.setGlobalSettings('richSnippet', val)} /> - + return ( + + + + + + this.setGlobalSettings("fillType", val)} + options={[ + { value: "fill", svg: icons.accordion_fill, label: __("Fill") }, + { value: "nofill", svg: icons.accordion_classic, label: __("Classic") }, + ]} + /> + this.updateRootBlock("itemToggle", val)} + /> + this.setGlobalSettings("openFirstItem", val)} + /> + this.setGlobalSettings("richSnippet", val)} + /> + - - - - this.setGlobalSettings('panelColor', val)} /> - {fillType == 'fill' && - - this.setGlobalSettings('panelBg', val)} /> - this.setGlobalSettings('panelBorder', val)} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - this.setGlobalSettings('panelBoxShadow', value)} disableInset /> - this.setGlobalSettings('panelBorderRadius', value)} - unit={['px', 'em', '%']} max={100} - min={0} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - - } - - - fillType == 'fill' ? this.setGlobalSettings('panelColorActive', val) : this.setGlobalSettings('panelColorActive2', val)} - /> - {fillType == 'fill' && - - this.setGlobalSettings('panelBgActive', val)} /> - this.setGlobalSettings('panelBorderColorActive', val)} /> - this.setGlobalSettings('panelBoxShadowActive', value)} disableInset /> - this.setGlobalSettings('panelBorderRadiusActive', value)} - unit={['px', 'em', '%']} max={100} - min={0} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - - } - - + + + + this.setGlobalSettings("panelColor", val)} + /> + {fillType == "fill" && ( + + this.setGlobalSettings("panelBg", val)} + /> + this.setGlobalSettings("panelBorder", val)} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + this.setGlobalSettings("panelBoxShadow", value) + } + disableInset + /> + + this.setGlobalSettings("panelBorderRadius", value) + } + unit={["px", "em", "%"]} + max={100} + min={0} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + )} + + + + fillType == "fill" + ? this.setGlobalSettings("panelColorActive", val) + : this.setGlobalSettings("panelColorActive2", val) + } + /> + {fillType == "fill" && ( + + this.setGlobalSettings("panelBgActive", val)} + /> + + this.setGlobalSettings("panelBorderColorActive", val) + } + /> + + this.setGlobalSettings("panelBoxShadowActive", value) + } + disableInset + /> + + this.setGlobalSettings("panelBorderRadiusActive", value) + } + unit={["px", "em", "%"]} + max={100} + min={0} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + )} + + - {fillType == 'fill' && - this.setGlobalSettings('panelPadding', value)} - unit={['px', 'em', '%']} max={100} - min={0} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - } - this.setGlobalSettings('typography', val)} device={device} onDeviceChange={value => this.setState({ device: value })} /> - + {fillType == "fill" && ( + this.setGlobalSettings("panelPadding", value)} + unit={["px", "em", "%"]} + max={100} + min={0} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + this.setGlobalSettings("typography", val)} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + - - this.setGlobalSettings('panelIcon', val)} - /> - {panelIcon && - - this.setGlobalSettings('iconSize', val)} - /> - {iconSize == 'custom' && - this.setGlobalSettings('customIconSize', val)} - min={0} - max={100} - unit={['px', 'em', '%']} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} /> - } - this.setGlobalSettings('iconPosition', val)} - /> + + this.setGlobalSettings("panelIcon", val)} + /> + {panelIcon && ( + + this.setGlobalSettings("iconSize", val)} + /> + {iconSize == "custom" && ( + this.setGlobalSettings("customIconSize", val)} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + this.setGlobalSettings("iconPosition", val)} + /> - this.setGlobalSettings('iconSpacing', val)} - min={0} - max={30} - unit={['px', 'em', '%']} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} /> + this.setGlobalSettings("iconSpacing", val)} + min={0} + max={30} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> - - - this.setGlobalSettings('iconColor', val)} /> - - - this.setGlobalSettings('iconColorActive', val)} /> - - - - } - + + + this.setGlobalSettings("iconColor", val)} + /> + + + this.setGlobalSettings("iconColorActive", val)} + /> + + + + )} + - - this.setGlobalSettings((fillType == 'fill') ? 'bodyPadding' : 'bodyPaddingAlt', value)} - unit={['px', 'em', '%']} max={100} - min={0} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - {fillType == 'fill' && - - this.setGlobalSettings('bodyBg', val)} /> - this.setGlobalSettings('bodyBorder', val)} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - this.setGlobalSettings('bodyBoxShadow', value)} disableInset /> - this.setGlobalSettings('borderRadius', value)} - unit={['px', 'em', '%']} max={100} - min={0} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - - } - + + + this.setGlobalSettings( + fillType == "fill" ? "bodyPadding" : "bodyPaddingAlt", + value + ) + } + unit={["px", "em", "%"]} + max={100} + min={0} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + {fillType == "fill" && ( + + this.setGlobalSettings("bodyBg", val)} + /> + this.setGlobalSettings("bodyBorder", val)} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + this.setGlobalSettings("bodyBoxShadow", value)} + disableInset + /> + this.setGlobalSettings("borderRadius", value)} + unit={["px", "em", "%"]} + max={100} + min={0} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + )} + - - this.setGlobalSettings('spacing', value)} unit={['px', 'em', '%']} min={0} max={100} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - this.setGlobalSettings('spacingBorder', value)} min={0} max={10} /> - this.setGlobalSettings('spacingBorderColor', val)} /> - - - - - + + this.setGlobalSettings("spacing", value)} + unit={["px", "em", "%"]} + min={0} + max={100} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + this.setGlobalSettings("spacingBorder", value)} + min={0} + max={10} + /> + this.setGlobalSettings("spacingBorderColor", val)} + /> + + + + + -
-
-
-
this._onClickLabel()} - > - { - (panelIcon && iconPosition == 'left') && - - } - setAttributes({ heading: value })} - allowedFormats={['bold', 'italic', 'strikethrough']} - keepPlaceholderOnFocus - onClick={() => this.updateLabel()} - /> - { - (panelIcon && iconPosition == 'right') && - - } -
+
+
+
+
this._onClickLabel()}> + {panelIcon && iconPosition == "left" && ( + + )} + setAttributes({ heading: value })} + allowedFormats={["bold", "italic", "strikethrough"]} + keepPlaceholderOnFocus + onClick={() => this.updateLabel()} + /> + {panelIcon && iconPosition == "right" && ( + + )} +
- {(isSelectedBlockInRoot) && - - } -
-
- -
-
-
- - ); - } + {isSelectedBlockInRoot && ( + + )} +
+
+ +
+
+
+
+ ); + } } export default compose([ - withSelect((select, ownProps) => { - const { clientId } = ownProps; - const { getBlockHierarchyRootClientId, getBlock, isBlockSelected, hasSelectedInnerBlock } = select('core/block-editor'); - return { - block: getBlock(clientId), - isSelectedBlockInRoot: isBlockSelected(clientId) || hasSelectedInnerBlock(clientId, true), - rootBlock: clientId ? getBlock(getBlockHierarchyRootClientId(clientId)) : null, - }; - }), - withDispatch((dispatch) => { - const { removeBlock, updateBlockAttributes } = dispatch('core/block-editor'); - return { - removeBlock, - updateBlockAttributes - }; - }), - withCSSGenerator() + withSelect((select, ownProps) => { + const { clientId } = ownProps; + const { getBlockHierarchyRootClientId, getBlock, isBlockSelected, hasSelectedInnerBlock } = + select("core/block-editor"); + return { + block: getBlock(clientId), + isSelectedBlockInRoot: isBlockSelected(clientId) || hasSelectedInnerBlock(clientId, true), + rootBlock: clientId ? getBlock(getBlockHierarchyRootClientId(clientId)) : null, + }; + }), + withDispatch((dispatch) => { + const { removeBlock, updateBlockAttributes } = dispatch("core/block-editor"); + return { + removeBlock, + updateBlockAttributes, + }; + }), + withCSSGenerator(), ])(AccordionItemBlockEdit); diff --git a/assets/reactjs/src/blocks/accordion/innerItem/Save.js b/assets/reactjs/src/blocks/accordion/innerItem/Save.js index 1d95b331..17b0c68e 100644 --- a/assets/reactjs/src/blocks/accordion/innerItem/Save.js +++ b/assets/reactjs/src/blocks/accordion/innerItem/Save.js @@ -1,57 +1,82 @@ const { Component } = wp.element; const { InnerBlocks, RichText } = wp.blockEditor; -const { HelperFunction: { animationAttr } } = wp.qubelyComponents +const { + HelperFunction: { animationAttr }, +} = wp.qubelyComponents; class Save extends Component { - render() { - const { uniqueId, itemNumber, heading, panelIcon, iconPosition, fillType, animation, openFirstItem, richSnippet = undefined } = this.props.attributes; - const className = `qubely-accordion-item qubely-type-${fillType} ${openFirstItem && itemNumber == 0 && 'qubely-accordion-active'}`; + render() { + const { + uniqueId, + itemNumber, + heading, + panelIcon, + iconPosition, + fillType, + animation, + openFirstItem, + richSnippet = undefined, + } = this.props.attributes; + const className = `qubely-accordion-item qubely-type-${fillType} ${ + openFirstItem && itemNumber == 0 && "qubely-accordion-active" + }`; - const mainEntryProp = richSnippet ? { - itemscope: true, - itemprop: "mainEntity", - itemtype: "https://schema.org/Question" - } : {} + const mainEntryProp = richSnippet + ? { + itemscope: true, + itemprop: "mainEntity", + itemtype: "https://schema.org/Question", + } + : {}; - const itemPropName = richSnippet ? { - itemprop: "name" - } : {} + const itemPropName = richSnippet + ? { + itemprop: "name", + } + : {}; - const itemPropAnswer = richSnippet ? { - itemscope: true, - itemprop: "acceptedAnswer", - itemtype: "https://schema.org/Answer" - } : {} + const itemPropAnswer = richSnippet + ? { + itemscope: true, + itemprop: "acceptedAnswer", + itemtype: "https://schema.org/Answer", + } + : {}; - return ( -
-
-
- - {(panelIcon && iconPosition == 'left') && } - - {(panelIcon && iconPosition == 'right') && } - -
-
- { - typeof richSnippet !== 'undefined' ? -
- -
- : - - } - -
-
-
- ); - } + return ( +
+
+
+ + {panelIcon && iconPosition == "left" && ( + + )} + + {panelIcon && iconPosition == "right" && ( + + )} + +
+
+ {typeof richSnippet !== "undefined" ? ( +
+ +
+ ) : ( + + )} +
+
+
+ ); + } } -export default Save \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/accordion/innerItem/index.js b/assets/reactjs/src/blocks/accordion/innerItem/index.js index a09dcc3b..0d1abd51 100644 --- a/assets/reactjs/src/blocks/accordion/innerItem/index.js +++ b/assets/reactjs/src/blocks/accordion/innerItem/index.js @@ -1,369 +1,415 @@ /* eslint-disable react/react-in-jsx-scope */ -import '../style.scss'; -import Edit from './Edit' -import Save from './Save'; -const { __ } = wp.i18n -const { registerBlockType } = wp.blocks +import "../style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +const { __ } = wp.i18n; +const { registerBlockType } = wp.blocks; const { Component } = wp.element; const { InnerBlocks, RichText } = wp.blockEditor; -const { HelperFunction: { animationAttr } } = wp.qubelyComponents +const { + HelperFunction: { animationAttr }, +} = wp.qubelyComponents; -const attributes={ - uniqueId:{ type: 'string', default: ''}, - itemNumber:{ type: 'number' }, - heading: { type: 'string', default: 'Accordion Item' }, - active: { type: 'boolean', default: false }, - defaultText: { type: 'string', default: '' }, - fillType: { type: 'string', default: 'fill' }, - openFirstItem: { type: 'boolean', default: true }, - richSnippet: { type: 'boolean', default: false }, +const attributes = { + uniqueId: { type: "string", default: "" }, + itemNumber: { type: "number" }, + heading: { type: "string", default: "Accordion Item" }, + active: { type: "boolean", default: false }, + defaultText: { type: "string", default: "" }, + fillType: { type: "string", default: "fill" }, + openFirstItem: { type: "boolean", default: true }, + richSnippet: { type: "boolean", default: false }, - // Panel - panelColor: { - type:'string', - default: '#000', - style: [ - { - selector: '{{QUBELY}} .qubely-accordion-panel { color: {{panelColor}}; }' - } - ] - }, - panelColorActive: { - type:'string', - default: '#FFF', - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel { color:{{panelColorActive}}; }' - } - ] - }, - panelColorActive2: { - type:'string', - default: '#222', - style: [ - { - condition: [ - { key: 'fillType', relation: '==', value: 'nofill' } - ], - selector: '{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel { color:{{panelColorActive2}}; }' - } - ] - }, - panelBg: { - type: 'object', - default: { - type: 'color', - openColor: 1, - color: '#EEEEEE', - gradient: { - color1: '#EEEEEE', - color2: '#e5e5e5', - direction: 0, - start: 0, - stop: 100, - type: 'linear', - } - }, - style: [ - { - condition:[ - {key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-panel' - } - ] - }, - panelBgActive: { - type: 'object', - default: { - type: 'color', - openColor: 1, - color: 'var(--qubely-color-1)', - gradient: { - color1: '#2476CA', - color2: '#1A5FA4', - direction: 0, - start: 0, - stop: 100, - type: 'linear', - } - }, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel' - } - ] - }, - panelBorder:{ - type: 'object', - default: { - borderType: 'global' - }, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-panel' - } - ] - }, - panelBorderColorActive:{ - type: 'object', - default: { - borderType: 'global' - }, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel {border-color: {{panelBorderColorActive}};}' - } - ] - }, - panelBoxShadow:{ - type: 'object', - default: {}, - style: [ - { - condition:[{ key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-panel' } - ] - }, - panelBoxShadowActive:{ - type: 'object', - default: {}, - style: [ - { - condition:[{ key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel' } - ] - }, - - typography: { - type: 'object', - default: {}, - style: [ - { selector: '{{QUBELY}} .qubely-accordion-panel' } - ] - }, - panelPadding:{ - type: 'object', - default: { - openPadding: 1, - paddingType: 'global', - global: { - md: 15 - }, - unit: 'px' - }, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-panel' - } - ] - }, - panelBorderRadius:{ - type: 'object', - default: { - radiusType: 'global', - }, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-panel' - } - ] - }, - panelBorderRadiusActive:{ - type: 'object', - default: { - radiusType: 'global', - }, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel' - } - ] - }, + // Panel + panelColor: { + type: "string", + default: "#000", + style: [ + { + selector: "{{QUBELY}} .qubely-accordion-panel { color: {{panelColor}}; }", + }, + ], + }, + panelColorActive: { + type: "string", + default: "#FFF", + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel { color:{{panelColorActive}}; }", + }, + ], + }, + panelColorActive2: { + type: "string", + default: "#222", + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "nofill" }], + selector: + "{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel { color:{{panelColorActive2}}; }", + }, + ], + }, + panelBg: { + type: "object", + default: { + type: "color", + openColor: 1, + color: "#EEEEEE", + gradient: { + color1: "#EEEEEE", + color2: "#e5e5e5", + direction: 0, + start: 0, + stop: 100, + type: "linear", + }, + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-panel", + }, + ], + }, + panelBgActive: { + type: "object", + default: { + type: "color", + openColor: 1, + color: "var(--qubely-color-1)", + gradient: { + color1: "#2476CA", + color2: "#1A5FA4", + direction: 0, + start: 0, + stop: 100, + type: "linear", + }, + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel", + }, + ], + }, + panelBorder: { + type: "object", + default: { + borderType: "global", + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-panel", + }, + ], + }, + panelBorderColorActive: { + type: "object", + default: { + borderType: "global", + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: + "{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel {border-color: {{panelBorderColorActive}};}", + }, + ], + }, + panelBoxShadow: { + type: "object", + default: {}, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-panel", + }, + ], + }, + panelBoxShadowActive: { + type: "object", + default: {}, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel", + }, + ], + }, - // Body - bodyBg: { - type: 'object', - default: { - type: 'color', - openColor: 1, - color: '#fff', - gradient: { - color1: '#f2f2f2', - color2: '#e5e5e5', - direction: 0, - start: 0, - stop: 100, - type: 'linear', - } - }, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-body' - } - ] - }, - bodyPadding: { - type: 'object', - default: { - openPadding: 1, - paddingType: 'global', - global: { - md: 15 - }, - unit: 'px' - }, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-body' - } - ] - }, - bodyPaddingAlt: { - type: 'object', - default: { - openPadding: 1, - paddingType: 'custom', - custom: { - md: '15 0 0 0' - }, - unit: 'px' - }, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'nofill' } - ], - selector: '{{QUBELY}} .qubely-accordion-body' - } - ] - }, - bodyBoxShadow:{ - type: 'object', - default: {}, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-body' - } - ] - }, - - bodyBorder:{ - type: 'object', - default: { - borderType: 'global' - }, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-body' - } - ] - }, - borderRadius:{ - type: 'object', - default: { - radiusType: 'global' - }, - style: [ - { - condition:[ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-accordion-body' - } - ] - }, + typography: { + type: "object", + default: {}, + style: [{ selector: "{{QUBELY}} .qubely-accordion-panel" }], + }, + panelPadding: { + type: "object", + default: { + openPadding: 1, + paddingType: "global", + global: { + md: 15, + }, + unit: "px", + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-panel", + }, + ], + }, + panelBorderRadius: { + type: "object", + default: { + radiusType: "global", + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-panel", + }, + ], + }, + panelBorderRadiusActive: { + type: "object", + default: { + radiusType: "global", + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel", + }, + ], + }, - // Panel Icon - panelIcon: { type: 'string', default: 'fa fa-plus' }, - iconSize: {type: 'string', default: '14px', style: [{ condition:[{ key: 'iconSize', relation: '!=', value: 'custom' }], selector: '{{QUBELY}} .qubely-accordion-panel .qubely-accordion-icon { font-size:{{iconSize}}; }' }] }, - customIconSize: {type: 'string', default: {md: 16, unit: 'px'}, style: [{ condition:[{ key: 'iconSize', relation: '==', value: 'custom' }], selector: '{{QUBELY}} .qubely-accordion-panel .qubely-accordion-icon { font-size:{{customIconSize}}; }' }] }, - iconColor: { type:'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-accordion-panel .qubely-accordion-icon { color:{{iconColor}}; }' }] }, - iconColorActive: { type:'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel .qubely-accordion-icon { color:{{iconColorActive}}; }' }] }, - iconPosition: {type: 'string', default: 'right'}, - iconSpacing: {type: 'object', default: {md: 10, unit: 'px'}, style: [{ selector: '{{QUBELY}} .qubely-accordion-panel.qubely-icon-position-left .qubely-accordion-icon { margin-right:{{iconSpacing}}; } {{QUBELY}} .qubely-accordion-panel.qubely-icon-position-right .qubely-accordion-icon { margin-left:{{iconSpacing}}; }' }] }, + // Body + bodyBg: { + type: "object", + default: { + type: "color", + openColor: 1, + color: "#fff", + gradient: { + color1: "#f2f2f2", + color2: "#e5e5e5", + direction: 0, + start: 0, + stop: 100, + type: "linear", + }, + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-body", + }, + ], + }, + bodyPadding: { + type: "object", + default: { + openPadding: 1, + paddingType: "global", + global: { + md: 15, + }, + unit: "px", + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-body", + }, + ], + }, + bodyPaddingAlt: { + type: "object", + default: { + openPadding: 1, + paddingType: "custom", + custom: { + md: "15 0 0 0", + }, + unit: "px", + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "nofill" }], + selector: "{{QUBELY}} .qubely-accordion-body", + }, + ], + }, + bodyBoxShadow: { + type: "object", + default: {}, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-body", + }, + ], + }, - //Spacing - spacing: {type: 'object', default: {md: 10, unit: 'px'}, style: [{ selector: '{{QUBELY}} { margin-bottom: calc( {{spacing}} / 2); padding-bottom: calc( {{spacing}} / 2); }' }] }, - spacingBorder: {type: 'string', default: '', style: [{ selector: '{{QUBELY}} { border-bottom: {{spacingBorder}}px solid; }' }] }, - spacingBorderColor: {type: 'string', default: '', style: [{ selector: '{{QUBELY}} { border-bottom-color: {{spacingBorderColor}}; }' }] }, - -} + bodyBorder: { + type: "object", + default: { + borderType: "global", + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-body", + }, + ], + }, + borderRadius: { + type: "object", + default: { + radiusType: "global", + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-accordion-body", + }, + ], + }, + + // Panel Icon + panelIcon: { type: "string", default: "fa fa-plus" }, + iconSize: { + type: "string", + default: "14px", + style: [ + { + condition: [{ key: "iconSize", relation: "!=", value: "custom" }], + selector: "{{QUBELY}} .qubely-accordion-panel .qubely-accordion-icon { font-size:{{iconSize}}; }", + }, + ], + }, + customIconSize: { + type: "string", + default: { md: 16, unit: "px" }, + style: [ + { + condition: [{ key: "iconSize", relation: "==", value: "custom" }], + selector: "{{QUBELY}} .qubely-accordion-panel .qubely-accordion-icon { font-size:{{customIconSize}}; }", + }, + ], + }, + iconColor: { + type: "string", + default: "", + style: [{ selector: "{{QUBELY}} .qubely-accordion-panel .qubely-accordion-icon { color:{{iconColor}}; }" }], + }, + iconColorActive: { + type: "string", + default: "", + style: [ + { + selector: + "{{QUBELY}} .qubely-accordion-active .qubely-accordion-panel .qubely-accordion-icon { color:{{iconColorActive}}; }", + }, + ], + }, + iconPosition: { type: "string", default: "right" }, + iconSpacing: { + type: "object", + default: { md: 10, unit: "px" }, + style: [ + { + selector: + "{{QUBELY}} .qubely-accordion-panel.qubely-icon-position-left .qubely-accordion-icon { margin-right:{{iconSpacing}}; } {{QUBELY}} .qubely-accordion-panel.qubely-icon-position-right .qubely-accordion-icon { margin-left:{{iconSpacing}}; }", + }, + ], + }, + + //Spacing + spacing: { + type: "object", + default: { md: 10, unit: "px" }, + style: [ + { + selector: + "{{QUBELY}} { margin-bottom: calc( {{spacing}} / 2); padding-bottom: calc( {{spacing}} / 2); }", + }, + ], + }, + spacingBorder: { + type: "string", + default: "", + style: [{ selector: "{{QUBELY}} { border-bottom: {{spacingBorder}}px solid; }" }], + }, + spacingBorderColor: { + type: "string", + default: "", + style: [{ selector: "{{QUBELY}} { border-bottom-color: {{spacingBorderColor}}; }" }], + }, +}; export const accordionItemSettings = { - title: __( 'Accordion' ), - description: 'Display creative collapsible texts with Qubely Accordion.', - parent: [ 'qubely/accordion' ], - icon: {__('Accordion, - category: 'qubely', - supports: { - html: false, - inserter: false, - reusable: false, - }, - attributes, - edit: Edit, - save: Save, - deprecated: [ - { - attributes, - save(props) { - const { uniqueId, itemNumber, heading, panelIcon, iconPosition, fillType, animation, openFirstItem } = props.attributes; - const className = `qubely-accordion-item qubely-type-${fillType} ${openFirstItem && itemNumber == 0 && 'qubely-accordion-active'}`; - return ( -
-
-
- - {(panelIcon && iconPosition == 'left') && } - - {(panelIcon && iconPosition == 'right') && } - -
-
- -
-
-
- ); - } - } - ] + title: __("Accordion"), + description: "Display creative collapsible texts with Qubely Accordion.", + parent: ["qubely/accordion"], + icon: {__("Accordion, + category: "qubely", + supports: { + html: false, + inserter: false, + reusable: false, + }, + attributes, + edit: Edit, + save: Save, + deprecated: [ + { + attributes, + save(props) { + const { uniqueId, itemNumber, heading, panelIcon, iconPosition, fillType, animation, openFirstItem } = + props.attributes; + const className = `qubely-accordion-item qubely-type-${fillType} ${ + openFirstItem && itemNumber == 0 && "qubely-accordion-active" + }`; + return ( +
+
+
+ + {panelIcon && iconPosition == "left" && ( + + )} + + {panelIcon && iconPosition == "right" && ( + + )} + +
+
+ +
+
+
+ ); + }, + }, + ], }; -registerBlockType('qubely/accordion-item', accordionItemSettings); +registerBlockType("qubely/accordion-item", accordionItemSettings); diff --git a/assets/reactjs/src/blocks/accordion/style.scss b/assets/reactjs/src/blocks/accordion/style.scss index fedc11d0..fb36eab3 100755 --- a/assets/reactjs/src/blocks/accordion/style.scss +++ b/assets/reactjs/src/blocks/accordion/style.scss @@ -1,141 +1,141 @@ .qubely-block-accordion { - > .wp-block-qubely-accordion-item { - &:last-child { - padding-bottom: 0; - border-bottom: 0; - margin-bottom: 0; - } - } + > .wp-block-qubely-accordion-item { + &:last-child { + padding-bottom: 0; + border-bottom: 0; + margin-bottom: 0; + } + } - .qubely-accordion-item { - display: block; - .components-button:focus:enabled { - background-color: #ed0b0b; - } - } + .qubely-accordion-item { + display: block; + .components-button:focus:enabled { + background-color: #ed0b0b; + } + } - .qubely-accordion-panel { - .qubely-accordion-panel-handler { - display: flex; - align-items: center; - padding: 0; - margin: 0; - box-shadow: none; - font-size: inherit; - line-height: 1.6; - cursor: pointer; - &:focus, - &:active, - &:hover { - color: inherit; - text-decoration: none; - text-transform: none; - font-style: normal; - outline: none; - box-shadow: none; - } - } + .qubely-accordion-panel { + .qubely-accordion-panel-handler { + display: flex; + align-items: center; + padding: 0; + margin: 0; + box-shadow: none; + font-size: inherit; + line-height: 1.6; + cursor: pointer; + &:focus, + &:active, + &:hover { + color: inherit; + text-decoration: none; + text-transform: none; + font-style: normal; + outline: none; + box-shadow: none; + } + } - &.qubely-icon-position-right { - .qubely-accordion-panel-handler { - justify-content: space-between; - } - } - } + &.qubely-icon-position-right { + .qubely-accordion-panel-handler { + justify-content: space-between; + } + } + } - .qubely-accordion-body { - display: none; - p { - &:first-child { - margin-top: 0; - } - &:last-child { - margin-bottom: 0; - } - } - } + .qubely-accordion-body { + display: none; + p { + &:first-child { + margin-top: 0; + } + &:last-child { + margin-bottom: 0; + } + } + } - .qubely-accordion-active { - .qubely-accordion-body { - display: block; - } - .qubely-accordion-icon { - &.fa-plus:before { - content: "\f068"; - } - &.fa-plus-circle:before { - content: "\f056"; - } - &.fa-plus-square-o:before { - content: "\f147"; - } - &.fa-plus-square:before { - content: "\f146"; - } - &.fa-arrow-circle-o-right:before { - content: "\f01a"; - } - &.fa-arrow-circle-right:before { - content: "\f0ab"; - } - &.fa-angle-right:before { - content: "\f107"; - } - &.fa-angle-double-right:before { - content: "\f103"; - } - &.fa-chevron-right:before { - content: "\f078"; - } - &.fa-chevron-circle-right:before { - content: "\f13a"; - } - &.fa-caret-right:before { - content: "\f0d7"; - } - } - } + .qubely-accordion-active { + .qubely-accordion-body { + display: block; + } + .qubely-accordion-icon { + &.fa-plus:before { + content: "\f068"; + } + &.fa-plus-circle:before { + content: "\f056"; + } + &.fa-plus-square-o:before { + content: "\f147"; + } + &.fa-plus-square:before { + content: "\f146"; + } + &.fa-arrow-circle-o-right:before { + content: "\f01a"; + } + &.fa-arrow-circle-right:before { + content: "\f0ab"; + } + &.fa-angle-right:before { + content: "\f107"; + } + &.fa-angle-double-right:before { + content: "\f103"; + } + &.fa-chevron-right:before { + content: "\f078"; + } + &.fa-chevron-circle-right:before { + content: "\f13a"; + } + &.fa-caret-right:before { + content: "\f0d7"; + } + } + } } // hide drag handler from accordion items [data-type="qubely/accordion-item"] > .editor-block-mover > .editor-block-mover__control-drag-handle { - display: none; + display: none; } .qubely-accordion-add-item { - padding-bottom: 10px; - .components-button { - margin: 0 auto; - background: #f8f8f8; - padding: 10px 15px; - border: 1px solid #efefef; - transition: 400ms; - &:hover { - box-shadow: none !important; - background: #e5e5e5 !important; - border: 1px solid #e2e2e2 !important; - } - svg { - margin-right: 10px; - } - } + padding-bottom: 10px; + .components-button { + margin: 0 auto; + background: #f8f8f8; + padding: 10px 15px; + border: 1px solid #efefef; + transition: 400ms; + &:hover { + box-shadow: none !important; + background: #e5e5e5 !important; + border: 1px solid #e2e2e2 !important; + } + svg { + margin-right: 10px; + } + } } .qubely-accordion-item-remove-button { - height: 20px; - width: 20px; - position: absolute; - top: -10px; - font-size: 11px; - color: #fff !important; - background: #ed0b0b; - border-radius: 50%; - right: -10px; - display: inline-flex; - justify-content: center; - align-items: center; - i { - font-size: 11px !important; - } + height: 20px; + width: 20px; + position: absolute; + top: -10px; + font-size: 11px; + color: #fff !important; + background: #ed0b0b; + border-radius: 50%; + right: -10px; + display: inline-flex; + justify-content: center; + align-items: center; + i { + font-size: 11px !important; + } } .qubely-accordion-item-remove-button i { - font-style: normal; + font-style: normal; } diff --git a/assets/reactjs/src/blocks/advancedlist/Edit.js b/assets/reactjs/src/blocks/advancedlist/Edit.js index fe8c29ff..4a9b9291 100644 --- a/assets/reactjs/src/blocks/advancedlist/Edit.js +++ b/assets/reactjs/src/blocks/advancedlist/Edit.js @@ -1,474 +1,627 @@ -import icons from '../../helpers/icons'; +import icons from "../../helpers/icons"; const { __ } = wp.i18n; -const { - InspectorControls, - BlockControls -} = wp.blockEditor; +const { InspectorControls, BlockControls } = wp.blockEditor; -const { - Component, - Fragment, - createRef -} = wp.element; +const { Component, Fragment, createRef } = wp.element; -const { - PanelBody, - Toolbar, - Tooltip -} = wp.components; +const { PanelBody, Toolbar, Tooltip } = wp.components; const { - Typography, - Alignment, - ContextMenu: { - ContextMenu, - handleContextMenu - }, - gloalSettings: { - globalSettingsPanel, - animationSettings, - interactionSettings - }, - Styles, - Range, - Tabs, - Tab, - Border, - Inline: { - InlineToolbar - }, - RadioAdvanced, - Color, - BoxShadow, - Toggle, - Separator, - IconSelector, - BorderRadius, - Padding, - withCSSGenerator, - InspectorTabs, - InspectorTab + Typography, + Alignment, + ContextMenu: { ContextMenu, handleContextMenu }, + gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, + Styles, + Range, + Tabs, + Tab, + Border, + Inline: { InlineToolbar }, + RadioAdvanced, + Color, + BoxShadow, + Toggle, + Separator, + IconSelector, + BorderRadius, + Padding, + withCSSGenerator, + InspectorTabs, + InspectorTab, } = wp.qubelyComponents; class Edit extends Component { + constructor(props) { + super(props); + this.state = { + device: "md", + spacer: true, + removeItemViaBackSpace: 999, + focusedItem: this.props.attributes.listItems.length - 1, + }; + this.qubelyContextMenu = createRef(); + } - constructor(props) { - super(props); - this.state = { - device: 'md', - spacer: true, - removeItemViaBackSpace: 999, - focusedItem: this.props.attributes.listItems.length - 1 - }; - this.qubelyContextMenu = createRef(); - } - - componentDidMount() { - const { - clientId, - isSelected, - setAttributes, - attributes: { - uniqueId - } - } = this.props; - const _client = clientId.substr(0, 6); - - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - isSelected && this.placeCaretAtEnd(document.querySelector(`.qubely-block-${uniqueId} .qubely-list-item-text-${this.state.focusedItem}`)) - } - componentDidUpdate(prevProps, prevState) { - if (this.props.attributes.listItems.length > prevProps.attributes.listItems.length) { - let focusedListItem = document.querySelector(`.qubely-block-${prevProps.attributes.uniqueId} .qubely-list-item-text-${this.state.focusedItem}`) - focusedListItem.focus() - } else if (this.props.attributes.listItems.length < prevProps.attributes.listItems.length) { - const { focusedItem } = this.state - let focusedListItem = document.querySelector(`.qubely-block-${prevProps.attributes.uniqueId} .qubely-list-item-text-${focusedItem}`) - if (this.props.isSelected && focusedListItem) { - this.placeCaretAtEnd(focusedListItem) - } - } - } - handleListItemChanges = (newValues) => { - const { attributes: { listItems }, setAttributes } = this.props - let newItem = newValues.length - listItems.length == 9 - let emptyItemIndex = newValues.indexOf("
  • ") - if (emptyItemIndex == -1) { - setAttributes({ listItems: newValues }) - } else { - !newItem && this.removeEmptyItem(newValues, emptyItemIndex) - } - } - removeEmptyItem = (currentList, emptyItemIndex) => { - const { setAttributes } = this.props; - let newList = [...currentList] - newList.splice(emptyItemIndex, 9) - newList = newList.join('') - setAttributes({ listItems: newList }) - } - updateListItems = (index, operation) => { - const { attributes: { listItems }, setAttributes } = this.props - let newList = JSON.parse(JSON.stringify(listItems)) - operation == 'add' ? newList.splice(index + 1, 0, '') : newList.splice(index, 1) - setAttributes({ listItems: newList }) - } - modifySpecificItem = (value, index) => { - const { attributes: { listItems }, setAttributes } = this.props; - const modifiedListItems = listItems.map((listItem, currentIndex) => { - let temp = listItem - if (index === currentIndex) { - temp = value - } - return temp - }) - setAttributes({ listItems: modifiedListItems }) - } - renderDeleteOption = (index, alignment) => { - const { focusedItem } = this.state - return ( - - { - this.updateListItems(index, 'delete') - index == focusedItem ? this.setState({ focusedItem: index > 0 ? index - 1 : index }) - : - this.setState({ focusedItem: focusedItem > 0 ? focusedItem - 1 : focusedItem }) - - }}> - - - - ) - - } - renderListItems = () => { - const { attributes: { listItems, alignment, listType, bulletStyle } } = this.props - const { focusedItem, removeItemViaBackSpace } = this.state - const ListTag = (listType == 'ordered') ? 'ol' : 'ul' - return ( - listItems.length > 0 ? - - {listItems.map((item, index) => { - return ( -
  • - {item.length > 0 && alignment == 'right' && this.renderDeleteOption(index, alignment)} -
    this.setState({ focusedItem: index })} - onBlur={(event) => this.modifySpecificItem(event.target.innerText, index)} - onKeyPress={(event) => { - if (event.key == 'Enter') { - event.preventDefault() - this.updateListItems(index, 'add') - this.setState({ focusedItem: index + 1 == listItems.length ? listItems.length : focusedItem + 1 }) - } - } - } - onKeyUp={(event) => { - if (event.key == 'Backspace') { - event.target.innerText.length == 0 && this.setState({ removeItemViaBackSpace: index }) - if (removeItemViaBackSpace == index) { - this.updateListItems(index, 'delete') - this.setState({ focusedItem: index > 0 ? index - 1 : index }) - } - } - }} - > - {item} -
    - {item.length > 0 && alignment != 'right' && this.renderDeleteOption(index, alignment)} -
  • - ) - })} -
    - : - - ) + componentDidMount() { + const { + isSelected, + attributes: { uniqueId }, + } = this.props; - } + isSelected && + this.placeCaretAtEnd( + document.querySelector(`.qubely-block-${uniqueId} .qubely-list-item-text-${this.state.focusedItem}`) + ); + } + componentDidUpdate(prevProps, prevState) { + if (this.props.attributes.listItems.length > prevProps.attributes.listItems.length) { + let focusedListItem = document.querySelector( + `.qubely-block-${prevProps.attributes.uniqueId} .qubely-list-item-text-${this.state.focusedItem}` + ); + focusedListItem.focus(); + } else if (this.props.attributes.listItems.length < prevProps.attributes.listItems.length) { + const { focusedItem } = this.state; + let focusedListItem = document.querySelector( + `.qubely-block-${prevProps.attributes.uniqueId} .qubely-list-item-text-${focusedItem}` + ); + if (this.props.isSelected && focusedListItem) { + this.placeCaretAtEnd(focusedListItem); + } + } + } + handleListItemChanges = (newValues) => { + const { + attributes: { listItems }, + setAttributes, + } = this.props; + let newItem = newValues.length - listItems.length == 9; + let emptyItemIndex = newValues.indexOf("
  • "); + if (emptyItemIndex == -1) { + setAttributes({ listItems: newValues }); + } else { + !newItem && this.removeEmptyItem(newValues, emptyItemIndex); + } + }; + removeEmptyItem = (currentList, emptyItemIndex) => { + const { setAttributes } = this.props; + let newList = [...currentList]; + newList.splice(emptyItemIndex, 9); + newList = newList.join(""); + setAttributes({ listItems: newList }); + }; + updateListItems = (index, operation) => { + const { + attributes: { listItems }, + setAttributes, + } = this.props; + let newList = JSON.parse(JSON.stringify(listItems)); + operation == "add" ? newList.splice(index + 1, 0, "") : newList.splice(index, 1); + setAttributes({ listItems: newList }); + }; + modifySpecificItem = (value, index) => { + const { + attributes: { listItems }, + setAttributes, + } = this.props; + const modifiedListItems = listItems.map((listItem, currentIndex) => { + let temp = listItem; + if (index === currentIndex) { + temp = value; + } + return temp; + }); + setAttributes({ listItems: modifiedListItems }); + }; + renderDeleteOption = (index, alignment) => { + const { focusedItem } = this.state; + return ( + + { + this.updateListItems(index, "delete"); + index == focusedItem + ? this.setState({ focusedItem: index > 0 ? index - 1 : index }) + : this.setState({ focusedItem: focusedItem > 0 ? focusedItem - 1 : focusedItem }); + }} + > + + + + ); + }; + renderListItems = () => { + const { + attributes: { listItems, alignment, listType, bulletStyle }, + } = this.props; + const { focusedItem, removeItemViaBackSpace } = this.state; + const ListTag = listType == "ordered" ? "ol" : "ul"; + return listItems.length > 0 ? ( + + {listItems.map((item, index) => { + return ( +
  • + {item.length > 0 && alignment == "right" && this.renderDeleteOption(index, alignment)} +
    this.setState({ focusedItem: index })} + onBlur={(event) => this.modifySpecificItem(event.target.innerText, index)} + onKeyPress={(event) => { + if (event.key == "Enter") { + event.preventDefault(); + this.updateListItems(index, "add"); + this.setState({ + focusedItem: + index + 1 == listItems.length ? listItems.length : focusedItem + 1, + }); + } + }} + onKeyUp={(event) => { + if (event.key == "Backspace") { + event.target.innerText.length == 0 && + this.setState({ removeItemViaBackSpace: index }); + if (removeItemViaBackSpace == index) { + this.updateListItems(index, "delete"); + this.setState({ focusedItem: index > 0 ? index - 1 : index }); + } + } + }} + > + {item} +
    + {item.length > 0 && alignment != "right" && this.renderDeleteOption(index, alignment)} +
  • + ); + })} +
    + ) : ( + + ); + }; - placeCaretAtEnd = (el) => { - el.focus() - if (typeof window.getSelection != "undefined" - && typeof document.createRange != "undefined") { - var range = document.createRange(); - range.selectNodeContents(el); - range.collapse(false); - var sel = window.getSelection(); - sel.removeAllRanges(); - sel.addRange(range); - } else if (typeof document.body.createTextRange != "undefined") { - var textRange = document.body.createTextRange(); - textRange.moveToElementText(el); - textRange.collapse(false); - textRange.select(); - } - } + placeCaretAtEnd = (el) => { + el.focus(); + if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") { + var range = document.createRange(); + range.selectNodeContents(el); + range.collapse(false); + var sel = window.getSelection(); + sel.removeAllRanges(); + sel.addRange(range); + } else if (typeof document.body.createTextRange != "undefined") { + var textRange = document.body.createTextRange(); + textRange.moveToElementText(el); + textRange.collapse(false); + textRange.select(); + } + }; - render() { - const { - name, - clientId, - isSelected, - attributes, - setAttributes, - attributes: { - uniqueId, - className, - recreateStyles, - alignment, - layout, - listType, - typography, - spacing, - color, - colorHover, - backgroundSize, - background, - backgroundHover, - borderRadius, - border, - borderColorHover, - shadow, - shadowHover, + render() { + const { + name, + clientId, + isSelected, + attributes, + setAttributes, + attributes: { + uniqueId, + className, + recreateStyles, + alignment, + layout, + listType, + typography, + spacing, + color, + colorHover, + backgroundSize, + background, + backgroundHover, + borderRadius, + border, + borderColorHover, + shadow, + shadowHover, - bulletStyle, - bulletSize, - bulletSizeCustom, - bulletColor, - bulletColorHover, - bulletSpacing, - numberCorner, - numberFontSize, - numberBgSize, - useNumberBg, - numberBg, - numberBgHover, + bulletStyle, + bulletSize, + bulletSizeCustom, + bulletColor, + bulletColorHover, + bulletSpacing, + numberCorner, + numberFontSize, + numberBgSize, + useNumberBg, + numberBg, + numberBgHover, - //animation - animation, - //global - globalZindex, - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - hideTablet, - hideMobile, - globalCss, - interaction - } - } = this.props; - const { device } = this.state; + //animation + animation, + //global + globalZindex, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + hideTablet, + hideMobile, + globalCss, + interaction, + }, + } = this.props; + const { device } = this.state; - return ( - - - - - - setAttributes({ layout: val })} - options={[ - { value: 'fill', svg: icons.list_fill, label: __('Fill') }, - { value: 'classic', svg: icons.list_classic, label: __('Classic') } - ]} - /> - setAttributes({ alignment: val })} disableJustify disableToggle /> - - setAttributes({ typography: val })} device={device} onDeviceChange={value => this.setState({ device: value })} /> - + return ( + + + + + + setAttributes({ layout: val })} + options={[ + { value: "fill", svg: icons.list_fill, label: __("Fill") }, + { value: "classic", svg: icons.list_classic, label: __("Classic") }, + ]} + /> + setAttributes({ alignment: val })} + disableJustify + disableToggle + /> + + setAttributes({ typography: val })} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + - - {listType == 'unordered' && - - setAttributes({ bulletStyle: val })} - /> - setAttributes({ bulletSize: val })} - options={[ - { label: 'S', value: '12px', title: __('Small') }, - { label: 'M', value: '16px', title: __('Medium') }, - { label: 'L', value: '20px', title: __('Large') }, - { label: 'XL', value: '28px', title: __('Extra Large') }, - { icon: 'fas fa-cog', value: 'custom', title: __('Custom') } - ]} - /> - {bulletSize == 'custom' && - setAttributes({ bulletSizeCustom: value })} min={0} max={100} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - } - - } - {listType == 'ordered' && - - setAttributes({ numberFontSize: value })} min={10} max={100} /> - setAttributes({ useNumberBg: val, recreateStyles: !recreateStyles })} - /> - { - useNumberBg == 1 && - - setAttributes({ numberBgSize: value })} min={1} max={15} /> - setAttributes({ numberCorner: value })} min={0} max={100} /> - - } - - } - setAttributes({ bulletSpacing: val })} min={0} max={60} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - setAttributes({ bulletColor: val })} /> - {(listType == 'ordered' && useNumberBg == 1) && - setAttributes({ numberBg: val })} /> - } - - - setAttributes({ bulletColorHover: val })} /> - {listType == 'ordered' && useNumberBg == 1 && - setAttributes({ numberBgHover: val })} /> - } - - - + + {listType == "unordered" && ( + + setAttributes({ bulletStyle: val })} + /> + setAttributes({ bulletSize: val })} + options={[ + { label: "S", value: "12px", title: __("Small") }, + { label: "M", value: "16px", title: __("Medium") }, + { label: "L", value: "20px", title: __("Large") }, + { label: "XL", value: "28px", title: __("Extra Large") }, + { icon: "fas fa-cog", value: "custom", title: __("Custom") }, + ]} + /> + {bulletSize == "custom" && ( + setAttributes({ bulletSizeCustom: value })} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + + )} + {listType == "ordered" && ( + + setAttributes({ numberFontSize: value })} + min={10} + max={100} + /> + + setAttributes({ useNumberBg: val, recreateStyles: !recreateStyles }) + } + /> + {useNumberBg == 1 && ( + + setAttributes({ numberBgSize: value })} + min={1} + max={15} + /> + setAttributes({ numberCorner: value })} + min={0} + max={100} + /> + + )} + + )} + setAttributes({ bulletSpacing: val })} + min={0} + max={60} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ bulletColor: val })} + /> + {listType == "ordered" && useNumberBg == 1 && ( + setAttributes({ numberBg: val })} + /> + )} + + + setAttributes({ bulletColorHover: val })} + /> + {listType == "ordered" && useNumberBg == 1 && ( + setAttributes({ numberBgHover: val })} + /> + )} + + + - - setAttributes({ spacing: val })} min={0} max={60} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ backgroundSize: val })} min={0} max={60} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - {layout == 'fill' && - - - setAttributes({ borderRadius: value })} min={0} max={100} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - } + + setAttributes({ spacing: val })} + min={0} + max={60} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ backgroundSize: val })} + min={0} + max={60} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + {layout == "fill" && ( + + + setAttributes({ borderRadius: value })} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + )} - - - setAttributes({ color: val })} /> - {layout == 'fill' && - setAttributes({ background: val })} /> - } - setAttributes({ border: val })} min={0} max={10} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - {layout == 'fill' && - setAttributes({ shadow: value })} /> - } - - - setAttributes({ colorHover: val })} /> - {layout == 'fill' && - setAttributes({ backgroundHover: val })} /> - } - {(border.openBorder != undefined && border.openBorder == 1) && - setAttributes({ borderColorHover: value })} /> - } - {layout == 'fill' && - setAttributes({ shadowHover: value })} /> - } - - - - - - {animationSettings(uniqueId, animation, setAttributes)} - {interactionSettings(uniqueId, interaction, setAttributes)} - - - + + + setAttributes({ color: val })} + /> + {layout == "fill" && ( + setAttributes({ background: val })} + /> + )} + setAttributes({ border: val })} + min={0} + max={10} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + {layout == "fill" && ( + setAttributes({ shadow: value })} + /> + )} + + + setAttributes({ colorHover: val })} + /> + {layout == "fill" && ( + setAttributes({ backgroundHover: val })} + /> + )} + {border.openBorder != undefined && border.openBorder == 1 && ( + setAttributes({ borderColorHover: value })} + /> + )} + {layout == "fill" && ( + setAttributes({ shadowHover: value })} + /> + )} + + + + + + {animationSettings(uniqueId, animation, setAttributes)} + {interactionSettings(uniqueId, interaction, setAttributes)} + + + - - - - - setAttributes({ listType: 'unordered', recreateStyles: !recreateStyles }), - className: `qubely-action-change-listype ${listType == 'unordered' ? 'is-active' : ''}`, - }, - { - icon: 'editor-ol', - title: 'Convert to ordered list', - onClick: () => setAttributes({ listType: 'ordered', recreateStyles: !recreateStyles }), - className: `qubely-action-change-listype ${listType == 'ordered' ? 'is-active' : ''}`, - } - ] - } - /> - + + + + + + setAttributes({ listType: "unordered", recreateStyles: !recreateStyles }), + className: `qubely-action-change-listype ${listType == "unordered" ? "is-active" : ""}`, + }, + { + icon: "editor-ol", + title: "Convert to ordered list", + onClick: () => setAttributes({ listType: "ordered", recreateStyles: !recreateStyles }), + className: `qubely-action-change-listype ${listType == "ordered" ? "is-active" : ""}`, + }, + ]} + /> + - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} -
    -
    handleContextMenu(event, this.qubelyContextMenu.current)} - > - {this.renderListItems()} -
    - -
    -
    -
    -
    - ); - } +
    +
    handleContextMenu(event, this.qubelyContextMenu.current)} + > + {this.renderListItems()} +
    + +
    +
    +
    + + ); + } } -export default withCSSGenerator()(Edit); \ No newline at end of file +export default withCSSGenerator()(Edit); diff --git a/assets/reactjs/src/blocks/advancedlist/Save.js b/assets/reactjs/src/blocks/advancedlist/Save.js index 3f448140..0261d31d 100644 --- a/assets/reactjs/src/blocks/advancedlist/Save.js +++ b/assets/reactjs/src/blocks/advancedlist/Save.js @@ -1,27 +1,34 @@ const { Component } = wp.element; -const { HelperFunction: { animationAttr, IsInteraction } } = wp.qubelyComponents +const { + HelperFunction: { animationAttr, IsInteraction }, +} = wp.qubelyComponents; class Save extends Component { - renderListItems = () => { - const { attributes: { listItems } } = this.props + renderListItems = () => { + const { + attributes: { listItems }, + } = this.props; - return listItems.map((item, i) =>
  • {item}
  • ) - - } - render() { - const { attributes: { uniqueId, alignment, bulletStyle, listType, animation, interaction } } = this.props - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - const ListTag = listType == 'ordered' ? 'ol' : 'ul' - return ( -
    -
    - - {this.renderListItems()} - -
    -
    - ); - } + return listItems.map((item, i) =>
  • {item}
  • ); + }; + render() { + const { + attributes: { uniqueId, alignment, bulletStyle, listType, animation, interaction }, + } = this.props; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + const ListTag = listType == "ordered" ? "ol" : "ul"; + return ( +
    +
    + + {this.renderListItems()} + +
    +
    + ); + } } -export default Save; \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/advancedlist/attributes.js b/assets/reactjs/src/blocks/advancedlist/attributes.js index d8136bf7..027e62ef 100644 --- a/assets/reactjs/src/blocks/advancedlist/attributes.js +++ b/assets/reactjs/src/blocks/advancedlist/attributes.js @@ -1,330 +1,332 @@ const { - gloalSettings: { - globalAttributes - } + gloalSettings: { globalAttributes }, } = wp.qubelyComponents; const attributes = { - // Global - ...globalAttributes, - uniqueId: { - type: 'string', - default: '' - }, - recreateStyles: { - type: 'boolean', - default: true - }, - listType: { - type: 'string', - default: 'unordered' - }, - spacer: { - type: 'object', - default: { - spaceTop: { - md: '10', - unit: "px" - }, - spaceBottom: { - md: '10', - unit: "px" - } - }, - style: [ - { selector: '{{QUBELY}}' } - ] - }, - alignment: { - type: 'string', - default: 'left', - style: [ - { - selector: '{{QUBELY}} .qubely-block-advanced-list {text-align: {{alignment}};}' - } - ] - }, - layout: { - type: 'string', - default: 'fill' - }, + // Global + ...globalAttributes, + uniqueId: { + type: "string", + default: "", + }, + recreateStyles: { + type: "boolean", + default: true, + }, + listType: { + type: "string", + default: "unordered", + }, + spacer: { + type: "object", + default: { + spaceTop: { + md: "10", + unit: "px", + }, + spaceBottom: { + md: "10", + unit: "px", + }, + }, + style: [{ selector: "{{QUBELY}}" }], + }, + alignment: { + type: "string", + default: "left", + style: [ + { + selector: "{{QUBELY}} .qubely-block-advanced-list {text-align: {{alignment}};}", + }, + ], + }, + layout: { + type: "string", + default: "fill", + }, - listItems: { - type: 'array', - default: ['Create advanced list items', 'Options to choose list design', 'Beautiful interaction transitions'] - }, + listItems: { + type: "array", + default: ["Create advanced list items", "Options to choose list design", "Beautiful interaction transitions"], + }, - bulletStyle: { - type: 'object', - default: { - name: 'check-circle-outline', - value: 'far fa-check-circle' - } - }, - bulletSize: { - type: 'string', - default: '16px', - style: [ - { - condition: - [ - { key: 'bulletSize', relation: '!=', value: 'custom' }, - { key: 'listType', relation: '==', value: 'unordered' } - ], - selector: '{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { font-size: {{bulletSize}};}' - } - ] - }, - bulletSizeCustom: { - type: 'object', - default: { - md: 18, - unit: 'px' - }, - style: [ - { - condition: [ - { key: 'bulletSize', relation: '==', value: 'custom' }, - { key: 'listType', relation: '==', value: 'unordered' } - ], - selector: '{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { font-size: {{bulletSizeCustom}};}' - }] - }, - bulletSpacing: { - type: 'object', - default: { - md: 10, - unit: 'px' - }, - style: [ - { - condition: [{ key: 'alignment', relation: '==', value: 'left' }], - selector: '{{QUBELY}} .qubely-list li::before { margin-right: {{bulletSpacing}};}' - }, - { - condition: [{ key: 'alignment', relation: '==', value: 'center' }], - selector: '{{QUBELY}} .qubely-list li::before { margin-right: {{bulletSpacing}};}' - }, - { - condition: - [ - { key: 'alignment', relation: '==', value: 'right' }, - ], - selector: '{{QUBELY}} .qubely-list li::after { margin-left: {{bulletSpacing}};}' - } - ] - }, + bulletStyle: { + type: "object", + default: { + name: "check-circle-outline", + value: "far fa-check-circle", + }, + }, + bulletSize: { + type: "string", + default: "16px", + style: [ + { + condition: [ + { key: "bulletSize", relation: "!=", value: "custom" }, + { key: "listType", relation: "==", value: "unordered" }, + ], + selector: + "{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { font-size: {{bulletSize}};}", + }, + ], + }, + bulletSizeCustom: { + type: "object", + default: { + md: 18, + unit: "px", + }, + style: [ + { + condition: [ + { key: "bulletSize", relation: "==", value: "custom" }, + { key: "listType", relation: "==", value: "unordered" }, + ], + selector: + "{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { font-size: {{bulletSizeCustom}};}", + }, + ], + }, + bulletSpacing: { + type: "object", + default: { + md: 10, + unit: "px", + }, + style: [ + { + condition: [{ key: "alignment", relation: "==", value: "left" }], + selector: "{{QUBELY}} .qubely-list li::before { margin-right: {{bulletSpacing}};}", + }, + { + condition: [{ key: "alignment", relation: "==", value: "center" }], + selector: "{{QUBELY}} .qubely-list li::before { margin-right: {{bulletSpacing}};}", + }, + { + condition: [{ key: "alignment", relation: "==", value: "right" }], + selector: "{{QUBELY}} .qubely-list li::after { margin-left: {{bulletSpacing}};}", + }, + ], + }, - bulletColor: { - type: 'string', - default: '', - style: [ - { selector: '{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after {color: {{bulletColor}};}' } - ] - }, - bulletColorHover: { - type: 'string', - default: '', - style: [ - { selector: '{{QUBELY}} .qubely-list li:hover::before, {{QUBELY}} .qubely-list li:hover::after {color: {{bulletColorHover}};}' } - ] - }, + bulletColor: { + type: "string", + default: "", + style: [ + { + selector: + "{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after {color: {{bulletColor}};}", + }, + ], + }, + bulletColorHover: { + type: "string", + default: "", + style: [ + { + selector: + "{{QUBELY}} .qubely-list li:hover::before, {{QUBELY}} .qubely-list li:hover::after {color: {{bulletColorHover}};}", + }, + ], + }, - useNumberBg: { - type: 'boolean', - default: true - }, - numberFontSize: { - type: 'string', - default: '14', - style: [ - { - condition: [ - { key: 'listType', relation: '==', value: 'ordered' } - ], - selector: '{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { font-size: {{numberFontSize}}px !important;}' - } - ] - }, - numberBgSize: { - type: 'string', - default: '5', - style: [ - { - condition: [ - { key: 'listType', relation: '==', value: 'ordered' }, - { key: 'useNumberBg', relation: '==', value: true } - ], - selector: '{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { padding: {{numberBgSize}}px; }' - } - ] - }, - numberBg: { - type: 'string', - default: '#c2e5ff', - style: [ - { - condition: [ - { key: 'listType', relation: '==', value: 'ordered' }, - { key: 'useNumberBg', relation: '==', value: true } - ], - selector: '{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { background-color: {{numberBg}};}' - } - ] - }, - numberBgHover: { - type: 'string', - default: '', - style: [{ - condition: [ - { key: 'listType', relation: '==', value: 'ordered' }, - { key: 'useNumberBg', relation: '==', value: true } - ], - selector: '{{QUBELY}} .qubely-list li:hover::before, {{QUBELY}} .qubely-list li:hover::after { background-color: {{numberBgHover}};}' - }] - }, - numberCorner: { - type: 'string', - default: '50', - style: [ - { - condition: [ - { key: 'listType', relation: '==', value: 'ordered' }, - { key: 'useNumberBg', relation: '==', value: true } - ], - selector: '{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { border-radius: {{numberCorner}}%;}' - }] - }, + useNumberBg: { + type: "boolean", + default: true, + }, + numberFontSize: { + type: "string", + default: "14", + style: [ + { + condition: [{ key: "listType", relation: "==", value: "ordered" }], + selector: + "{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { font-size: {{numberFontSize}}px !important;}", + }, + ], + }, + numberBgSize: { + type: "string", + default: "5", + style: [ + { + condition: [ + { key: "listType", relation: "==", value: "ordered" }, + { key: "useNumberBg", relation: "==", value: true }, + ], + selector: + "{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { padding: {{numberBgSize}}px; }", + }, + ], + }, + numberBg: { + type: "string", + default: "#c2e5ff", + style: [ + { + condition: [ + { key: "listType", relation: "==", value: "ordered" }, + { key: "useNumberBg", relation: "==", value: true }, + ], + selector: + "{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { background-color: {{numberBg}};}", + }, + ], + }, + numberBgHover: { + type: "string", + default: "", + style: [ + { + condition: [ + { key: "listType", relation: "==", value: "ordered" }, + { key: "useNumberBg", relation: "==", value: true }, + ], + selector: + "{{QUBELY}} .qubely-list li:hover::before, {{QUBELY}} .qubely-list li:hover::after { background-color: {{numberBgHover}};}", + }, + ], + }, + numberCorner: { + type: "string", + default: "50", + style: [ + { + condition: [ + { key: "listType", relation: "==", value: "ordered" }, + { key: "useNumberBg", relation: "==", value: true }, + ], + selector: + "{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after { border-radius: {{numberCorner}}%;}", + }, + ], + }, - typography: { - type: 'object', - default: { - openTypography: 1, - size: { - md: 16, - unit: 'px' - } - }, - style: [ - { selector: '{{QUBELY}} .qubely-list li' }, - { - condition: [{ key: 'listType', relation: '==', value: 'ordered' }], - selector: '{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after ' - } - ] - }, - color: { - type: 'string', - default: '#333', - style: [ - { selector: '{{QUBELY}} .qubely-list li {color: {{color}};}' }] - }, - colorHover: { - type: 'string', - default: '', - style: [ - { selector: '{{QUBELY}} .qubely-list li:hover {color: {{colorHover}};}' }] - }, - spacing: { - type: 'object', - default: { - md: 5, unit: 'px' - }, style: [{ selector: '{{QUBELY}} .qubely-list li:not(:last-child) {margin-bottom: {{spacing}};}' }] - }, + typography: { + type: "object", + default: { + openTypography: 1, + size: { + md: 16, + unit: "px", + }, + }, + style: [ + { selector: "{{QUBELY}} .qubely-list li" }, + { + condition: [{ key: "listType", relation: "==", value: "ordered" }], + selector: "{{QUBELY}} .qubely-list li::before, {{QUBELY}} .qubely-list li::after ", + }, + ], + }, + color: { + type: "string", + default: "#333", + style: [{ selector: "{{QUBELY}} .qubely-list li {color: {{color}};}" }], + }, + colorHover: { + type: "string", + default: "", + style: [{ selector: "{{QUBELY}} .qubely-list li:hover {color: {{colorHover}};}" }], + }, + spacing: { + type: "object", + default: { + md: 5, + unit: "px", + }, + style: [{ selector: "{{QUBELY}} .qubely-list li:not(:last-child) {margin-bottom: {{spacing}};}" }], + }, - backgroundSize: { - type: 'object', - default: { - openPadding: 1, - paddingType: 'global', - global: { - md: '10', - unit: 'px' - } - }, - style: [{ selector: '{{QUBELY}} .qubely-list li' }] - }, + backgroundSize: { + type: "object", + default: { + openPadding: 1, + paddingType: "global", + global: { + md: "10", + unit: "px", + }, + }, + style: [{ selector: "{{QUBELY}} .qubely-list li" }], + }, - background: { - type: 'string', - default: '#f5f5f5', - style: [ - { - condition: [{ key: 'layout', relation: '==', value: 'fill' }], - selector: '{{QUBELY}} .qubely-list li {background-color: {{background}};}' - }] - }, - backgroundHover: { - type: 'string', - default: '', - style: [{ - condition: [{ key: 'layout', relation: '==', value: 'fill' }], - selector: '{{QUBELY}} .qubely-list li:hover {background-color: {{backgroundHover}};}' - }] - }, + background: { + type: "string", + default: "#f5f5f5", + style: [ + { + condition: [{ key: "layout", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-list li {background-color: {{background}};}", + }, + ], + }, + backgroundHover: { + type: "string", + default: "", + style: [ + { + condition: [{ key: "layout", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-list li:hover {background-color: {{backgroundHover}};}", + }, + ], + }, - borderRadius: { - type: 'object', - default: { - openBorderRadius: 1, - radiusType: 'global' - }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-list li' - } - ] - }, - shadow: { - type: 'object', - default: { - color: '' - }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-list li' - } - ] - }, - shadowHover: { - type: 'object', - default: { - color: '' - }, - style: [ - { - condition: [{ key: 'layout', relation: '==', value: 'fill' }], - selector: '{{QUBELY}} .qubely-list li:hover' - } - ] - }, + borderRadius: { + type: "object", + default: { + openBorderRadius: 1, + radiusType: "global", + }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-list li", + }, + ], + }, + shadow: { + type: "object", + default: { + color: "", + }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-list li", + }, + ], + }, + shadowHover: { + type: "object", + default: { + color: "", + }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-list li:hover", + }, + ], + }, - border: { - type: 'object', - default: { - color: "#006fbf", - }, - style: [ - { selector: '{{QUBELY}} .qubely-list li' } - ] - }, - borderColorHover: { - type: 'string', - default: '', - style: [ - { selector: '{{QUBELY}} .qubely-list li:hover {border-bottom-color: {{borderColorHover}};}' } - ] - }, - sourceOfCopiedStyle: { - type: 'boolean', - default: false - } -} + border: { + type: "object", + default: { + color: "#006fbf", + }, + style: [{ selector: "{{QUBELY}} .qubely-list li" }], + }, + borderColorHover: { + type: "string", + default: "", + style: [{ selector: "{{QUBELY}} .qubely-list li:hover {border-bottom-color: {{borderColorHover}};}" }], + }, + sourceOfCopiedStyle: { + type: "boolean", + default: false, + }, +}; -export default attributes; \ No newline at end of file +export default attributes; diff --git a/assets/reactjs/src/blocks/advancedlist/index.js b/assets/reactjs/src/blocks/advancedlist/index.js index 8bdf2a3b..1a8eaddc 100644 --- a/assets/reactjs/src/blocks/advancedlist/index.js +++ b/assets/reactjs/src/blocks/advancedlist/index.js @@ -1,34 +1,36 @@ -import './style.scss'; -import Edit from './Edit'; -import Save from './Save'; -import attributes from './attributes'; +import "./style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +import attributes from "./attributes"; const { __ } = wp.i18n; const { registerBlockType } = wp.blocks; -registerBlockType('qubely/advancedlist', { - title: __('Advanced List'), - description: __('Include stylish lists to display in your site with Qubely Advanced List.'), - category: 'qubely', - icon: {__('Advanced, - keywords: [ - __('Advanced', 'qubely'), - __('list', 'qubely'), - __('advanced list', 'qubely'), - __('Advanced List', 'qubely') - ], - supports: { - align: [ - 'center', - 'wide', - 'full' - ], - }, - example: { - attributes: { - background: '#fff' - }, - }, - attributes, - edit: Edit, - save: Save, +registerBlockType("qubely/advancedlist", { + title: __("Advanced List"), + description: __("Include stylish lists to display in your site with Qubely Advanced List."), + category: "qubely", + icon: ( + {__("Advanced + ), + keywords: [ + __("Advanced", "qubely"), + __("list", "qubely"), + __("advanced list", "qubely"), + __("Advanced List", "qubely"), + ], + supports: { + align: ["center", "wide", "full"], + }, + example: { + attributes: { + background: "#fff", + }, + }, + attributes, + edit: Edit, + save: Save, }); diff --git a/assets/reactjs/src/blocks/advancedlist/style.scss b/assets/reactjs/src/blocks/advancedlist/style.scss index cba5b8f3..6268ee1d 100644 --- a/assets/reactjs/src/blocks/advancedlist/style.scss +++ b/assets/reactjs/src/blocks/advancedlist/style.scss @@ -1,278 +1,277 @@ .qubely-block-advanced-list { - .qubely-action-button { - padding: 5px 15px; - margin-top: 15px; - border-radius: 4px; - font-size: 14px; - background: #f0f1f3; - } - .qubely-list { - list-style: none; - padding: 0; - margin: 0; - >li { - position: relative; - margin: 0; - display: block; - transition: color 400ms, background-color 400ms, border-color 400ms, box-shadow 400ms; - &::before, - &::after { - font-family: "Font Awesome 5 Free"; - font-weight: 900; - transition: color 400ms, background-color 400ms; - } - >span, - >div { - display: inline-block; - } + .qubely-action-button { + padding: 5px 15px; + margin-top: 15px; + border-radius: 4px; + font-size: 14px; + background: #f0f1f3; + } + .qubely-list { + list-style: none; + padding: 0; + margin: 0; + > li { + position: relative; + margin: 0; + display: block; + transition: color 400ms, background-color 400ms, border-color 400ms, box-shadow 400ms; + &::before, + &::after { + font-family: "Font Awesome 5 Free"; + font-weight: 900; + transition: color 400ms, background-color 400ms; + } + > span, + > div { + display: inline-block; + } - .qubely-action-remove { - display: none; - font-size: 12px; - width: 18px; - height: 18px; - line-height: 20px; - text-align: center; - background: rgba(0, 0, 0, .8); - color: #fff; - border-radius: 10px; - position: absolute; - right: 0px; - top: 50%; - transform: translateY(-50%); - cursor: pointer; - &.alignment-left { - right: auto; - left: 0; - } - } + .qubely-action-remove { + display: none; + font-size: 12px; + width: 18px; + height: 18px; + line-height: 20px; + text-align: center; + background: rgba(0, 0, 0, 0.8); + color: #fff; + border-radius: 10px; + position: absolute; + right: 0px; + top: 50%; + transform: translateY(-50%); + cursor: pointer; + &.alignment-left { + right: auto; + left: 0; + } + } - &:hover { - .qubely-action-remove { - display: block; - } - } - } + &:hover { + .qubely-action-remove { + display: block; + } + } + } - [contenteditable=true]:empty:before { - content: attr(placeholder); - color: gray; - padding: 0px 5px 0px 5px; - display: block; /* For Firefox */ - } - - .qubely-action-button { - margin-top: 15px; - } - } + [contenteditable="true"]:empty:before { + content: attr(placeholder); + color: gray; + padding: 0px 5px 0px 5px; + display: block; /* For Firefox */ + } + .qubely-action-button { + margin-top: 15px; + } + } - &.qubely-alignment-left, - &.qubely-alignment-center { - .qubely-list { - >li::after { - display: none; - } - } - } + &.qubely-alignment-left, + &.qubely-alignment-center { + .qubely-list { + > li::after { + display: none; + } + } + } - &.qubely-alignment-center { - .qubely-list { - >li { - justify-content: center; - } - } - } + &.qubely-alignment-center { + .qubely-list { + > li { + justify-content: center; + } + } + } - &.qubely-alignment-right { - .qubely-list { - >li { - justify-content: flex-end; - &::before { - display: none; - } - } - } - } + &.qubely-alignment-right { + .qubely-list { + > li { + justify-content: flex-end; + &::before { + display: none; + } + } + } + } - .qubely-list-type-unordered { - &.qubely-list-bullet-check { - >li::before, - >li::after { - content: "\f00c"; - } - } + .qubely-list-type-unordered { + &.qubely-list-bullet-check { + > li::before, + > li::after { + content: "\f00c"; + } + } - &.qubely-list-bullet-check-square { - >li::before, - >li::after { - content: "\f14a"; - } - } + &.qubely-list-bullet-check-square { + > li::before, + > li::after { + content: "\f14a"; + } + } - &.qubely-list-bullet-check-square-outline { - >li::before, - >li::after { - content: "\f14a"; - font-weight: 400; - } - } + &.qubely-list-bullet-check-square-outline { + > li::before, + > li::after { + content: "\f14a"; + font-weight: 400; + } + } - &.qubely-list-bullet-check-double { - >li::before, - >li::after { - content: "\f560"; - } - } - - &.qubely-list-bullet-check-circle { - >li::before, - >li::after { - content: "\f058"; - } - } + &.qubely-list-bullet-check-double { + > li::before, + > li::after { + content: "\f560"; + } + } - &.qubely-list-bullet-check-circle-outline { - >li::before, - >li::after { - content: "\f058"; - font-weight: 400; - } - } + &.qubely-list-bullet-check-circle { + > li::before, + > li::after { + content: "\f058"; + } + } - &.qubely-list-bullet-square { - >li::before, - >li::after { - content: "\f0c8"; - } - } + &.qubely-list-bullet-check-circle-outline { + > li::before, + > li::after { + content: "\f058"; + font-weight: 400; + } + } - &.qubely-list-bullet-square-outline { - >li::before, - >li::after { - content: "\f0c8"; - font-weight: 400; - } - } - - &.qubely-list-bullet-circle { - >li::before, - >li::after { - content: "\f111"; - } - } + &.qubely-list-bullet-square { + > li::before, + > li::after { + content: "\f0c8"; + } + } - &.qubely-list-bullet-circle-outline { - >li::before, - >li::after { - content: "\f111"; - font-weight: 400; - } - } + &.qubely-list-bullet-square-outline { + > li::before, + > li::after { + content: "\f0c8"; + font-weight: 400; + } + } - &.qubely-list-bullet-arrow-right { - >li::before, - >li::after { - content: "\f061"; - } - } + &.qubely-list-bullet-circle { + > li::before, + > li::after { + content: "\f111"; + } + } - &.qubely-list-bullet-arrow-left { - >li::before, - >li::after { - content: "\f060"; - } - } + &.qubely-list-bullet-circle-outline { + > li::before, + > li::after { + content: "\f111"; + font-weight: 400; + } + } - &.qubely-list-bullet-arrow-circle-right { - >li::before, - >li::after { - content: "\f0a9"; - } - } + &.qubely-list-bullet-arrow-right { + > li::before, + > li::after { + content: "\f061"; + } + } - &.qubely-list-bullet-arrow-circle-left { - >li::before, - >li::after { - content: "\f0a8"; - } - } - - &.qubely-list-bullet-arrow-alt-circle-right { - >li::before, - >li::after { - content: "\f35a"; - font-weight: 400; - } - } - &.qubely-list-bullet-arrow-alt-circle-left { - >li::before, - >li::after { - content: "\f359"; - font-weight: 400; - } - } - &.qubely-list-bullet-long-arrow-alt-right { - >li::before, - >li::after { - content: "\f30b"; - } - } - &.qubely-list-bullet-long-arrow-alt-left { - >li::before, - >li::after { - content: "\f30a"; - } - } - &.qubely-list-bullet-chevron-right { - >li::before, - >li::after { - content: "\f054"; - } - } - &.qubely-list-bullet-chevron-left { - >li::before, - >li::after { - content: "\f053"; - } - } - &.qubely-list-bullet-angle-right { - >li::before, - >li::after { - content: "\f105"; - } - } - &.qubely-list-bullet-angle-left { - >li::before, - >li::after { - content: "\f104"; - } - } - &.qubely-list-bullet-star { - >li::before, - >li::after { - content: "\f005"; - } - } - &.qubely-list-bullet-star-outline { - >li::before, - >li::after { - content: "\f005"; - font-weight: 400; - } - } - } + &.qubely-list-bullet-arrow-left { + > li::before, + > li::after { + content: "\f060"; + } + } - .qubely-list-type-ordered { - counter-reset: qubely-ol-counter; - >li { - counter-increment: qubely-ol-counter; - &::before, - &::after { - text-align: center; - font-size: 1em; - content: counter(qubely-ol-counter); - } - } - } -} \ No newline at end of file + &.qubely-list-bullet-arrow-circle-right { + > li::before, + > li::after { + content: "\f0a9"; + } + } + + &.qubely-list-bullet-arrow-circle-left { + > li::before, + > li::after { + content: "\f0a8"; + } + } + + &.qubely-list-bullet-arrow-alt-circle-right { + > li::before, + > li::after { + content: "\f35a"; + font-weight: 400; + } + } + &.qubely-list-bullet-arrow-alt-circle-left { + > li::before, + > li::after { + content: "\f359"; + font-weight: 400; + } + } + &.qubely-list-bullet-long-arrow-alt-right { + > li::before, + > li::after { + content: "\f30b"; + } + } + &.qubely-list-bullet-long-arrow-alt-left { + > li::before, + > li::after { + content: "\f30a"; + } + } + &.qubely-list-bullet-chevron-right { + > li::before, + > li::after { + content: "\f054"; + } + } + &.qubely-list-bullet-chevron-left { + > li::before, + > li::after { + content: "\f053"; + } + } + &.qubely-list-bullet-angle-right { + > li::before, + > li::after { + content: "\f105"; + } + } + &.qubely-list-bullet-angle-left { + > li::before, + > li::after { + content: "\f104"; + } + } + &.qubely-list-bullet-star { + > li::before, + > li::after { + content: "\f005"; + } + } + &.qubely-list-bullet-star-outline { + > li::before, + > li::after { + content: "\f005"; + font-weight: 400; + } + } + } + + .qubely-list-type-ordered { + counter-reset: qubely-ol-counter; + > li { + counter-increment: qubely-ol-counter; + &::before, + &::after { + text-align: center; + font-size: 1em; + content: counter(qubely-ol-counter); + } + } + } +} diff --git a/assets/reactjs/src/blocks/animatedheadline/Edit.js b/assets/reactjs/src/blocks/animatedheadline/Edit.js index 7e06f46c..9bf6aa3e 100644 --- a/assets/reactjs/src/blocks/animatedheadline/Edit.js +++ b/assets/reactjs/src/blocks/animatedheadline/Edit.js @@ -1,314 +1,344 @@ const { __ } = wp.i18n; -const { - AlignmentToolbar, - BlockControls, - InspectorControls, -} = wp.blockEditor; +const { AlignmentToolbar, BlockControls, InspectorControls } = wp.blockEditor; const { Component, Fragment, RawHTML, createRef } = wp.element; const { PanelBody, SelectControl, FormTokenField, TextControl } = wp.components; const { - BorderRadius, - Color, - ColorAdvanced, - ContextMenu: { - ContextMenu, - handleContextMenu - }, - gloalSettings: { - globalSettingsPanel, - animationSettings, - interactionSettings - }, - HeadingToolbar, - Typography, - Range, - withCSSGenerator, - InspectorTabs, - InspectorTab -} = wp.qubelyComponents + BorderRadius, + Color, + ColorAdvanced, + ContextMenu: { ContextMenu, handleContextMenu }, + gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, + HeadingToolbar, + Typography, + Range, + withCSSGenerator, + InspectorTabs, + InspectorTab, +} = wp.qubelyComponents; -const defaultTexts = ['Demo-one', 'Demo-two'] +const defaultTexts = ["Demo-one", "Demo-two"]; class Edit extends Component { + constructor(props) { + super(props); + this._getAnimationClass = this._getAnimationClass.bind(this); + this._handleTypeChange = this._handleTypeChange.bind(this); + this.state = { + device: "md", + animationClass: this._getAnimationClass(this.props.attributes.animationType), + }; + this.qubelyContextMenu = createRef(); + } + componentDidMount() { + this.anim = new window.animatedHeading({ heading: $(this.animatedHeading) }); + } - constructor(props) { - super(props); - this._getAnimationClass = this._getAnimationClass.bind(this); - this._handleTypeChange = this._handleTypeChange.bind(this); - this.state = { - device: 'md', - animationClass: this._getAnimationClass(this.props.attributes.animationType) - }; - this.qubelyContextMenu = createRef(); - } - componentDidMount() { - const { setAttributes, name, clientId, attributes, attributes: { uniqueId } } = this.props - const _client = clientId.substr(0, 6) - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - - this.anim = new window.animatedHeading({ heading: $(this.animatedHeading) }) - } - - componentDidUpdate(prevProps, prevState) { - const { animationType, animatedText, level } = this.props.attributes - const { attributes } = prevProps - if ((animationType !== attributes.animationType) || (animatedText.length !== attributes.animatedText.length) || (level !== attributes.level)) { - if (this.anim) { - this.anim.destroy(); - delete this.anim; - setTimeout(() => { - this.anim = new window.animatedHeading({ heading: $(this.animatedHeading) }) - }, 100) - } - } - } - - _handleTypeChange(val) { - const { attributes: { animatedTextColor }, setAttributes } = this.props - this.setState({ animationClass: this._getAnimationClass(val) }) - setAttributes(!(val === 'clip' || val === 'flip' || val === 'fade-in' || val === 'loading-bar' || val === 'push') ? { animationType: val, animatedTextColor: { ...animatedTextColor, type: 'color' } } : { animationType: val }) - } - _getAnimationClass(value = '') { - let animationClass = '' - switch (value) { - case 'blinds': - animationClass = 'letters animation-blinds' - break - case 'delete-typing': - animationClass = 'letters type' - break - case 'flip': - animationClass = 'text-animation-flip' - break - case 'fade-in': - animationClass = 'zoom' - break - case 'loading-bar': - animationClass = 'loading-bar' - break - case 'scale': - animationClass = 'letters scale' - break - case 'push': - animationClass = 'push' - break - case 'wave': - animationClass = 'letters animation-wave' - break - default: - animationClass = 'text-clip' - } - - return animationClass - } - - render() { - const { - name, - clientId, - className, - attributes, - setAttributes, - attributes: { - uniqueId, - align, - level, - animatedText, - titleBefore, - titleAfter, - animationType, - - typography, - color, - barColor, - animatedTextColor, - animatedTextBgColor, - // animatedTextTypography, - animatedTextPadding, - animatedTextSpacing, - textBorderRadius, - - animation, - interaction, - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - globalZindex, - hideTablet, - hideMobile, - globalCss + componentDidUpdate(prevProps, prevState) { + const { animationType, animatedText, level } = this.props.attributes; + const { attributes } = prevProps; + if ( + animationType !== attributes.animationType || + animatedText.length !== attributes.animatedText.length || + level !== attributes.level + ) { + if (this.anim) { + this.anim.destroy(); + delete this.anim; + setTimeout(() => { + this.anim = new window.animatedHeading({ heading: $(this.animatedHeading) }); + }, 100); + } + } + } - } - } = this.props + _handleTypeChange(val) { + const { + attributes: { animatedTextColor }, + setAttributes, + } = this.props; + this.setState({ animationClass: this._getAnimationClass(val) }); + setAttributes( + !(val === "clip" || val === "flip" || val === "fade-in" || val === "loading-bar" || val === "push") + ? { animationType: val, animatedTextColor: { ...animatedTextColor, type: "color" } } + : { animationType: val } + ); + } + _getAnimationClass(value = "") { + let animationClass = ""; + switch (value) { + case "blinds": + animationClass = "letters animation-blinds"; + break; + case "delete-typing": + animationClass = "letters type"; + break; + case "flip": + animationClass = "text-animation-flip"; + break; + case "fade-in": + animationClass = "zoom"; + break; + case "loading-bar": + animationClass = "loading-bar"; + break; + case "scale": + animationClass = "letters scale"; + break; + case "push": + animationClass = "push"; + break; + case "wave": + animationClass = "letters animation-wave"; + break; + default: + animationClass = "text-clip"; + } - const { device, animationClass } = this.state - let gradientTextColor = animationType === 'clip' || animationType === 'flip' || animationType === 'fade-in' || animationType === 'loading-bar' || animationType === 'push'; - const CustomHeadingTag = `h${level}`; + return animationClass; + } - return ( - - - - - - setAttributes({ level: newLevel })} /> - - + render() { + const { + name, + clientId, + className, + attributes, + setAttributes, + attributes: { + uniqueId, + align, + level, + animatedText, + titleBefore, + titleAfter, + animationType, - setAttributes({ titleBefore })} - /> - setAttributes({ titleAfter })} - /> - setAttributes({ animatedText: tokens })} - /> - this._handleTypeChange(val)} - /> - { - animationType === 'loading-bar' && - setAttributes({ barColor: val })} /> - } - { - gradientTextColor ? - setAttributes({ animatedTextColor: val })} - /> - : - setAttributes({ animatedTextColor: { ...animatedTextColor, color: val } })} /> - } - setAttributes({ animatedTextBgColor: val })} - /> - this.setState({ device: value })} - onChange={val => setAttributes({ textBorderRadius: val })} - /> + typography, + color, + barColor, + animatedTextColor, + animatedTextBgColor, + // animatedTextTypography, + animatedTextPadding, + animatedTextSpacing, + textBorderRadius, - setAttributes({ animatedTextPadding })} - min={0} max={100} - unit={['px', 'em', '%']} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} /> + animation, + interaction, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + }, + } = this.props; - setAttributes({ animatedTextSpacing })} - min={0} max={100} - unit={['px', 'em', '%']} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} /> + const { device, animationClass } = this.state; + let gradientTextColor = + animationType === "clip" || + animationType === "flip" || + animationType === "fade-in" || + animationType === "loading-bar" || + animationType === "push"; + const CustomHeadingTag = `h${level}`; - + return ( + + + + + + setAttributes({ level: newLevel })} + /> + + + setAttributes({ titleBefore })} + /> + setAttributes({ titleAfter })} + /> + setAttributes({ animatedText: tokens })} + /> + this._handleTypeChange(val)} + /> + {animationType === "loading-bar" && ( + setAttributes({ barColor: val })} + /> + )} + {gradientTextColor ? ( + setAttributes({ animatedTextColor: val })} + /> + ) : ( + + setAttributes({ animatedTextColor: { ...animatedTextColor, color: val } }) + } + /> + )} + setAttributes({ animatedTextBgColor: val })} + /> + this.setState({ device: value })} + onChange={(val) => setAttributes({ textBorderRadius: val })} + /> - - setAttributes({ typography: value })} - onDeviceChange={value => this.setState({ device: value })} - /> - setAttributes({ color: val })} /> - - - + setAttributes({ animatedTextPadding })} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> - {animationSettings(uniqueId, animation, setAttributes)} - {interactionSettings(uniqueId, interaction, setAttributes)} - - - + setAttributes({ animatedTextSpacing })} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + - - setAttributes({ level: newLevel })} /> - setAttributes({ align: nextAlign })} /> - + + setAttributes({ typography: value })} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ color: val })} + /> + + + + {animationSettings(uniqueId, animation, setAttributes)} + {interactionSettings(uniqueId, interaction, setAttributes)} + + + - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} + + setAttributes({ level: newLevel })} + /> + setAttributes({ align: nextAlign })} /> + -
    handleContextMenu(event, this.qubelyContextMenu.current)} - > - this.animatedHeading = el}> - {titleBefore} - - - { - [...animatedText.length > 0 ? animatedText : defaultTexts].map((item, index) => { - let isVisible = index === 0 ? 'is-visible' : 'is-hidden' - let className = `animated-text ${isVisible}` - return {item} - }) - } - - - {titleAfter} - -
    - -
    -
    + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} -
    - ); - } +
    handleContextMenu(event, this.qubelyContextMenu.current)} + > + (this.animatedHeading = el)} + > + {titleBefore} + + + {[...(animatedText.length > 0 ? animatedText : defaultTexts)].map((item, index) => { + let isVisible = index === 0 ? "is-visible" : "is-hidden"; + let className = `animated-text ${isVisible}`; + return ( + + {item} + + ); + })} + + + {titleAfter} + +
    + +
    +
    + + ); + } } export default withCSSGenerator()(Edit); diff --git a/assets/reactjs/src/blocks/animatedheadline/Save.js b/assets/reactjs/src/blocks/animatedheadline/Save.js index 45292952..550e6614 100644 --- a/assets/reactjs/src/blocks/animatedheadline/Save.js +++ b/assets/reactjs/src/blocks/animatedheadline/Save.js @@ -1,85 +1,94 @@ -const { Component } = wp.element -const { RichText } = wp.editor -const { HelperFunction: { animationAttr, IsInteraction } } = wp.qubelyComponents +const { Component } = wp.element; +const { RichText } = wp.editor; +const { + HelperFunction: { animationAttr, IsInteraction }, +} = wp.qubelyComponents; class Save extends Component { + _getAnimationClass(value = "") { + let animationClass = ""; + switch (value) { + case "blinds": + animationClass = "letters animation-blinds"; + break; + case "delete-typing": + animationClass = "letters type"; + break; + case "flip": + animationClass = "text-animation-flip"; + break; + case "fade-in": + animationClass = "zoom"; + break; + case "loading-bar": + animationClass = "loading-bar"; + break; + case "scale": + case "slide": + animationClass = "letters scale"; + break; + case "push": + animationClass = "push"; + break; + case "wave": + animationClass = "letters animation-wave"; + break; + default: + animationClass = "text-clip"; + } - _getAnimationClass(value = '') { - let animationClass = '' - switch (value) { - case 'blinds': - animationClass = 'letters animation-blinds' - break - case 'delete-typing': - animationClass = 'letters type' - break - case 'flip': - animationClass = 'text-animation-flip' - break - case 'fade-in': - animationClass = 'zoom' - break - case 'loading-bar': - animationClass = 'loading-bar' - break - case 'scale': - case 'slide': - animationClass = 'letters scale' - break - case 'push': - animationClass = 'push' - break - case 'wave': - animationClass = 'letters animation-wave' - break - default: - animationClass = 'text-clip' - } + return animationClass; + } - return animationClass - } + render() { + const { + className, + attributes: { + uniqueId, + align, + level, + animation, + animatedText, + titleBefore, + titleAfter, + animationType, + interaction, + }, + } = this.props; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + const CustomHeadingTag = `h${level}`; + return ( +
    + (this.animatedHeading = el)} + > + - render() { - const { - className, - attributes: { - uniqueId, - align, - level, - animation, - animatedText, - titleBefore, - titleAfter, - animationType, - interaction, - } - } = this.props - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - const CustomHeadingTag = `h${level}`; - return ( -
    - this.animatedHeading = el}> - - - - - { - animatedText.map((item, index) => { - let isVisible = index === 0 ? 'is-visible' : 'is-hidden' - let className = `animated-text ${isVisible}` - return {item} - }) - } - - - - -
    - ); - } + + + {animatedText.map((item, index) => { + let isVisible = index === 0 ? "is-visible" : "is-hidden"; + let className = `animated-text ${isVisible}`; + return ( + + {item} + + ); + })} + + + +
    +
    + ); + } } export default Save; diff --git a/assets/reactjs/src/blocks/animatedheadline/attributes.js b/assets/reactjs/src/blocks/animatedheadline/attributes.js index fa90bc26..32ba8214 100644 --- a/assets/reactjs/src/blocks/animatedheadline/attributes.js +++ b/assets/reactjs/src/blocks/animatedheadline/attributes.js @@ -1,193 +1,209 @@ const { - gloalSettings: { - globalAttributes - } -} = wp.qubelyComponents + gloalSettings: { globalAttributes }, +} = wp.qubelyComponents; export const attributes = { - uniqueId: { type: 'string', default: '' }, - ...globalAttributes, // Global Settings - level: { - type: 'number', - default: 4 - }, - align: { - type: 'string', - style: [] - }, - spacer: { - type: 'object', - default: { - spaceTop: { md: '10', unit: 'px' }, - spaceBottom: { md: '10', unit: 'px' } - }, - style: [{ selector: '{{QUBELY}}' }] - }, - animatedText: { type: 'array', default: ['imagination', 'fascination', 'attention', 'passion', 'curiosity'] }, - animationType: { - type: 'string', - default: 'clip' - }, - typography: { - type: 'object', - default: { - openTypography: false, - height: { - md: '1.2', - unit: 'em' - }, - size: { - md: '28', - unit: 'px' - } - }, - style: [{ selector: '{{QUBELY}}.qubely-block-animated-heading .animated-heading-text' }] - }, - textBorderRadius: { - type: 'object', - default: { - openBorderRadius: 0, - radiusType: 'global', - global: {}, - unit: 'px', - }, - style: [ - { - selector: '{{QUBELY}}.qubely-block-animated-heading .qubely-animated-text' - } - ] - }, - // animatedTextTypography: { - // type: 'object', - // default: {}, - // style: [{ selector: '{{QUBELY}}.qubely-block-animated-heading .animated-text-words-wrapper' }] - // }, + uniqueId: { type: "string", default: "" }, + ...globalAttributes, // Global Settings + level: { + type: "number", + default: 4, + }, + align: { + type: "string", + style: [], + }, + spacer: { + type: "object", + default: { + spaceTop: { md: "10", unit: "px" }, + spaceBottom: { md: "10", unit: "px" }, + }, + style: [{ selector: "{{QUBELY}}" }], + }, + animatedText: { type: "array", default: ["imagination", "fascination", "attention", "passion", "curiosity"] }, + animationType: { + type: "string", + default: "clip", + }, + typography: { + type: "object", + default: { + openTypography: false, + height: { + md: "1.2", + unit: "em", + }, + size: { + md: "28", + unit: "px", + }, + }, + style: [{ selector: "{{QUBELY}}.qubely-block-animated-heading .animated-heading-text" }], + }, + textBorderRadius: { + type: "object", + default: { + openBorderRadius: 0, + radiusType: "global", + global: {}, + unit: "px", + }, + style: [ + { + selector: "{{QUBELY}}.qubely-block-animated-heading .qubely-animated-text", + }, + ], + }, + // animatedTextTypography: { + // type: 'object', + // default: {}, + // style: [{ selector: '{{QUBELY}}.qubely-block-animated-heading .animated-text-words-wrapper' }] + // }, - titleBefore: { - type: 'string', - default: 'The power of' - }, - titleAfter: { - type: 'string', - default: 'makes us infinite' - }, - color: { - type: 'string', default: '#000', - style: [ - { - selector: '{{QUBELY}}.qubely-block-animated-heading .animated-heading-text{ color:{{color}}; }' - } - ] - }, - barColor: { - type: 'string', default: '#22b8f0', - style: [ - { + titleBefore: { + type: "string", + default: "The power of", + }, + titleAfter: { + type: "string", + default: "makes us infinite", + }, + color: { + type: "string", + default: "#000", + style: [ + { + selector: "{{QUBELY}}.qubely-block-animated-heading .animated-heading-text{ color:{{color}}; }", + }, + ], + }, + barColor: { + type: "string", + default: "#22b8f0", + style: [ + { + selector: + "{{QUBELY}}.qubely-block-animated-heading .animated-heading-text.loading-bar .animated-text-words-wrapper::after { background:{{barColor}}; }", + }, + ], + }, + animatedTextColor: { + type: "object", + default: { + type: "gradient", + textColor: true, + openColor: 1, + color: "var(--qubely-color-1)", + gradient: { + color1: "#1066CC", + color2: "#55cd37", + direction: 0, + start: 0, + stop: 100, + clip: false, + type: "linear", + radial: "center", + }, + }, + style: [ + { + selector: "{{QUBELY}}.qubely-block-animated-heading .animated-text-words-wrapper span", + }, + ], + }, + animatedTextBgColor: { + type: "object", + default: { + type: "color", + openColor: 0, + color: "#eae212", + gradient: { + color1: "#1066CC", + color2: "#55cd37", + direction: 0, + start: 0, + stop: 100, + type: "linear", + radial: "center", + }, + }, + style: [{ selector: "{{QUBELY}}.qubely-block-animated-heading .qubely-animated-text" }], + }, - selector: '{{QUBELY}}.qubely-block-animated-heading .animated-heading-text.loading-bar .animated-text-words-wrapper::after { background:{{barColor}}; }' - } - ] - }, - animatedTextColor: { - type: 'object', - default: { - type: 'gradient', - textColor: true, - openColor: 1, - color: 'var(--qubely-color-1)', - gradient: { - color1: '#1066CC', - color2: '#55cd37', - direction: 0, - start: 0, - stop: 100, - clip: false, - type: 'linear', - radial: 'center' - } - }, - style: [ - { + // animatedTextPadding: { + // type: 'object', + // default: { + // openPadding: 0, + // paddingType: 'custom', + // global: { md: '5' }, + // custom: { }, + // unit: 'px' + // }, + // style: [{ selector: '{{QUBELY}}.qubely-block-animated-heading .qubely-animated-text' }] + // }, - selector: '{{QUBELY}}.qubely-block-animated-heading .animated-text-words-wrapper span' - } - ] - }, - animatedTextBgColor: { - type: 'object', - default: { - type: 'color', - openColor: 0, - color: '#eae212', - gradient: { - color1: '#1066CC', - color2: '#55cd37', - direction: 0, - start: 0, - stop: 100, - type: 'linear', - radial: 'center' - } - }, - style: [{ selector: '{{QUBELY}}.qubely-block-animated-heading .qubely-animated-text' }] - }, + animatedTextPadding: { + type: "object", + default: { + md: 0, + unit: "px", + }, + style: [ + { + selector: + "{{QUBELY}}.qubely-block-animated-heading .qubely-animated-text {padding: 0 {{animatedTextPadding}};}", + }, + ], + }, - // animatedTextPadding: { - // type: 'object', - // default: { - // openPadding: 0, - // paddingType: 'custom', - // global: { md: '5' }, - // custom: { }, - // unit: 'px' - // }, - // style: [{ selector: '{{QUBELY}}.qubely-block-animated-heading .qubely-animated-text' }] - // }, + animatedTextSpacing: { + type: "object", + default: { + md: 0, + unit: "px", + }, + style: [ + { + selector: + "{{QUBELY}}.qubely-block-animated-heading .qubely-animated-text {margin: 0 {{animatedTextSpacing}};}", + }, + ], + }, - animatedTextPadding: { - type: 'object', - default: { - md: 0, - unit: 'px' - }, - style: [{ - selector: '{{QUBELY}}.qubely-block-animated-heading .qubely-animated-text {padding: 0 {{animatedTextPadding}};}' - }] - }, + animatedTextBorderRadius: { + type: "object", + default: { + radiusType: "global", + global: {}, + unit: "px", + }, + style: [{ selector: "{{QUBELY}}.qubely-block-animated-heading .animated-text-words-wrapper" }], + }, + border: { type: "object", default: {}, style: [{ selector: "{{QUBELY}}.qubely-block-animated-heading" }] }, + bgBorderColorHover: { + type: "string", + default: "", + style: [{ selector: "{{QUBELY}}.qubely-block-animated-heading:hover {border-color: {{bgBorderColorHover}};}" }], + }, - animatedTextSpacing: { - type: 'object', - default: { - md: 0, - unit: 'px' - }, - style: [{ - selector: '{{QUBELY}}.qubely-block-animated-heading .qubely-animated-text {margin: 0 {{animatedTextSpacing}};}' - }] - }, + bgShadow: { + type: "object", + default: { openShadow: 0, horizontal: 1, vertical: 1, blur: 2, color: "rgba(0, 0, 0, .2)", spread: 0 }, + style: [{ selector: "{{QUBELY}}.qubely-block-animated-heading" }], + }, + bgShadowHover: { + type: "object", + default: { color: "" }, + style: [{ selector: "{{QUBELY}}.qubely-block-animated-heading:hover" }], + }, - - animatedTextBorderRadius: { - type: 'object', - default: { - radiusType: 'global', - global: {}, - unit: 'px' - }, - style: [{ selector: '{{QUBELY}}.qubely-block-animated-heading .animated-text-words-wrapper' }] - }, - border: { type: 'object', default: {}, style: [{ selector: '{{QUBELY}}.qubely-block-animated-heading' }] }, - bgBorderColorHover: { type: 'string', default: '', style: [{ selector: '{{QUBELY}}.qubely-block-animated-heading:hover {border-color: {{bgBorderColorHover}};}' }] }, - - bgShadow: { type: 'object', default: { openShadow: 0, horizontal: 1, vertical: 1, blur: 2, color: 'rgba(0, 0, 0, .2)', spread: 0 }, style: [{ selector: '{{QUBELY}}.qubely-block-animated-heading' }] }, - bgShadowHover: { type: 'object', default: { color: '' }, style: [{ selector: '{{QUBELY}}.qubely-block-animated-heading:hover' }] }, - - showGlobalSettings: { - type: 'boolean', - default: true - }, - showContextMenu: { - type: 'boolean', - default: true - } -}; \ No newline at end of file + showGlobalSettings: { + type: "boolean", + default: true, + }, + showContextMenu: { + type: "boolean", + default: true, + }, +}; diff --git a/assets/reactjs/src/blocks/animatedheadline/index.js b/assets/reactjs/src/blocks/animatedheadline/index.js index 5dc7bb15..e8c3f888 100644 --- a/assets/reactjs/src/blocks/animatedheadline/index.js +++ b/assets/reactjs/src/blocks/animatedheadline/index.js @@ -1,21 +1,23 @@ -import './style.scss' -import Edit from './Edit' -import Save from './Save' -import { attributes } from './attributes'; +import "./style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +import { attributes } from "./attributes"; -const { registerBlockType } = wp.blocks -const { __ } = wp.i18n +const { registerBlockType } = wp.blocks; +const { __ } = wp.i18n; -registerBlockType('qubely/animatedheadline', { - title: __('Animated Headline'), - description: 'Grab the attention of your users with animating texts in headlines', - category: 'qubely', - icon: {__('Animated, - keywords: [__('headline'), __('animated'), __('heading'), __('title')], - example: { - attributes: {}, - }, - attributes, - edit: Edit, - save: Save -}) +registerBlockType("qubely/animatedheadline", { + title: __("Animated Headline"), + description: "Grab the attention of your users with animating texts in headlines", + category: "qubely", + icon: ( + {__("Animated + ), + keywords: [__("headline"), __("animated"), __("heading"), __("title")], + example: { + attributes: {}, + }, + attributes, + edit: Edit, + save: Save, +}); diff --git a/assets/reactjs/src/blocks/animatedheadline/style.scss b/assets/reactjs/src/blocks/animatedheadline/style.scss index 8b3f54d6..c99b8807 100644 --- a/assets/reactjs/src/blocks/animatedheadline/style.scss +++ b/assets/reactjs/src/blocks/animatedheadline/style.scss @@ -1,27 +1,26 @@ .qubely-block-animated-heading { - .animated-heading-text { - &.has-text-align-left{ - justify-content: flex-start; - } - &.has-text-align-right{ - justify-content: flex-end - } - &.has-text-align-center{ - justify-content: center; - } - &::before { - display: none; - } - .qubely-animated-text{ - padding-left: 5px; - padding-right: 5px; - line-height: inherit; - } - } - &.qubely-block-animated-heading-backend .animated-heading-text{ - display: flex; - flex-wrap: wrap; - align-items: center; - } + .animated-heading-text { + &.has-text-align-left { + justify-content: flex-start; + } + &.has-text-align-right { + justify-content: flex-end; + } + &.has-text-align-center { + justify-content: center; + } + &::before { + display: none; + } + .qubely-animated-text { + padding-left: 5px; + padding-right: 5px; + line-height: inherit; + } + } + &.qubely-block-animated-heading-backend .animated-heading-text { + display: flex; + flex-wrap: wrap; + align-items: center; + } } - diff --git a/assets/reactjs/src/blocks/button/Edit.js b/assets/reactjs/src/blocks/button/Edit.js index 4a98a0e2..b77ab984 100644 --- a/assets/reactjs/src/blocks/button/Edit.js +++ b/assets/reactjs/src/blocks/button/Edit.js @@ -1,380 +1,428 @@ -import icons from '../../helpers/icons'; -import classnames from 'classnames'; +import icons from "../../helpers/icons"; +import classnames from "classnames"; const { __ } = wp.i18n; -const { - Fragment, - Component, - createRef -} = wp.element; +const { Fragment, Component, createRef } = wp.element; -const { compose } = wp.compose; +// const { compose } = wp.compose; -const { - withSelect, - withDispatch -} = wp.data; +// const { +// withSelect, +// withDispatch +// } = wp.data; -const { - PanelBody, - Toolbar, - Tooltip -} = wp.components; +const { PanelBody, Toolbar } = wp.components; -const { - RichText, - BlockControls, - InspectorControls -} = wp.blockEditor; +const { RichText, BlockControls, InspectorControls } = wp.blockEditor; const { - Url, - Tab, - Tabs, - Color, - Range, - Border, - Select, - Styles, - Padding, - IconList, - Separator, - Alignment, - BoxShadow, - Typography, - BorderRadius, - InspectorTab, - InspectorTabs, - RadioAdvanced, - ColorAdvanced, - withCSSGenerator, - InspectorSections, - Inline: { - InlineToolbar - }, - gloalSettings: { - animationSettings, - interactionSettings, - globalSettingsPanel, - }, - ContextMenu: { - ContextMenu, - handleContextMenu - } + Url, + Tab, + Tabs, + Color, + Range, + Border, + Select, + Styles, + Padding, + IconList, + Separator, + Alignment, + BoxShadow, + Typography, + BorderRadius, + InspectorTab, + InspectorTabs, + RadioAdvanced, + ColorAdvanced, + withCSSGenerator, + InspectorSections, + Inline: { InlineToolbar }, + gloalSettings: { animationSettings, interactionSettings, globalSettingsPanel }, + ContextMenu: { ContextMenu, handleContextMenu }, } = wp.qubelyComponents; - class Edit extends Component { - constructor() { - super(...arguments); - this.state = { - device: 'md', - spacer: true - }; - this.qubelyContextMenu = createRef(); - } - - componentDidMount() { - const { - clientId, - setAttributes, - attributes: { - uniqueId - } - } = this.props; - - const _client = clientId.substr(0, 6); - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - } - - render() { - - const { - name, - clientId, - attributes, - removeBlock, - setAttributes, - updateBlockAttributes, - buttonGroupAttributes, - attributes: { - url, - iconName, - recreateStyles, - fillType, - uniqueId, - textField, - alignment, - className, - buttonSize, - typography, - buttonWidth, - buttonGroup, - iconPosition, - buttonPadding, - parentClientId, - buttonWidthType, - enableAlignment, - disableFullWidth, - buttonBorderRadius, - iconGap, - bgColor, - iconSize, - animation, - interaction, - buttonColor, - bgHoverColor, - buttonBorder, - buttonShadow, - buttonColor2, - borderHoverColor, - buttonHoverColor, - buttonHoverColor2, - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - globalZindex, - hideTablet, - hideMobile, - globalCss, - buttonHoverShadow, - } - } = this.props; - - const { device, currentTab } = this.state; - - const classNames = classnames( - { [`qubely-block-${uniqueId}`]: uniqueId }, - className - ); - - return ( - + constructor() { + super(...arguments); + this.state = { + device: "md", + spacer: true, + }; + this.qubelyContextMenu = createRef(); + } - - - - - + render() { + const { + name, + clientId, + attributes, + // removeBlock, + setAttributes, + // updateBlockAttributes, + // buttonGroupAttributes, + attributes: { + url, + iconName, + recreateStyles, + fillType, + uniqueId, + textField, + alignment, + className, + buttonSize, + typography, + buttonWidth, + // buttonGroup, + iconPosition, + buttonPadding, + // parentClientId, + buttonWidthType, + enableAlignment, + disableFullWidth, + buttonBorderRadius, + iconGap, + bgColor, + iconSize, + animation, + interaction, + buttonColor, + bgHoverColor, + buttonBorder, + buttonShadow, + buttonColor2, + borderHoverColor, + buttonHoverColor, + buttonHoverColor2, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + buttonHoverShadow, + }, + } = this.props; - - - - - - - - setAttributes({ fillType: value })} - options={[ - { value: 'fill', svg: icons.btn_fill, label: __('Fill') }, - { value: 'outline', svg: icons.btn_outline, label: __('Outline') } - ]} - /> - - setAttributes({ url: value })} /> - { - enableAlignment && - setAttributes({ alignment: val })} - onDeviceChange={value => this.setState({ device: value })} - /> - } - + const { device } = this.state; - - setAttributes({ buttonSize: value })} /> - {buttonSize == 'custom' && - setAttributes({ buttonPadding: value })} - unit={['px', 'em', '%']} - max={150} - min={0} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} /> - } - setAttributes({ buttonWidthType: value, recreateStyles: !recreateStyles })} /> - {buttonWidthType == 'fixed' && - setAttributes({ buttonWidth: value })} - unit={['px', 'em', '%']} - min={buttonWidth.unit === '%' ? 5 : 30} - max={buttonWidth.unit === '%' ? 100 : 800} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} /> - } - - - - - fillType == 'fill' ? setAttributes({ buttonColor: value }) : setAttributes({ buttonColor2: value })} /> - {fillType == 'fill' && - setAttributes({ bgColor: value })} /> - } - setAttributes({ buttonBorder: val })} min={0} max={10} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ buttonShadow: value })} /> - - - fillType == 'fill' ? setAttributes({ buttonHoverColor: value }) : setAttributes({ buttonHoverColor2: value })} /> - setAttributes({ bgHoverColor: value })} /> - setAttributes({ borderHoverColor: value })} /> - setAttributes({ buttonHoverShadow: value })} /> - - - setAttributes({ buttonBorderRadius: value })} - min={0} - max={100} - unit={['px', 'em', '%']} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} /> - + const classNames = classnames({ [`qubely-block-${uniqueId}`]: uniqueId }, className); - - this.props.setAttributes({ iconName: value })} /> - {iconName && - - setAttributes({ iconPosition: value })} + /> + setAttributes({ iconSize: value })} + unit={["px", "em", "%"]} + min={5} + max={48} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ iconGap: val })} + unit={["px", "em", "%"]} + min={0} + max={64} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + )} + + + setAttributes({ typography: value })} + disableLineHeight + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + + {animationSettings(uniqueId, animation, setAttributes)} + {interactionSettings(uniqueId, interaction, setAttributes)} + + + -
    - -
    + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} - - +
    +
    handleContextMenu(event, this.qubelyContextMenu.current)} + > +
    +
    + {iconName.trim() != "" && iconPosition == "left" && ( + + )} + setAttributes({ textField: value })} + /> + {iconName.trim() != "" && iconPosition == "right" && ( + + )} +
    +
    - - ) - } +
    + +
    +
    +
    +
    + ); + } } -export default compose([ - withSelect((select, ownProps) => { - const { parentClientId } = ownProps.attributes - const { getBlockAttributes } = select('core/block-editor'); - return { buttonGroupAttributes: getBlockAttributes(parentClientId) } - }), - withDispatch((dispatch) => { - const { removeBlock, updateBlockAttributes } = dispatch('core/block-editor'); - return { - removeBlock, - updateBlockAttributes - } - }), - withCSSGenerator() -])(Edit) +// export default compose([ +// // withSelect((select, ownProps) => { +// // const { parentClientId } = ownProps.attributes +// // const { getBlockAttributes } = select('core/block-editor'); +// // return { buttonGroupAttributes: getBlockAttributes(parentClientId) } +// // }), +// // withDispatch((dispatch) => { +// // const { removeBlock, updateBlockAttributes } = dispatch('core/block-editor'); +// // return { +// // removeBlock, +// // updateBlockAttributes +// // } +// // }), +// withCSSGenerator(), +// ])(Edit); +export default withCSSGenerator()(Edit); diff --git a/assets/reactjs/src/blocks/button/Save.js b/assets/reactjs/src/blocks/button/Save.js index e5542010..2ab72dd9 100644 --- a/assets/reactjs/src/blocks/button/Save.js +++ b/assets/reactjs/src/blocks/button/Save.js @@ -1,29 +1,49 @@ -import classnames from 'classnames'; +import classnames from "classnames"; const { Component } = wp.element; -const { RichText } = wp.blockEditor -const { HelperFunction: { animationAttr, IsInteraction } } = wp.qubelyComponents +const { RichText } = wp.blockEditor; +const { + HelperFunction: { animationAttr, IsInteraction }, +} = wp.qubelyComponents; class Save extends Component { render() { - const { uniqueId, textField, url, iconName, iconPosition, buttonSize, customClassName, animation, interaction } = this.props.attributes - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - const classNames = classnames( - { [`qubely-block-${uniqueId}`]: uniqueId }, - customClassName - ); + const { + uniqueId, + textField, + url, + iconName, + iconPosition, + buttonSize, + customClassName, + animation, + interaction, + } = this.props.attributes; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + const classNames = classnames({ [`qubely-block-${uniqueId}`]: uniqueId }, customClassName); return ( - ) + ); } } -export default Save \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/button/attributes.js b/assets/reactjs/src/blocks/button/attributes.js index e9d346c0..1fb2e679 100644 --- a/assets/reactjs/src/blocks/button/attributes.js +++ b/assets/reactjs/src/blocks/button/attributes.js @@ -1,283 +1,286 @@ -const { gloalSettings: { globalAttributes } } = wp.qubelyComponents +const { + gloalSettings: { globalAttributes }, +} = wp.qubelyComponents; const attributes = { - uniqueId: { - type: 'string', - default: '' - }, - // Global - ...globalAttributes, - buttonGroup: { - type: 'boolean', - default: false - }, - recreateStyles: { - type: 'boolean', - default: true - }, - disableFullWidth: { - type: 'boolean', - default: false, - style: [ - { - condition: [ - { key: 'disableFullWidth', relation: '==', value: true } - ], - selector: '{{QUBELY}} {width:fit-content;}' - } - ] - }, - parentClientId: { type: 'string', default: '' }, - spacer: { - type: 'object', - default: { - spaceTop: { - md: '10', - unit: 'px' - }, - spaceBottom: { - md: '10', - unit: 'px' - } - }, - style: [{ selector: '{{QUBELY}}' }] - }, - enableAlignment: { type: 'boolean', default: true }, - customClassName: { type: 'string', default: '' }, - spacer: { type: 'object', default: { spaceTop: { md: '10', unit: 'px' }, spaceBottom: { md: '10', unit: 'px' } }, style: [{ selector: '{{QUBELY}}' }] }, - textField: { type: 'string', default: '' }, - buttonWidthType: { - type: 'string', - default: 'auto', - style: [ - { - condition: [ - { key: 'buttonWidthType', relation: '==', value: 'block' } - ], - selector: '{{QUBELY}} .qubely-block-btn-anchor {display: -webkit-box; display: -ms-flexbox; display: flex;}' - } - ] - }, - buttonWidth: { - type: 'object', - default: { - md: 260, - unit: 'px' - }, - style: [ - { - condition: [ - { key: 'buttonWidthType', relation: '==', value: 'fixed' }, - { key: 'disableFullWidth', relation: '==', value: false }, - ], - selector: '{{QUBELY}} .qubely-block-btn-anchor {width: {{buttonWidth}};}' - }, - { - condition: [ - { key: 'buttonWidthType', relation: '==', value: 'fixed' }, - { key: 'disableFullWidth', relation: '==', value: true }, - ], - selector: '{{QUBELY}}, {{QUBELY}} .qubely-block-btn-anchor {width: {{buttonWidth}};}' - }, - ] - }, - alignment: { - type: 'object', default: { md: 'center' }, - style: [ - { - condition: [ - { key: 'enableAlignment', relation: '==', value: true } - ], - selector: '{{QUBELY}} .qubely-block-btn-wrapper {text-align: {{alignment}};}' - } - ] - }, - fillType: { type: 'string', default: 'fill' }, - url: { type: 'object', default: { url: '#' } }, - buttonSize: { type: 'string', default: 'large' }, - buttonPadding: { - type: 'object', - default: { - openPadding: 1, - paddingType: 'global', - global: { md: 18 }, - unit: 'px' - }, - style: [ - { - condition: [ - { key: 'buttonSize', relation: '==', value: 'custom' } - ], - selector: '{{QUBELY}} .qubely-block-btn-anchor' - } - ] - }, - typography: { - type: 'object', - default: {}, - style: [{ selector: '{{QUBELY}} .qubely-block-btn-wrapper .qubely-block-btn .qubely-block-btn-anchor ' }] }, - buttonColor: { - type: 'string', default: '#fff', - style: [ - { - condition: [ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-block-btn-anchor { color:{{buttonColor}}; }' - }, - ] - }, - buttonColor2: { - type: 'string', default: 'var(--qubely-color-1)', - style: [ - { - condition: [ - { key: 'fillType', relation: '!=', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-block-btn-anchor { color:{{buttonColor2}}; }' - } - ] - }, - buttonHoverColor: { - type: 'string', default: '#fff', - style: [ - { - condition: [ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-block-btn-anchor:hover { color:{{buttonHoverColor}}; }' - } - ] - }, - buttonHoverColor2: { - type: 'string', default: '#fff', - style: [ - { - condition: [{ key: 'fillType', relation: '!=', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-block-btn-anchor:hover { color:{{buttonHoverColor2}}; }' - } - ] - }, - bgColor: { - type: 'object', - default: { - type: 'color', - openColor: 1, - color: 'var(--qubely-color-1)', - gradient: { - color1: 'var(--qubely-color-2)', - color2: 'var(--qubely-color-1)', - direction: 0, - start: 0, - stop: 100, - type: 'linear' - } - }, - style: [ - { - condition: [ - { key: 'fillType', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-block-btn-anchor' - } - ] - }, - bgHoverColor: { - type: 'object', - default: { - type: 'color', - openColor: 1, - color: 'var(--qubely-color-2)', - gradient: { - color1: '#16d03e', - color2: '#1f91f3', - direction: 0, - start: 0, - stop: 100, - type: 'linear', - } - }, - style: [ - { selector: '{{QUBELY}} .qubely-block-btn-anchor:before' } - ] - }, - buttonBorder: { - type: 'object', default: { openBorder: 1, widthType: 'global', global: { md: '1' }, type: 'solid', color: 'var(--qubely-color-1)' }, - style: [ - { - selector: '{{QUBELY}} .qubely-block-btn-anchor' - } - ] - }, - borderHoverColor: { - type: 'string', default: 'var(--qubely-color-2)', - style: [ - { - selector: '{{QUBELY}} .qubely-block-btn-anchor:hover {border-color: {{borderHoverColor}};}' - } - ] - }, - buttonBorderRadius: { - type: 'object', - default: { - openBorderRadius: 1, - radiusType: 'global', - global: { md: 4 }, - unit: 'px', + uniqueId: { + type: "string", + default: "", + }, + // Global + ...globalAttributes, + buttonGroup: { + type: "boolean", + default: false, + }, + recreateStyles: { + type: "boolean", + default: true, + }, + disableFullWidth: { + type: "boolean", + default: false, + style: [ + { + condition: [{ key: "disableFullWidth", relation: "==", value: true }], + selector: "{{QUBELY}} {width:fit-content;}", + }, + ], + }, + parentClientId: { type: "string", default: "" }, + spacer: { + type: "object", + default: { + spaceTop: { + md: "10", + unit: "px", + }, + spaceBottom: { + md: "10", + unit: "px", + }, + }, + style: [{ selector: "{{QUBELY}}" }], + }, + enableAlignment: { type: "boolean", default: true }, + customClassName: { type: "string", default: "" }, + spacer: { + type: "object", + default: { spaceTop: { md: "10", unit: "px" }, spaceBottom: { md: "10", unit: "px" } }, + style: [{ selector: "{{QUBELY}}" }], + }, + textField: { type: "string", default: "" }, + buttonWidthType: { + type: "string", + default: "auto", + style: [ + { + condition: [{ key: "buttonWidthType", relation: "==", value: "block" }], + selector: + "{{QUBELY}} .qubely-block-btn-anchor {display: -webkit-box; display: -ms-flexbox; display: flex;}", + }, + ], + }, + buttonWidth: { + type: "object", + default: { + md: 260, + unit: "px", + }, + style: [ + { + condition: [ + { key: "buttonWidthType", relation: "==", value: "fixed" }, + { key: "disableFullWidth", relation: "==", value: false }, + ], + selector: "{{QUBELY}} .qubely-block-btn-anchor {width: {{buttonWidth}};}", + }, + { + condition: [ + { key: "buttonWidthType", relation: "==", value: "fixed" }, + { key: "disableFullWidth", relation: "==", value: true }, + ], + selector: "{{QUBELY}}, {{QUBELY}} .qubely-block-btn-anchor {width: {{buttonWidth}};}", + }, + ], + }, + alignment: { + type: "object", + default: { md: "center" }, + style: [ + { + condition: [{ key: "enableAlignment", relation: "==", value: true }], + selector: "{{QUBELY}} .qubely-block-btn-wrapper {text-align: {{alignment}};}", + }, + ], + }, + fillType: { type: "string", default: "fill" }, + url: { type: "object", default: { url: "#" } }, + buttonSize: { type: "string", default: "large" }, + buttonPadding: { + type: "object", + default: { + openPadding: 1, + paddingType: "global", + global: { md: 18 }, + unit: "px", + }, + style: [ + { + condition: [{ key: "buttonSize", relation: "==", value: "custom" }], + selector: "{{QUBELY}} .qubely-block-btn-anchor", + }, + ], + }, + typography: { + type: "object", + default: {}, + style: [{ selector: "{{QUBELY}} .qubely-block-btn-wrapper .qubely-block-btn .qubely-block-btn-anchor " }], + }, + buttonColor: { + type: "string", + default: "#fff", + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-block-btn-anchor { color:{{buttonColor}}; }", + }, + ], + }, + buttonColor2: { + type: "string", + default: "var(--qubely-color-1)", + style: [ + { + condition: [{ key: "fillType", relation: "!=", value: "fill" }], + selector: "{{QUBELY}} .qubely-block-btn-anchor { color:{{buttonColor2}}; }", + }, + ], + }, + buttonHoverColor: { + type: "string", + default: "#fff", + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-block-btn-anchor:hover { color:{{buttonHoverColor}}; }", + }, + ], + }, + buttonHoverColor2: { + type: "string", + default: "#fff", + style: [ + { + condition: [{ key: "fillType", relation: "!=", value: "fill" }], + selector: "{{QUBELY}} .qubely-block-btn-anchor:hover { color:{{buttonHoverColor2}}; }", + }, + ], + }, + bgColor: { + type: "object", + default: { + type: "color", + openColor: 1, + color: "var(--qubely-color-1)", + gradient: { + color1: "var(--qubely-color-2)", + color2: "var(--qubely-color-1)", + direction: 0, + start: 0, + stop: 100, + type: "linear", + }, + }, + style: [ + { + condition: [{ key: "fillType", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-block-btn-anchor", + }, + ], + }, + bgHoverColor: { + type: "object", + default: { + type: "color", + openColor: 1, + color: "var(--qubely-color-2)", + gradient: { + color1: "#16d03e", + color2: "#1f91f3", + direction: 0, + start: 0, + stop: 100, + type: "linear", + }, + }, + style: [{ selector: "{{QUBELY}} .qubely-block-btn-anchor:before" }], + }, + buttonBorder: { + type: "object", + default: { + openBorder: 1, + widthType: "global", + global: { md: "1" }, + type: "solid", + color: "var(--qubely-color-1)", + }, + style: [ + { + selector: "{{QUBELY}} .qubely-block-btn-anchor", + }, + ], + }, + borderHoverColor: { + type: "string", + default: "var(--qubely-color-2)", + style: [ + { + selector: "{{QUBELY}} .qubely-block-btn-anchor:hover {border-color: {{borderHoverColor}};}", + }, + ], + }, + buttonBorderRadius: { + type: "object", + default: { + openBorderRadius: 1, + radiusType: "global", + global: { md: 4 }, + unit: "px", + }, + style: [{ selector: "{{QUBELY}} .qubely-block-btn-anchor" }], + }, + buttonShadow: { + type: "object", + default: {}, + style: [ + { + selector: "{{QUBELY}} .qubely-block-btn-anchor", + }, + ], + }, + buttonHoverShadow: { + type: "object", + default: {}, + style: [ + { + selector: "{{QUBELY}} .qubely-block-btn-anchor:hover", + }, + ], + }, + iconName: { type: "string", default: "" }, + iconPosition: { type: "string", default: "right" }, + iconSize: { + type: "object", + default: {}, + style: [ + { + condition: [{ key: "iconName", relation: "!=", value: "" }], + selector: "{{QUBELY}} .qubely-btn-icon {font-size: {{iconSize}}}", + }, + ], + }, + iconGap: { + type: "object", + default: { md: 8, unit: "px" }, + style: [ + { + condition: [ + { key: "iconName", relation: "!=", value: "" }, + { key: "iconPosition", relation: "==", value: "left" }, + ], + selector: "{{QUBELY}} .qubely-btn-icon { margin-right: {{iconGap}}; }", + }, + { + condition: [ + { key: "iconName", relation: "!=", value: "" }, + { key: "iconPosition", relation: "==", value: "right" }, + ], + selector: "{{QUBELY}} .qubely-btn-icon { margin-left: {{iconGap}}; }", + }, + ], + }, + sourceOfCopiedStyle: { type: "boolean", default: false }, +}; - }, - style: [{ selector: '{{QUBELY}} .qubely-block-btn-anchor' }] - }, - buttonShadow: { - type: 'object', default: {}, - style: [ - { - selector: '{{QUBELY}} .qubely-block-btn-anchor' - } - ] - }, - buttonHoverShadow: { - type: 'object', default: {}, - style: [ - { - selector: '{{QUBELY}} .qubely-block-btn-anchor:hover' - } - ] - }, - iconName: { type: 'string', default: '' }, - iconPosition: { type: 'string', default: 'right' }, - iconSize: { - type: 'object', default: {}, - style: [ - { - condition: [ - { key: 'iconName', relation: '!=', value: '' } - ], - selector: '{{QUBELY}} .qubely-btn-icon {font-size: {{iconSize}}}' - } - ] - }, - iconGap: { - type: 'object', default: { md: 8, unit: 'px' }, - style: [ - { - condition: [ - { key: 'iconName', relation: '!=', value: '' }, - { key: 'iconPosition', relation: '==', value: 'left' }, - ], - selector: '{{QUBELY}} .qubely-btn-icon { margin-right: {{iconGap}}; }' - }, - { - condition: [ - { key: 'iconName', relation: '!=', value: '' }, - { key: 'iconPosition', relation: '==', value: 'right' }, - ], - selector: '{{QUBELY}} .qubely-btn-icon { margin-left: {{iconGap}}; }' - }, - ] - }, - sourceOfCopiedStyle: { type: 'boolean', default: false } -} - -export default attributes; \ No newline at end of file +export default attributes; diff --git a/assets/reactjs/src/blocks/button/index.js b/assets/reactjs/src/blocks/button/index.js index 1e7f2632..8e865a85 100644 --- a/assets/reactjs/src/blocks/button/index.js +++ b/assets/reactjs/src/blocks/button/index.js @@ -1,37 +1,31 @@ -import './style.scss'; -import Edit from './Edit'; -import Save from './Save'; -import attributes from './attributes'; +import "./style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +import attributes from "./attributes"; const { __ } = wp.i18n; const { registerBlockType } = wp.blocks; - -registerBlockType('qubely/button', { - title: __('Button'), - description: __('Create stylish call-to-action buttons with Qubely Buttons.'), - category: 'qubely', - icon: {__('Button, - supports: { - align: [ - 'full', - 'wide', - 'center' - ], - }, - keywords: [ - __('link'), - __('button') - ], - example: { - attributes: {}, - }, - attributes, - getEditWrapperProps(attributes) { - if (attributes.customClassName != '') { - return { className: `wp-block block-editor-block-list__block ${attributes.customClassName}` } - } - }, - edit: Edit, - save: Save, -}); \ No newline at end of file +registerBlockType("qubely/button", { + title: __("Button"), + description: __("Create stylish call-to-action buttons with Qubely Buttons."), + category: "qubely", + icon: {__("Button, + supports: { + align: ["full", "wide", "center"], + }, + keywords: [__("link"), __("button")], + example: { + attributes: {}, + }, + attributes, + // getEditWrapperProps(attributes) { + // if (attributes.customClassName != "") { + // return { + // className: `wp-block block-editor-block-list__block ${attributes.customClassName}`, + // }; + // } + // }, + edit: Edit, + save: Save, +}); diff --git a/assets/reactjs/src/blocks/button/style.scss b/assets/reactjs/src/blocks/button/style.scss index d65d1a54..7ae901ec 100644 --- a/assets/reactjs/src/blocks/button/style.scss +++ b/assets/reactjs/src/blocks/button/style.scss @@ -1,77 +1,77 @@ .qubely-block-btn-anchor { - display: inline-flex; - display: -webkit-inline-flex; - display: -ms-inline-flexbox; - display: inline-flex; - align-items: center; - justify-content: center; - font-size: 16px; - font-weight: 400; - line-height: 1.3; - color: #212529; - text-align: center; - // -webkit-user-select: none; - // -moz-user-select: none; - // -ms-user-select: none; - // user-select: none; - text-decoration: none !important; - background-color: transparent; - position: relative; - z-index: 1; - overflow: hidden; - transition: color 200ms ease-in-out, background-color 200ms ease-in-out, border-color 200ms ease-in-out, - box-shadow 200ms ease-in-out; - &.is-small { - padding: 5px 10px; - font-size: 14px; - } - &.is-medium { - padding: 8px 15px; - font-size: 16px; - } - &.is-large { - padding: 13px 20px; - font-size: 18px; - } - .editor-rich-text { - cursor: text; - .editor-rich-text__tinymce { - line-height: 1.3 !important; - } - } + display: inline-flex; + display: -webkit-inline-flex; + display: -ms-inline-flexbox; + display: inline-flex; + align-items: center; + justify-content: center; + font-size: 16px; + font-weight: 400; + line-height: 1.3; + color: #212529; + text-align: center; + // -webkit-user-select: none; + // -moz-user-select: none; + // -ms-user-select: none; + // user-select: none; + text-decoration: none !important; + background-color: transparent; + position: relative; + z-index: 1; + overflow: hidden; + transition: color 200ms ease-in-out, background-color 200ms ease-in-out, border-color 200ms ease-in-out, + box-shadow 200ms ease-in-out; + &.is-small { + padding: 5px 10px; + font-size: 14px; + } + &.is-medium { + padding: 8px 15px; + font-size: 16px; + } + &.is-large { + padding: 13px 20px; + font-size: 18px; + } + .editor-rich-text { + cursor: text; + .editor-rich-text__tinymce { + line-height: 1.3 !important; + } + } - &:before { - content: " "; - position: absolute; - left: 0px; - top: 0px; - right: 0; - bottom: 0; - z-index: -2; - opacity: 0; - transition: all 300ms ease-in-out; - } + &:before { + content: " "; + position: absolute; + left: 0px; + top: 0px; + right: 0; + bottom: 0; + z-index: -2; + opacity: 0; + transition: all 300ms ease-in-out; + } - &:hover:before { - opacity: 1; - } + &:hover:before { + opacity: 1; + } } .qubely-action-button-remove { - // display: none; - font-size: 12px; - width: 18px; - height: 18px; - line-height: 20px; - text-align: center; - background: rgba(0, 0, 0, 0.8); - color: #fff; - position: absolute; - top: -9px; - right: -9px; - border-radius: 10px; - z-index: 1; - cursor: pointer; + // display: none; + font-size: 12px; + width: 18px; + height: 18px; + line-height: 20px; + text-align: center; + background: rgba(0, 0, 0, 0.8); + color: #fff; + position: absolute; + top: -9px; + right: -9px; + border-radius: 10px; + z-index: 1; + cursor: pointer; } .qubely-button-text { - white-space: nowrap !important; -} \ No newline at end of file + white-space: nowrap !important; +} diff --git a/assets/reactjs/src/blocks/buttongroup/Edit.js b/assets/reactjs/src/blocks/buttongroup/Edit.js index 64ec543b..382b70ce 100644 --- a/assets/reactjs/src/blocks/buttongroup/Edit.js +++ b/assets/reactjs/src/blocks/buttongroup/Edit.js @@ -1,4 +1,4 @@ -import classnames from 'classnames'; +import classnames from "classnames"; const { __ } = wp.i18n; const { Fragment, Component } = wp.element; const { PanelBody } = wp.components; @@ -6,172 +6,170 @@ const { compose } = wp.compose; const { withSelect, withDispatch } = wp.data; const { InnerBlocks, InspectorControls } = wp.blockEditor; const { - Range, - Alignment, - gloalSettings: { - globalSettingsPanel, - animationSettings, - interactionSettings - }, - withCSSGenerator, - InspectorTabs, - InspectorTab + Range, + Alignment, + gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, + withCSSGenerator, + InspectorTabs, + InspectorTab, } = wp.qubelyComponents; const UI_PARTS = { - hasSelectedUI: false + hasSelectedUI: false, }; class Edit extends Component { - constructor(props) { - super(props); - this.state = { - device: 'md' - } - } - componentDidMount() { - const { - clientId, - setAttributes, - attributes: { - uniqueId - } - } = this.props; + constructor(props) { + super(props); + this.state = { + device: "md", + }; + } - const _client = clientId.substr(0, 6); + render() { + const { + block, + clientId, + setAttributes, + updateBlockAttributes, + attributes: { + uniqueId, + className, + alignment, + buttons, + spacing, + padding, + interaction, + //animation + animation, + //global + globalZindex, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + hideTablet, + hideMobile, + globalCss, + }, + } = this.props; - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - } + const { device } = this.state; - render() { - const { - block, - clientId, - setAttributes, - updateBlockAttributes, - attributes: { - uniqueId, - className, - alignment, - buttons, - spacing, - padding, - interaction, - //animation - animation, - //global - globalZindex, - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - hideTablet, - hideMobile, - globalCss - } - } = this.props; + const { getBlockOrder } = wp.data.select("core/block-editor"), + hasChildBlocks = getBlockOrder(clientId).length > 0, + classes = classnames({ [`qubely-block-${uniqueId}`]: uniqueId }, className); + let index = 0; + while (index < buttons) { + block.innerBlocks[index] && + updateBlockAttributes( + block.innerBlocks[index].clientId, + Object.assign(block.innerBlocks[index].attributes, { parentClientId: clientId }) + ); + index++; + } + return ( + + + + + + setAttributes({ alignment: val })} + flex + disableJustify + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ spacing: value })} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + + {animationSettings(uniqueId, animation, setAttributes)} + {interactionSettings(uniqueId, interaction, setAttributes)} + + + - const { device } = this.state; + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} - const { getBlockOrder } = wp.data.select('core/block-editor'), - hasChildBlocks = getBlockOrder(clientId).length > 0, - classes = classnames( - { [`qubely-block-${uniqueId}`]: uniqueId }, - className - ); - let index = 0; - while (index < buttons) { - block.innerBlocks[index] && updateBlockAttributes(block.innerBlocks[index].clientId, Object.assign(block.innerBlocks[index].attributes, { parentClientId: clientId })) - index++ - } - return ( - - - - - - setAttributes({ alignment: val })} flex disableJustify responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ spacing: value })} - onDeviceChange={value => this.setState({ device: value })} - /> - - - - {animationSettings(uniqueId, animation, setAttributes)} - {interactionSettings(uniqueId, interaction, setAttributes)} - - - - - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} - -
    -
    - ['qubely/button', - { - buttonGroup: true, - parentClientId: clientId, - enableAlignment: false, - spacer: { - spaceTop: { - md: '10', - unit: "px" - }, - spaceBottom: { - md: '10', - unit: "px" - } - }, - customClassName: 'qubely-group-button', - disableFullWidth: true - } - ])} - templateLock={false} - renderAppender={false} - __experimentalUIParts={UI_PARTS} - __experimentalMoverDirection="horizontal" - allowedBlocks={['qubely/button']} - renderAppender={( - hasChildBlocks ? - undefined : - () => - )} - /> -
    -
    -
    - ) - } +
    +
    + [ + "qubely/button", + { + buttonGroup: true, + parentClientId: clientId, + enableAlignment: false, + spacer: { + spaceTop: { + md: "10", + unit: "px", + }, + spaceBottom: { + md: "10", + unit: "px", + }, + }, + customClassName: "qubely-group-button", + disableFullWidth: true, + }, + ])} + templateLock={false} + renderAppender={false} + __experimentalUIParts={UI_PARTS} + __experimentalMoverDirection="horizontal" + allowedBlocks={["qubely/button"]} + renderAppender={hasChildBlocks ? undefined : () => } + /> +
    +
    +
    + ); + } } export default compose([ - withSelect((select, ownProps) => { - const { clientId } = ownProps; - const { getBlock } = select('core/block-editor'); - return { - block: getBlock(clientId) - }; - }), - withDispatch((dispatch) => { - const { updateBlockAttributes } = dispatch('core/block-editor'); - return { - updateBlockAttributes - } - }), - withCSSGenerator() -])(Edit); \ No newline at end of file + withSelect((select, ownProps) => { + const { clientId } = ownProps; + const { getBlock } = select("core/block-editor"); + return { + block: getBlock(clientId), + }; + }), + withDispatch((dispatch) => { + const { updateBlockAttributes } = dispatch("core/block-editor"); + return { + updateBlockAttributes, + }; + }), + withCSSGenerator(), +])(Edit); diff --git a/assets/reactjs/src/blocks/buttongroup/Save.js b/assets/reactjs/src/blocks/buttongroup/Save.js index af6fc3e3..3f11d34c 100644 --- a/assets/reactjs/src/blocks/buttongroup/Save.js +++ b/assets/reactjs/src/blocks/buttongroup/Save.js @@ -1,18 +1,20 @@ const { Component } = wp.element; -const { InnerBlocks } = wp.blockEditor -const { HelperFunction: { IsInteraction, animationAttr } } = wp.qubelyComponents +const { InnerBlocks } = wp.blockEditor; +const { + HelperFunction: { IsInteraction, animationAttr }, +} = wp.qubelyComponents; class Save extends Component { render() { - const { uniqueId, interaction, animation } = this.props.attributes - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; + const { uniqueId, interaction, animation } = this.props.attributes; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; return (
    - ) + ); } } -export default Save \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/buttongroup/attributes.js b/assets/reactjs/src/blocks/buttongroup/attributes.js index f1ae381d..41d89043 100644 --- a/assets/reactjs/src/blocks/buttongroup/attributes.js +++ b/assets/reactjs/src/blocks/buttongroup/attributes.js @@ -1,34 +1,30 @@ - const { - gloalSettings: { - globalAttributes - }, - HelperFunction: { - IsInteraction - } + gloalSettings: { globalAttributes }, + HelperFunction: { IsInteraction }, } = wp.qubelyComponents; const attributes = { - uniqueId: { type: 'string', default: '' }, - ...globalAttributes, - buttons: { type: 'number', default: 2 }, - alignment: { - type: 'object', - default: { md: 'flex-start' }, - style: [ - { selector: '{{QUBELY}} .qubely-block-button-group {justify-content: {{alignment}}; }' } - ], - }, - spacing: { - type: 'object', - default: { - unit: "px", - md: "10" - }, - style: [ - // { selector: '{{QUBELY}} .qubely-block-button-group {margin: -{{spacing}};} {{QUBELY}} .qubely-block-button-group.qubely-backend .block-editor-block-list__layout > div[data-type="qubely/button"]:not(:nth-last-child(2)), {{QUBELY}} .qubely-block-button-group .wp-block-qubely-button{margin: {{spacing}};}' } - { selector: '{{QUBELY}} .qubely-block-button-group {margin-right: -{{spacing}};} {{QUBELY}} .qubely-block-button-group.qubely-backend .block-editor-block-list__layout > div[data-type="qubely/button"]:not(:nth-last-child(2)), {{QUBELY}} .qubely-block-button-group .wp-block-qubely-button:not(:last-child){margin-right: {{spacing}};}' } - ] - } -} -export default attributes; \ No newline at end of file + uniqueId: { type: "string", default: "" }, + ...globalAttributes, + buttons: { type: "number", default: 2 }, + alignment: { + type: "object", + default: { md: "flex-start" }, + style: [{ selector: "{{QUBELY}} .qubely-block-button-group {justify-content: {{alignment}}; }" }], + }, + spacing: { + type: "object", + default: { + unit: "px", + md: "10", + }, + style: [ + // { selector: '{{QUBELY}} .qubely-block-button-group {margin: -{{spacing}};} {{QUBELY}} .qubely-block-button-group.qubely-backend .block-editor-block-list__layout > div[data-type="qubely/button"]:not(:nth-last-child(2)), {{QUBELY}} .qubely-block-button-group .wp-block-qubely-button{margin: {{spacing}};}' } + { + selector: + '{{QUBELY}} .qubely-block-button-group {margin-right: -{{spacing}};} {{QUBELY}} .qubely-block-button-group.qubely-backend .block-editor-block-list__layout > div[data-type="qubely/button"]:not(:nth-last-child(2)), {{QUBELY}} .qubely-block-button-group .wp-block-qubely-button:not(:last-child){margin-right: {{spacing}};}', + }, + ], + }, +}; +export default attributes; diff --git a/assets/reactjs/src/blocks/buttongroup/index.js b/assets/reactjs/src/blocks/buttongroup/index.js index dd92b103..ebcbb243 100644 --- a/assets/reactjs/src/blocks/buttongroup/index.js +++ b/assets/reactjs/src/blocks/buttongroup/index.js @@ -1,79 +1,74 @@ -import './style.scss'; -import Edit from './Edit'; -import Save from './Save'; -import attributes from './attributes'; +import "./style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +import attributes from "./attributes"; const { __ } = wp.i18n; const { InnerBlocks } = wp.blockEditor; const { registerBlockType } = wp.blocks; const { - HelperFunction: { - IsInteraction - } + HelperFunction: { IsInteraction }, } = wp.qubelyComponents; +registerBlockType("qubely/buttongroup", { + title: __("Button Group"), + description: "Bunch together a group of useful buttons with Qubely Button Group.", + category: "qubely", + icon: ( + {__("Button + ), + supports: { + align: ["center", "wide", "full"], + html: false, + }, + keywords: [__("button"), __("buttons"), __("link"), __("button group")], + example: { + attributes: { + buttons: 2, + alignment: { + md: "center", + }, + spacing: { + md: "15", + unit: "px", + }, + }, + innerBlocks: [ + { + name: "qubely/button", + attributes: { + textField: "Button one", + }, + }, + { + name: "qubely/button", + attributes: { + textField: "Button two", + }, + }, + ], + }, + attributes, + edit: Edit, + save: Save, + deprecated: [ + { + attributes, + save(props) { + const { uniqueId, interaction } = props.attributes; -registerBlockType('qubely/buttongroup', { - title: __('Button Group'), - description: 'Bunch together a group of useful buttons with Qubely Button Group.', - category: 'qubely', - icon: {__('Button, - supports: { - align: ['center', 'wide', 'full'], - html: false, - }, - keywords: [ - __('button'), - __('buttons'), - __('link'), - __('button group') - ], - example: { - attributes: { - buttons: 2, - alignment: { - md: "center" - }, - spacing: { - md: "15", - unit: "px" - } - }, - innerBlocks: [ - { - name: 'qubely/button', - attributes: { - textField: 'Button one', - }, - }, - { - name: 'qubely/button', - attributes: { - textField: 'Button two', - }, - } - ], - }, - attributes, - edit: Edit, - save: Save, - deprecated: [ - { - attributes, - save(props) { - const { - uniqueId, - interaction, - } = props.attributes; - - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - return ( -
    -
    - -
    -
    - ) - } - } - ] -}); \ No newline at end of file + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + return ( +
    +
    + +
    +
    + ); + }, + }, + ], +}); diff --git a/assets/reactjs/src/blocks/buttongroup/style.scss b/assets/reactjs/src/blocks/buttongroup/style.scss index e314a907..a84c9a81 100644 --- a/assets/reactjs/src/blocks/buttongroup/style.scss +++ b/assets/reactjs/src/blocks/buttongroup/style.scss @@ -1,31 +1,31 @@ .qubely-block-button-group { - display: flex; - flex-wrap: wrap; - .block-editor-inner-blocks { - width: auto !important; - .block-editor-block-list__layout { - display: block; - width: fit-content; - > div { - display: inline-block; - width: auto; - .qubely-block-btn{ - margin: 4px; - } - &:last-child{ - margin: 10px; - } - } - .block-list-appender{ - display: inline-block !important; - } - } - } - .qubely-add-new { - display: flex; - align-items: center; - justify-content: center; - width: fit-content; - z-index: 100; - } + display: flex; + flex-wrap: wrap; + .block-editor-inner-blocks { + width: auto !important; + .block-editor-block-list__layout { + display: block; + width: fit-content; + > div { + display: inline-block; + width: auto; + .qubely-block-btn { + margin: 4px; + } + &:last-child { + margin: 10px; + } + } + .block-list-appender { + display: inline-block !important; + } + } + } + .qubely-add-new { + display: flex; + align-items: center; + justify-content: center; + width: fit-content; + z-index: 100; + } } diff --git a/assets/reactjs/src/blocks/contactform/Edit.js b/assets/reactjs/src/blocks/contactform/Edit.js index 08a94766..3807a97c 100644 --- a/assets/reactjs/src/blocks/contactform/Edit.js +++ b/assets/reactjs/src/blocks/contactform/Edit.js @@ -1,550 +1,672 @@ /* eslint-disable react/react-in-jsx-scope */ const { __ } = wp.i18n; -const { InspectorControls, BlockControls } = wp.blockEditor +const { InspectorControls, BlockControls } = wp.blockEditor; const { Component, Fragment, createRef } = wp.element; +const { PanelBody, TextControl, TextareaControl, Toolbar, Button, Notice } = wp.components; const { - PanelBody, - TextControl, - TextareaControl, - Toolbar, - Button, - Notice -} = wp.components; -const { - Styles, - Range, - Toggle, - Typography, - Color, - Tabs, - Tab, - Border, - RadioAdvanced, - QubelyButtonEdit, - BorderRadius, - Separator, - gloalSettings: { - globalSettingsPanel, - animationSettings - }, - Inline: { InlineToolbar }, - QubelyButton: { buttonSettings }, - ContextMenu: { - ContextMenu, - handleContextMenu - }, - withCSSGenerator, - InspectorTabs, - InspectorTab -} = wp.qubelyComponents - -import icons from '../../helpers/icons'; + Styles, + Range, + Toggle, + Typography, + Color, + Tabs, + Tab, + Border, + RadioAdvanced, + QubelyButtonEdit, + BorderRadius, + Separator, + gloalSettings: { globalSettingsPanel, animationSettings }, + Inline: { InlineToolbar }, + QubelyButton: { buttonSettings }, + ContextMenu: { ContextMenu, handleContextMenu }, + withCSSGenerator, + InspectorTabs, + InspectorTab, +} = wp.qubelyComponents; +import icons from "../../helpers/icons"; class Edit extends Component { + constructor(props) { + super(props); + this.state = { + device: "md", + spacer: true, + selectedItem: -1, + saved_globally: false, + }; + this._saveGlobally = this._saveGlobally.bind(this); + this.qubelyContextMenu = createRef(); + } - constructor(props) { - super(props) - this.state = { - device: 'md', - spacer: true, - selectedItem: -1, - saved_globally: false - } - this._saveGlobally = this._saveGlobally.bind(this); - this.qubelyContextMenu = createRef(); - } - - componentDidMount() { - const { setAttributes, clientId, attributes: { uniqueId, reCaptchaSiteKey, reCaptchaSecretKey } } = this.props - const _client = clientId.substr(0, 6) - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - - if (qubely_admin.qubely_recaptcha_site_key) { - setAttributes({ reCaptchaSiteKey: qubely_admin.qubely_recaptcha_site_key }); - } - - if (qubely_admin.qubely_recaptcha_secret_key) { - setAttributes({ reCaptchaSecretKey: qubely_admin.qubely_recaptcha_secret_key }); - } - - } - - async _saveGlobally(siteKey, secretKey) { - if (!siteKey || !secretKey) return; - try { - await wp.apiFetch({ - path: 'qubely/v1/add_qubely_options', - method: 'POST', - data: { key: 'qubely_recaptcha_site_key', value: siteKey } - }); - await wp.apiFetch({ - path: 'qubely/v1/add_qubely_options', - method: 'POST', - data: { key: 'qubely_recaptcha_secret_key', value: secretKey } - }); - this.setState({ saved_globally: true }); - } catch (e) { - console.log(e); - } - } + componentDidMount() { + const { + setAttributes, + attributes: {}, + } = this.props; - setSettings(type, val, index = -1) { - const selectedItem = (index !== -1) ? index : this.state.selectedItem; - const { attributes, setAttributes } = this.props; - let formItems = [...attributes.formItems]; - formItems[selectedItem][type] = val; - setAttributes({ formItems }); - } + if (qubely_admin.qubely_recaptcha_site_key) { + setAttributes({ reCaptchaSiteKey: qubely_admin.qubely_recaptcha_site_key }); + } - render() { - const { selectedItem, device } = this.state; - const { name, clientId, attributes, setAttributes } = this.props; - const { - uniqueId, - className, - formItems, - labelTypography, - labelColor, - labelColorFocus, - inputTypography, - inputColor, - inputColorFocus, - inputColorHover, - inputBg, - inputBgFocus, - inputBgHover, - inputBorder, - inputBorderMaterial, - inputBorderColorFocus, - inputBorderColorHover, - inputBorderRadius, - inputSize, - inputPaddingX, - inputPaddingY, - textareaHeight, - placeholderColor, - placeholderColorFocus, - placeholderColorHover, - enableButton, - buttonTag, - buttonSize, - buttonFillType, - buttonText, - buttonIconName, - buttonIconPosition, - spacing, gutter, - fieldErrorMessage, - formSuccessMessage, - formErrorMessage, - reCaptcha, - reCaptchaSiteKey, - reCaptchaSecretKey, - emailReceiver, - emailHeaders, - emailFrom, - emailSubject, - emailBody, - layout, - animation, - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - globalZindex, - hideTablet, - hideMobile, - globalCss } = attributes; - const setting_url = qubely_admin.admin_url + 'admin.php?page=qubely-settings'; - return ( - - - - - - setAttributes({ layout: val })} - options={[ - { value: 'classic', img: icons.form_classic, label: __('Classic') }, - { value: 'material', img: icons.form_material, label: __('Material') }, - ]} - /> - + if (qubely_admin.qubely_recaptcha_secret_key) { + setAttributes({ reCaptchaSecretKey: qubely_admin.qubely_recaptcha_secret_key }); + } + } - {selectedItem >= 0 && - + async _saveGlobally(siteKey, secretKey) { + if (!siteKey || !secretKey) return; + try { + await wp.apiFetch({ + path: "qubely/v1/add_qubely_options", + method: "POST", + data: { key: "qubely_recaptcha_site_key", value: siteKey }, + }); + await wp.apiFetch({ + path: "qubely/v1/add_qubely_options", + method: "POST", + data: { key: "qubely_recaptcha_secret_key", value: secretKey }, + }); + this.setState({ saved_globally: true }); + } catch (e) { + console.log(e); + } + } - this.setSettings('label', val)} - placeholder={__('Enter Label')} - /> + setSettings(type, val, index = -1) { + const selectedItem = index !== -1 ? index : this.state.selectedItem; + const { attributes, setAttributes } = this.props; + let formItems = [...attributes.formItems]; + formItems[selectedItem][type] = val; + setAttributes({ formItems }); + } - this.setSettings('name', val)} - placeholder={__('Enter Name')} - help={__('You must write field name with hyphen(-) with lowercase. No space, UPPERCASE, Capitalize is not allowed. This name should match with Form template value. Never keep empty this name.')} - /> + render() { + const { selectedItem, device } = this.state; + const { name, clientId, attributes, setAttributes } = this.props; + const { + uniqueId, + className, + formItems, + labelTypography, + labelColor, + labelColorFocus, + inputTypography, + inputColor, + inputColorFocus, + inputColorHover, + inputBg, + inputBgFocus, + inputBgHover, + inputBorder, + inputBorderMaterial, + inputBorderColorFocus, + inputBorderColorHover, + inputBorderRadius, + inputSize, + inputPaddingX, + inputPaddingY, + textareaHeight, + placeholderColor, + placeholderColorFocus, + placeholderColorHover, + enableButton, + buttonTag, + buttonSize, + buttonFillType, + buttonText, + buttonIconName, + buttonIconPosition, + spacing, + gutter, + fieldErrorMessage, + formSuccessMessage, + formErrorMessage, + reCaptcha, + reCaptchaSiteKey, + reCaptchaSecretKey, + emailReceiver, + emailHeaders, + emailSubject, + emailBody, + layout, + animation, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + } = attributes; + const setting_url = qubely_admin.admin_url + "admin.php?page=qubely-settings"; + return ( + + + + + + setAttributes({ layout: val })} + options={[ + { value: "classic", img: icons.form_classic, label: __("Classic") }, + { value: "material", img: icons.form_material, label: __("Material") }, + ]} + /> + - this.setSettings('placeholder', val)} - placeholder={__('Enter Placeholder')} - /> + {selectedItem >= 0 && ( + + this.setSettings("label", val)} + placeholder={__("Enter Label")} + /> - this.setSettings('width', val)} - max={100} - min={33} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - this.setSettings('required', val)} - /> - {layout == 'classic' && - this.setSettings('hideLabel', val)} - /> - } - - } + this.setSettings("name", val)} + placeholder={__("Enter Name")} + help={__( + "You must write field name with hyphen(-) with lowercase. No space, UPPERCASE, Capitalize is not allowed. This name should match with Form template value. Never keep empty this name." + )} + /> - - setAttributes({ labelTypography: val })} - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - setAttributes({ labelColor: val })} - /> - {layout == 'material' && - setAttributes({ labelColorFocus: val })} - /> - } - + this.setSettings("placeholder", val)} + placeholder={__("Enter Placeholder")} + /> - - setAttributes({ inputSize: value })} - /> - {inputSize == 'custom' && - - } - value={inputPaddingY} - onChange={(value) => setAttributes({ inputPaddingY: value })} - unit={['px', 'em', '%']} - min={0} - max={50} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> + this.setSettings("width", val)} + max={100} + min={33} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + this.setSettings("required", val)} + /> + {layout == "classic" && ( + this.setSettings("hideLabel", val)} + /> + )} + + )} - {layout == 'classic' && - } - value={inputPaddingX} - onChange={(value) => setAttributes({ inputPaddingX: value })} - unit={['px', 'em', '%']} - min={0} - max={50} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - } - - - } - setAttributes({ textareaHeight: value })} - unit={['px', 'em', '%']} - min={100} - max={500} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - setAttributes({ spacing: value })} - unit={['px', 'em', '%']} - min={0} - max={60} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - setAttributes({ gutter: value })} - unit={['px', 'em', '%']} - min={0} - max={60} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - - - setAttributes({ inputColor: val })} /> - {layout == 'classic' && - setAttributes({ inputBg: val })} /> - } - setAttributes({ placeholderColor: val })} /> - - {layout == 'classic' && - setAttributes({ inputBorder: val })} min={0} max={10} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - } - {layout == 'material' && - setAttributes({ inputBorderMaterial: val })} min={0} max={10} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - } - - - setAttributes({ inputColorFocus: val })} /> - {layout == 'classic' && - setAttributes({ inputBgFocus: val })} /> - } - setAttributes({ placeholderColorFocus: val })} /> - setAttributes({ inputBorderColorFocus: value })} /> - - - setAttributes({ inputColorHover: val })} /> - {layout == 'classic' && - setAttributes({ inputBgHover: val })} /> - } - setAttributes({ placeholderColorHover: val })} /> - setAttributes({ inputBorderColorHover: value })} /> - - + + setAttributes({ labelTypography: val })} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ labelColor: val })} + /> + {layout == "material" && ( + setAttributes({ labelColorFocus: val })} + /> + )} + - setAttributes({ inputBorderRadius: value })} - min={0} - max={100} unit={['px', 'em', '%']} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - setAttributes({ inputTypography: val })} device={device} onDeviceChange={value => this.setState({ device: value })} /> - + + setAttributes({ inputSize: value })} + /> + {inputSize == "custom" && ( + + } + value={inputPaddingY} + onChange={(value) => setAttributes({ inputPaddingY: value })} + unit={["px", "em", "%"]} + min={0} + max={50} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> - - - - setAttributes({ fieldErrorMessage: val })} - help={__('Set required field error message here. Leave blank for default message.')} - /> - setAttributes({ formSuccessMessage: val })} - help={__('Set your desired message after successful form submission. Leave blank for default.')} - /> - setAttributes({ formErrorMessage: val })} - help={__('Set your desired message for form submission error. Leave blank for default.')} - /> - setAttributes({ reCaptcha: val })} /> - { - reCaptcha && ( - ((qubely_admin.qubely_recaptcha_site_key && qubely_admin.qubely_recaptcha_site_key) || this.state.saved_globally) ? ( -
    {__('reCaptcha keys added successfully')}, {__('Edit keys here')}
    - ) : ( - reCaptchaSiteKey && reCaptchaSecretKey ? ( -
    - setAttributes({ reCaptchaSiteKey: val })} - placeholder={__('Enter Google Site Key')} - /> - setAttributes({ reCaptchaSecretKey: val })} - placeholder={__('Enter Google Secret Key')} - /> - -
    - ) : ( -
    {__('reCaptcha requires site key & secret key')}, {__('Add keys here')}
    - ) - ) - ) - } -
    - - setAttributes({ emailReceiver: val })} - placeholder={__('Enter Recipient Email')} - help={__('Enter the recipient email address. This field is mandatory. Without a recipient email, contact form will not work.')} - /> - setAttributes({ emailHeaders: val })} - /> - setAttributes({ emailFrom: val })} - placeholder={__('Your Name: admin@example.com')} - /> - - {__("Please use your site's email, to avoid any error.")} -
    - {__("if your site is example.com, the email should be anything@example.com")} -
    - setAttributes({ emailSubject: val })} - placeholder={__('Enter Subject')} - /> - setAttributes({ emailBody: val })} - help={__('Set your form email body here. In editor don\'t add any CSS style or others option just add your form field name between double curly braces {{field-name}} as you set in \'Field Name\'.')} - /> -
    -
    -
    - {buttonSettings(this.props.attributes, device, (key, value) => { setAttributes({ [key]: value }) }, (key, value) => { this.setState({ [key]: value }) })} -
    - - {animationSettings(uniqueId, animation, setAttributes)} - -
    -
    + {layout == "classic" && ( + + } + value={inputPaddingX} + onChange={(value) => setAttributes({ inputPaddingX: value })} + unit={["px", "em", "%"]} + min={0} + max={50} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + +
    + )} + setAttributes({ textareaHeight: value })} + unit={["px", "em", "%"]} + min={100} + max={500} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ spacing: value })} + unit={["px", "em", "%"]} + min={0} + max={60} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ gutter: value })} + unit={["px", "em", "%"]} + min={0} + max={60} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ inputColor: val })} + /> + {layout == "classic" && ( + setAttributes({ inputBg: val })} + /> + )} + setAttributes({ placeholderColor: val })} + /> + + {layout == "classic" && ( + setAttributes({ inputBorder: val })} + min={0} + max={10} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + {layout == "material" && ( + setAttributes({ inputBorderMaterial: val })} + min={0} + max={10} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + + + setAttributes({ inputColorFocus: val })} + /> + {layout == "classic" && ( + setAttributes({ inputBgFocus: val })} + /> + )} + setAttributes({ placeholderColorFocus: val })} + /> + setAttributes({ inputBorderColorFocus: value })} + /> + + + setAttributes({ inputColorHover: val })} + /> + {layout == "classic" && ( + setAttributes({ inputBgHover: val })} + /> + )} + setAttributes({ placeholderColorHover: val })} + /> + setAttributes({ inputBorderColorHover: value })} + /> + + - - - - - + setAttributes({ inputBorderRadius: value })} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ inputTypography: val })} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} + + + + setAttributes({ fieldErrorMessage: val })} + help={__( + "Set required field error message here. Leave blank for default message." + )} + /> + setAttributes({ formSuccessMessage: val })} + help={__( + "Set your desired message after successful form submission. Leave blank for default." + )} + /> + setAttributes({ formErrorMessage: val })} + help={__( + "Set your desired message for form submission error. Leave blank for default." + )} + /> + setAttributes({ reCaptcha: val })} + /> + {reCaptcha && + ((qubely_admin.qubely_recaptcha_site_key && + qubely_admin.qubely_recaptcha_site_key) || + this.state.saved_globally ? ( +
    + {__("reCaptcha keys added successfully")},{" "} + + {__("Edit keys here")} + +
    + ) : reCaptchaSiteKey && reCaptchaSecretKey ? ( +
    + setAttributes({ reCaptchaSiteKey: val })} + placeholder={__("Enter Google Site Key")} + /> + setAttributes({ reCaptchaSecretKey: val })} + placeholder={__("Enter Google Secret Key")} + /> + +
    + ) : ( +
    + {__("reCaptcha requires site key & secret key")},{" "} + + {__("Add keys here")} + +
    + ))} +
    + + setAttributes({ emailReceiver: val })} + placeholder={__("Enter Recipient Email")} + help={__( + "Enter the recipient email address. This field is mandatory. Without a recipient email, contact form will not work." + )} + /> + setAttributes({ emailHeaders: val })} + /> + setAttributes({ emailSubject: val })} + placeholder={__("Enter Subject")} + /> + setAttributes({ emailBody: val })} + help={__( + "Set your form email body here. In editor don't add any CSS style or others option just add your form field name between double curly braces {{field-name}} as you set in 'Field Name'." + )} + /> + +
    +
    + {buttonSettings( + this.props.attributes, + device, + (key, value) => { + setAttributes({ [key]: value }); + }, + (key, value) => { + this.setState({ [key]: value }); + } + )} + + + {animationSettings(uniqueId, animation, setAttributes)} + + + -
    -
    handleContextMenu(event, this.qubelyContextMenu.current)} - > -
    - {formItems.map((item, index) => -
    -
    + + + + + - {!item.hideLabel && layout == 'classic' && - - } + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} - {/* Text and Email */} - {(item.type == 'text' || item.type == 'email') && - this.setState({ selectedItem: index })} /> - } +
    +
    handleContextMenu(event, this.qubelyContextMenu.current)} + > + + {formItems.map((item, index) => ( +
    +
    + {!item.hideLabel && layout == "classic" && ( + + )} - {/* Textarea */} - {item.type == 'textarea' && - - } + {/* Text and Email */} + {(item.type == "text" || item.type == "email") && ( + this.setState({ selectedItem: index })} + /> + )} - {layout == 'material' && - - } -
    -
    - )} -
    - setAttributes({ buttonText: value })} - /> -
    - + {/* Textarea */} + {item.type == "textarea" && ( + + )} -
    - -
    -
    -
    + {layout == "material" && ( + + )} +
    +
    + ))} +
    + setAttributes({ buttonText: value })} + /> +
    + - - ); - } +
    + +
    +
    +
    + + ); + } } -export default withCSSGenerator()(Edit); \ No newline at end of file +export default withCSSGenerator()(Edit); diff --git a/assets/reactjs/src/blocks/contactform/Save.js b/assets/reactjs/src/blocks/contactform/Save.js index d2a8edea..d58e6605 100644 --- a/assets/reactjs/src/blocks/contactform/Save.js +++ b/assets/reactjs/src/blocks/contactform/Save.js @@ -1,97 +1,156 @@ const { __ } = wp.i18n; const { Component } = wp.element; -const { QubelyButtonSave } = wp.qubelyComponents -const { HelperFunction: { animationAttr } } = wp.qubelyComponents; +const { QubelyButtonSave } = wp.qubelyComponents; +const { + HelperFunction: { animationAttr }, +} = wp.qubelyComponents; class Save extends Component { + _encrypt(str) { + return window.btoa(unescape(encodeURIComponent(str))); + } - _encrypt(str) { - return window.btoa(unescape(encodeURIComponent(str))); - } + _renderField(item, index, inputSize) { + const fieldID = `qubely-form-input-${index}`; + const fieldName = `qubely-form-input[${item.name}${item.required ? "*" : ""}]`; + const fieldClass = `qubely-form-control is-${inputSize}`; + switch (item.type) { + case "text": + case "email": + return ( + + ); + case "textarea": + return ( + + ); + default: + return ""; + } + } - _renderField(item, index, inputSize) { - const fieldID = `qubely-form-input-${index}`; - const fieldName = `qubely-form-input[${item.name}${(item.required ? '*' : '') }]`; - const fieldClass = `qubely-form-control is-${inputSize}`; - switch( item.type ) { - case 'text': - case 'email': - return ; - case 'textarea': - return ; - default: - return ''; - } - } + _renderFormGroupCss() { + const { formItems } = this.props.attributes; + let formGroupCss = ""; + formItems.forEach((item, index) => { + formGroupCss += `${ + item.width.md ? `.qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.md}% }` : `` + } + ${ + item.width.sm + ? `@media (max-width: 991px) { .qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.sm}% } }` + : `` + } + ${ + item.width.xs + ? `@media (max-width: 767px) { .qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.xs}% } }` + : `` + }`; + }); + return formGroupCss; + } - _renderFormGroupCss() { - const { formItems } = this.props.attributes; - let formGroupCss = ''; - formItems.forEach( ( item, index ) => { - formGroupCss += `${ item.width.md ? `.qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.md}% }`: `` } - ${ item.width.sm ? `@media (max-width: 991px) { .qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.sm}% } }` : `` } - ${ item.width.xs ? `@media (max-width: 767px) { .qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.xs}% } }` : `` }`; - }); - return formGroupCss; - } + render() { + const { _encrypt, _renderField } = this; + const { + uniqueId, + formItems, + inputSize, + fieldErrorMessage, + formSuccessMessage, + formErrorMessage, + reCaptcha, + reCaptchaSiteKey, + reCaptchaSecretKey, + emailReceiver, + emailHeaders, + emailSubject, + emailBody, + layout, + buttonFillType, + buttonSize, + buttonText, + buttonIconName, + buttonIconPosition, + buttonTag, + animation, + } = this.props.attributes; + return ( +
    + +
    +
    + {formItems.map((item, index) => ( +
    +
    + {!item.hideLabel && layout == "classic" && ( + + )} + {_renderField(item, index, inputSize)} + {layout == "material" && ( + + )} +
    +
    + ))} - render() { - const { _encrypt, _renderField } = this; - const { uniqueId, formItems, inputSize, fieldErrorMessage, formSuccessMessage, formErrorMessage, reCaptcha, reCaptchaSiteKey, reCaptchaSecretKey, emailReceiver, emailHeaders, emailFrom, emailSubject, emailBody, layout, buttonFillType, buttonSize, buttonText, buttonIconName, buttonIconPosition, buttonTag, animation } = this.props.attributes - return ( -
    - -
    - - { formItems.map( ( item, index ) => -
    -
    - { !item.hideLabel && layout == 'classic' && - - } - { _renderField(item, index, inputSize) } - { layout == 'material' && - - } -
    -
    - ) } + {reCaptcha && reCaptchaSiteKey && reCaptchaSecretKey && ( +
    +
    +
    + )} - { (reCaptcha && reCaptchaSiteKey && reCaptchaSecretKey) && -
    -
    -
    - } - -
    - + + + + + - - - - - - - - - - - -
    -
    -
    -
    -
    -
    - -
    -
    - ) - } + + + + + + +
    +
    +
    +
    +
    +
    + +
    +
    + ); + } } -export default Save; \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/contactform/attributes.js b/assets/reactjs/src/blocks/contactform/attributes.js index 8dd01f5e..1727b5f5 100644 --- a/assets/reactjs/src/blocks/contactform/attributes.js +++ b/assets/reactjs/src/blocks/contactform/attributes.js @@ -1,294 +1,368 @@ -const { gloalSettings: { globalAttributes }, QubelyButton: { buttonAttributes }, } = wp.qubelyComponents +const { + gloalSettings: { globalAttributes }, + QubelyButton: { buttonAttributes }, +} = wp.qubelyComponents; const formItems = [ - { type: 'text', label: 'Full Name', name: 'full-name ', placeholder: 'Full Name', width: { md: 50 }, required: true, hideLabel: false }, - { type: 'email', label: 'Email', name: 'email', placeholder: 'Email', width: { md: 50 }, required: true, hideLabel: false }, - { type: 'text', label: 'Subject', name: 'subject', placeholder: 'Subject', width: { md: 100 }, required: true, hideLabel: false }, - { type: 'textarea', label: 'Message', name: 'message', placeholder: 'Message', width: { md: 100 }, required: true, hideLabel: false } -] + { + type: "text", + label: "Full Name", + name: "full-name ", + placeholder: "Full Name", + width: { md: 50 }, + required: true, + hideLabel: false, + }, + { + type: "email", + label: "Email", + name: "email", + placeholder: "Email", + width: { md: 50 }, + required: true, + hideLabel: false, + }, + { + type: "text", + label: "Subject", + name: "subject", + placeholder: "Subject", + width: { md: 100 }, + required: true, + hideLabel: false, + }, + { + type: "textarea", + label: "Message", + name: "message", + placeholder: "Message", + width: { md: 100 }, + required: true, + hideLabel: false, + }, +]; -const attributes = { - uniqueId: { type: 'string', default: '' }, - ...globalAttributes, - ...buttonAttributes, - layout: { type: 'string', default: 'classic' }, - useDefaultStyle: { type: 'boolean', default: true }, - spacer: { type: 'object', default: { spaceTop: { md: '10', unit: 'px' }, spaceBottom: { md: '10', unit: 'px' } }, style: [{ selector: '{{QUBELY}}' }] }, - enableButtonAlignment: { type: 'boolean', default: true }, - enableButton: { type: 'boolean', default: true }, - buttonTag: { type: 'string', default: 'button' }, - buttonText: { type: 'string', default: 'Submit' }, - formItems: { type: 'array', default: formItems }, +const attributes = { + uniqueId: { type: "string", default: "" }, + ...globalAttributes, + ...buttonAttributes, + layout: { type: "string", default: "classic" }, + useDefaultStyle: { type: "boolean", default: true }, + spacer: { + type: "object", + default: { spaceTop: { md: "10", unit: "px" }, spaceBottom: { md: "10", unit: "px" } }, + style: [{ selector: "{{QUBELY}}" }], + }, + enableButtonAlignment: { type: "boolean", default: true }, + enableButton: { type: "boolean", default: true }, + buttonTag: { type: "string", default: "button" }, + buttonText: { type: "string", default: "Submit" }, + formItems: { type: "array", default: formItems }, - spacing: { - type: 'object', default: { md: 30, unit: 'px' }, - style: [ - { - selector: '{{QUBELY}} .qubely-form .qubely-form-group:not(:last-child) {margin-bottom: {{spacing}};}' - } - ] - }, + spacing: { + type: "object", + default: { md: 30, unit: "px" }, + style: [ + { + selector: "{{QUBELY}} .qubely-form .qubely-form-group:not(:last-child) {margin-bottom: {{spacing}};}", + }, + ], + }, - gutter: { - type: 'object', default: { md: 30, unit: 'px' }, - style: [ - { - selector: '{{QUBELY}} .qubely-form {margin: 0 calc(-{{gutter}}/2);} {{QUBELY}} .qubely-form .qubely-form-group {padding: 0 calc({{gutter}}/2);}' - } - ] - }, + gutter: { + type: "object", + default: { md: 30, unit: "px" }, + style: [ + { + selector: + "{{QUBELY}} .qubely-form {margin: 0 calc(-{{gutter}}/2);} {{QUBELY}} .qubely-form .qubely-form-group {padding: 0 calc({{gutter}}/2);}", + }, + ], + }, - labelTypography: { - type: 'obejct', default: { openTypography: 1, size: { md: 16, unit: 'px' } }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'classic' } - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-label' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 'material' } - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-label' - } - ] - }, + labelTypography: { + type: "obejct", + default: { openTypography: 1, size: { md: 16, unit: "px" } }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "classic" }], + selector: "{{QUBELY}} .qubely-form .qubely-form-label", + }, + { + condition: [{ key: "layout", relation: "==", value: "material" }], + selector: "{{QUBELY}} .qubely-form .qubely-form-label", + }, + ], + }, - labelColor: { - type: 'string', default: '', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'classic' } - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-label {color: {{labelColor}};}' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 'material' } - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-label {color: {{labelColor}};}' - } - ] - }, + labelColor: { + type: "string", + default: "", + style: [ + { + condition: [{ key: "layout", relation: "==", value: "classic" }], + selector: "{{QUBELY}} .qubely-form .qubely-form-label {color: {{labelColor}};}", + }, + { + condition: [{ key: "layout", relation: "==", value: "material" }], + selector: "{{QUBELY}} .qubely-form .qubely-form-label {color: {{labelColor}};}", + }, + ], + }, - labelColorFocus: { - type: 'string', default: '', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'material' } - ], - selector: '{{QUBELY}} .qubely-form-control:focus ~ .qubely-form-label, {{QUBELY}} .qubely-form-control:valid ~ .qubely-form-label {color: {{labelColorFocus}};}' - } - ] - }, + labelColorFocus: { + type: "string", + default: "", + style: [ + { + condition: [{ key: "layout", relation: "==", value: "material" }], + selector: + "{{QUBELY}} .qubely-form-control:focus ~ .qubely-form-label, {{QUBELY}} .qubely-form-control:valid ~ .qubely-form-label {color: {{labelColorFocus}};}", + }, + ], + }, - inputTypography: { - type: 'obejct', default: { openTypography: 1, size: { md: 14, unit: 'px' } }, - style: [ - { - selector: '{{QUBELY}} .qubely-form .qubely-form-control, {{QUBELY}} .qubely-form .qubely-form-control::placeholder' - } - ] - }, + inputTypography: { + type: "obejct", + default: { openTypography: 1, size: { md: 14, unit: "px" } }, + style: [ + { + selector: + "{{QUBELY}} .qubely-form .qubely-form-control, {{QUBELY}} .qubely-form .qubely-form-control::placeholder", + }, + ], + }, - inputColor: { type: 'string', default: '#495057', style: [{ selector: '{{QUBELY}} .qubely-form .qubely-form-control {color: {{inputColor}};}' }] }, - // inputColorHover: { type: 'string', default: "#495057", style: [{ selector: '{{QUBELY}} .qubely-form .qubely-form-control:Hover {color: {{inputColorHover}};}' }] }, - inputColorFocus: { type: 'string', default: '#495057', style: [{ selector: '{{QUBELY}} .qubely-form .qubely-form-control:focus {color: {{inputColorFocus}};}' }] }, + inputColor: { + type: "string", + default: "#495057", + style: [{ selector: "{{QUBELY}} .qubely-form .qubely-form-control {color: {{inputColor}};}" }], + }, + // inputColorHover: { type: 'string', default: "#495057", style: [{ selector: '{{QUBELY}} .qubely-form .qubely-form-control:Hover {color: {{inputColorHover}};}' }] }, + inputColorFocus: { + type: "string", + default: "#495057", + style: [{ selector: "{{QUBELY}} .qubely-form .qubely-form-control:focus {color: {{inputColorFocus}};}" }], + }, - placeholderColor: { type: 'string', default: '#818181', style: [{ selector: '{{QUBELY}} .qubely-form .qubely-form-control::placeholder {color: {{placeholderColor}};}' }] }, - placeholderColorHover: { type: 'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-form .qubely-form-control::placeholder:Hover {color: {{placeholderColorHover}};}' }] }, - placeholderColorFocus: { type: 'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-form .qubely-form-control::placeholder:focus {color: {{placeholderColorFocus}};}' }] }, + placeholderColor: { + type: "string", + default: "#818181", + style: [ + { selector: "{{QUBELY}} .qubely-form .qubely-form-control::placeholder {color: {{placeholderColor}};}" }, + ], + }, + placeholderColorHover: { + type: "string", + default: "", + style: [ + { + selector: + "{{QUBELY}} .qubely-form .qubely-form-control::placeholder:Hover {color: {{placeholderColorHover}};}", + }, + ], + }, + placeholderColorFocus: { + type: "string", + default: "", + style: [ + { + selector: + "{{QUBELY}} .qubely-form .qubely-form-control::placeholder:focus {color: {{placeholderColorFocus}};}", + }, + ], + }, - inputBg: { - type: 'string', default: '#fff', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'classic' }, - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control {background-color: {{inputBg}};}' - } - ] - }, + inputBg: { + type: "string", + default: "#fff", + style: [ + { + condition: [{ key: "layout", relation: "==", value: "classic" }], + selector: "{{QUBELY}} .qubely-form .qubely-form-control {background-color: {{inputBg}};}", + }, + ], + }, - inputBgHover: { - type: 'string', default: '', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'classic' }, - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control:hover {background-color: {{inputBgHover}};}' - } - ] - }, + inputBgHover: { + type: "string", + default: "", + style: [ + { + condition: [{ key: "layout", relation: "==", value: "classic" }], + selector: "{{QUBELY}} .qubely-form .qubely-form-control:hover {background-color: {{inputBgHover}};}", + }, + ], + }, - inputBgFocus: { - type: 'string', default: '#fff', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'classic' }, - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control:focus {background-color: {{inputBgFocus}};}' - } - ] - }, + inputBgFocus: { + type: "string", + default: "#fff", + style: [ + { + condition: [{ key: "layout", relation: "==", value: "classic" }], + selector: "{{QUBELY}} .qubely-form .qubely-form-control:focus {background-color: {{inputBgFocus}};}", + }, + ], + }, - inputBorder: { - type: 'object', - default: { - openBorder: 1, - type: 'solid', - widthType: 'global', - global: { md: 1 }, - custom: { md: '1 1 1 1' }, - color: '#ced4da' - }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'classic' }, - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control' - } - ] - }, + inputBorder: { + type: "object", + default: { + openBorder: 1, + type: "solid", + widthType: "global", + global: { md: 1 }, + custom: { md: "1 1 1 1" }, + color: "#ced4da", + }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "classic" }], + selector: "{{QUBELY}} .qubely-form .qubely-form-control", + }, + ], + }, - inputBorderMaterial: { - type: 'object', - default: { openBorder: 1, type: 'solid', widthType: 'custom', custom: { md: '0 0 2 0' }, color: '#ced4da' }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'material' }, - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control' - } - ] - }, + inputBorderMaterial: { + type: "object", + default: { openBorder: 1, type: "solid", widthType: "custom", custom: { md: "0 0 2 0" }, color: "#ced4da" }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "material" }], + selector: "{{QUBELY}} .qubely-form .qubely-form-control", + }, + ], + }, - inputBorderColorHover: { - type: 'string', default: '', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'classic' }, - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control:hover {border-color: {{inputBorderColorHover}};}' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 'material' }, - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control:hover {border-bottom-color: {{inputBorderColorHover}};}' - } - ] - }, + inputBorderColorHover: { + type: "string", + default: "", + style: [ + { + condition: [{ key: "layout", relation: "==", value: "classic" }], + selector: + "{{QUBELY}} .qubely-form .qubely-form-control:hover {border-color: {{inputBorderColorHover}};}", + }, + { + condition: [{ key: "layout", relation: "==", value: "material" }], + selector: + "{{QUBELY}} .qubely-form .qubely-form-control:hover {border-bottom-color: {{inputBorderColorHover}};}", + }, + ], + }, - inputBorderColorFocus: { - type: 'string', default: 'var(--qubely-color-1)', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'classic' }, - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control:focus {border-color: {{inputBorderColorFocus}};}' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 'material' }, - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control:focus {border-bottom-color: {{inputBorderColorFocus}};}' - } - ] - }, + inputBorderColorFocus: { + type: "string", + default: "var(--qubely-color-1)", + style: [ + { + condition: [{ key: "layout", relation: "==", value: "classic" }], + selector: + "{{QUBELY}} .qubely-form .qubely-form-control:focus {border-color: {{inputBorderColorFocus}};}", + }, + { + condition: [{ key: "layout", relation: "==", value: "material" }], + selector: + "{{QUBELY}} .qubely-form .qubely-form-control:focus {border-bottom-color: {{inputBorderColorFocus}};}", + }, + ], + }, - inputColorHover: { - type: 'string', default: '', - style: [ - { - selector: '{{QUBELY}} .qubely-form .qubely-form-control:hover {color: {{inputColorHover}};}' - } - ] - }, + inputColorHover: { + type: "string", + default: "", + style: [ + { + selector: "{{QUBELY}} .qubely-form .qubely-form-control:hover {color: {{inputColorHover}};}", + }, + ], + }, - inputBorderRadius: { - type: 'object', - default: { - openBorderRadius: 1, - radiusType: 'global', - global: { - md: 5 - }, - unit: 'px' - }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'classic' } - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control' - } - ] - }, + inputBorderRadius: { + type: "object", + default: { + openBorderRadius: 1, + radiusType: "global", + global: { + md: 5, + }, + unit: "px", + }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "classic" }], + selector: "{{QUBELY}} .qubely-form .qubely-form-control", + }, + ], + }, - inputSize: { type: 'string', default: 'medium' }, - inputPaddingY: { - type: 'object', default: { md: 10, unit: 'px' }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'classic' }, - { key: 'inputSize', relation: '==', value: 'custom' } - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control {padding-top: {{inputPaddingY}}; padding-bottom: {{inputPaddingY}};}' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 'material' }, - { key: 'inputSize', relation: '==', value: 'custom' } - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control {padding-top: {{inputPaddingY}}; padding-bottom: {{inputPaddingY}};}' - } - ] - }, - inputPaddingX: { - type: 'object', default: { md: 15, unit: 'px' }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'classic' }, - { key: 'inputSize', relation: '==', value: 'custom' } - ], - selector: '{{QUBELY}} .qubely-form .qubely-form-control {padding-left: {{inputPaddingX}}; padding-right: {{inputPaddingX}};}' - } - ] - }, - textareaHeight: { - type: 'object', default: { md: 200, unit: 'px' }, - style: [ - { - selector: '{{QUBELY}} .qubely-form .qubely-form-group textarea.qubely-form-control {height: {{textareaHeight}};}' - } - ] - }, + inputSize: { type: "string", default: "medium" }, + inputPaddingY: { + type: "object", + default: { md: 10, unit: "px" }, + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "classic" }, + { key: "inputSize", relation: "==", value: "custom" }, + ], + selector: + "{{QUBELY}} .qubely-form .qubely-form-control {padding-top: {{inputPaddingY}}; padding-bottom: {{inputPaddingY}};}", + }, + { + condition: [ + { key: "layout", relation: "==", value: "material" }, + { key: "inputSize", relation: "==", value: "custom" }, + ], + selector: + "{{QUBELY}} .qubely-form .qubely-form-control {padding-top: {{inputPaddingY}}; padding-bottom: {{inputPaddingY}};}", + }, + ], + }, + inputPaddingX: { + type: "object", + default: { md: 15, unit: "px" }, + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "classic" }, + { key: "inputSize", relation: "==", value: "custom" }, + ], + selector: + "{{QUBELY}} .qubely-form .qubely-form-control {padding-left: {{inputPaddingX}}; padding-right: {{inputPaddingX}};}", + }, + ], + }, + textareaHeight: { + type: "object", + default: { md: 200, unit: "px" }, + style: [ + { + selector: + "{{QUBELY}} .qubely-form .qubely-form-group textarea.qubely-form-control {height: {{textareaHeight}};}", + }, + ], + }, - fieldErrorMessage: { type: 'string', default: 'Please fill the required field.' }, - formSuccessMessage: { type: 'string', default: 'Email successfully sent!' }, - formErrorMessage: { type: 'string', default: 'Email sending failed, something went wrong! Please try again.' }, - reCaptcha: { type: 'boolean', default: false }, - reCaptchaSiteKey: { type: 'string', default: '' }, - reCaptchaSecretKey: { type: 'string', default: '' }, - emailReceiver: { type: 'string', default: '' }, - emailHeaders: { type: 'string', default: 'Reply-To: {{email}}\nReply-name: {{full-name }} \nCc: {{email}}\nBcc: admin@yourcompany.com' }, - emailFrom: { type: 'string', default: `Your Company Name: admin@${qubely_admin.actual_url}` }, - emailSubject: { type: 'string', default: '{{subject}} | {{email}} | {{site-name}}' }, - emailBody: { type: 'string', default: '

    From: {{full-name }}

    Email: {{email}}

    \n

    Subject: {{subject}}

    \n

    Message: {{message}}

    ' }, - sourceOfCopiedStyle: { type: 'boolean', default: false }, -} + fieldErrorMessage: { type: "string", default: "Please fill the required field." }, + formSuccessMessage: { type: "string", default: "Email successfully sent!" }, + formErrorMessage: { type: "string", default: "Email sending failed, something went wrong! Please try again." }, + reCaptcha: { type: "boolean", default: false }, + reCaptchaSiteKey: { type: "string", default: "" }, + reCaptchaSecretKey: { type: "string", default: "" }, + emailReceiver: { type: "string", default: "" }, + emailHeaders: { + type: "string", + default: "Reply-To: {{email}}\nReply-name: {{full-name}} \nCc: {{email}}\nBcc: admin@yourcompany.com", + }, + emailFrom: { type: "string", default: `Your Company Name: admin@${qubely_admin.actual_url}` }, + emailSubject: { type: "string", default: "{{subject}} | {{email}} | {{site-name}}" }, + emailBody: { + type: "string", + default: + "

    From: {{full-name}}

    Email: {{email}}

    \n

    Subject: {{subject}}

    \n

    Message: {{message}}

    ", + }, + sourceOfCopiedStyle: { type: "boolean", default: false }, +}; -export default attributes; \ No newline at end of file +export default attributes; diff --git a/assets/reactjs/src/blocks/contactform/index.js b/assets/reactjs/src/blocks/contactform/index.js index aaf31996..b35cde68 100644 --- a/assets/reactjs/src/blocks/contactform/index.js +++ b/assets/reactjs/src/blocks/contactform/index.js @@ -1,121 +1,188 @@ /* eslint-disable react/react-in-jsx-scope */ -import Edit from './Edit'; -import Save from './Save'; -import './style.scss'; +import Edit from "./Edit"; +import Save from "./Save"; +import "./style.scss"; const { __ } = wp.i18n; -import attributes from './attributes'; +import attributes from "./attributes"; const { registerBlockType } = wp.blocks; const { QubelyButtonSave } = wp.qubelyComponents; -const { HelperFunction: { animationAttr } } = wp.qubelyComponents; +const { + HelperFunction: { animationAttr }, +} = wp.qubelyComponents; -registerBlockType('qubely/contactform', { - title: __('Contact Form'), - description: __('Encourage site visitor interactions with Qubely Contact Form List'), - category: 'qubely', - icon: {__('Contact, - keywords: [__('Contact'), __('Form')], - supports: { - align: ['center', 'wide', 'full'], - }, - example: { - attributes: {}, - }, - attributes, - edit: Edit, - save: Save, - deprecated: [ - { - attributes, - save(props) { - const { uniqueId, formItems, inputSize, fieldErrorMessage, formSuccessMessage, formErrorMessage, reCaptcha, reCaptchaSiteKey, reCaptchaSecretKey, emailReceiver, emailHeaders, emailFrom, emailSubject, emailBody, layout, buttonFillType, buttonSize, buttonText, buttonIconName, buttonIconPosition, buttonTag, animation } = props.attributes +registerBlockType("qubely/contactform", { + title: __("Contact Form"), + description: __("Encourage site visitor interactions with Qubely Contact Form List"), + category: "qubely", + icon: {__("Contact, + keywords: [__("Contact"), __("Form")], + supports: { + align: ["center", "wide", "full"], + }, + example: { + attributes: {}, + }, + attributes, + edit: Edit, + save: Save, + deprecated: [ + { + attributes, + save(props) { + const { + uniqueId, + formItems, + inputSize, + fieldErrorMessage, + formSuccessMessage, + formErrorMessage, + reCaptcha, + reCaptchaSiteKey, + reCaptchaSecretKey, + emailReceiver, + emailHeaders, + emailFrom, + emailSubject, + emailBody, + layout, + buttonFillType, + buttonSize, + buttonText, + buttonIconName, + buttonIconPosition, + buttonTag, + animation, + } = props.attributes; - const _encrypt = (str) => { - return window.btoa(unescape(encodeURIComponent(str))); - } + const _encrypt = (str) => { + return window.btoa(unescape(encodeURIComponent(str))); + }; - const _renderField = (item, index, inputSize) => { - const fieldID = `qubely-form-input-${index}`; - const fieldName = `qubely-form-input[${item.name}${(item.required ? '*' : '')}]`; - const fieldClass = `qubely-form-control is-${inputSize}`; - switch (item.type) { - case 'text': - case 'email': - return ; - case 'textarea': - return ; - default: - return ''; - } - } + const _renderField = (item, index, inputSize) => { + const fieldID = `qubely-form-input-${index}`; + const fieldName = `qubely-form-input[${item.name}${item.required ? "*" : ""}]`; + const fieldClass = `qubely-form-control is-${inputSize}`; + switch (item.type) { + case "text": + case "email": + return ( + + ); + case "textarea": + return ( + + ); + default: + return ""; + } + }; - const _renderFormGroupCss = () => { - let formGroupCss = ''; - formItems.forEach((item, index) => { - formGroupCss += `${item.width.md ? `.qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.md}% }` : ``} - ${ item.width.sm ? `@media (max-width: 991px) { .qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.sm}% } }` : ``} - ${ item.width.xs ? `@media (max-width: 767px) { .qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.xs}% } }` : ``}`; - }); - return formGroupCss; - } - - return ( -
    - -
    -
    - {formItems.map((item, index) => -
    -
    - {!item.hideLabel && layout == 'classic' && - - } - {_renderField(item, index, inputSize)} - {layout == 'material' && - - } -
    -
    - )} + const _renderFormGroupCss = () => { + let formGroupCss = ""; + formItems.forEach((item, index) => { + formGroupCss += `${ + item.width.md + ? `.qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.md}% }` + : `` + } + ${ + item.width.sm + ? `@media (max-width: 991px) { .qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.sm}% } }` + : `` + } + ${ + item.width.xs + ? `@media (max-width: 767px) { .qubely-form-group.qubely-form-group-index-${index} { width: ${item.width.xs}% } }` + : `` + }`; + }); + return formGroupCss; + }; - {(reCaptcha && reCaptchaSiteKey && reCaptchaSecretKey) && -
    -
    -
    - } + return ( +
    + +
    + + {formItems.map((item, index) => ( +
    +
    + {!item.hideLabel && layout == "classic" && ( + + )} + {_renderField(item, index, inputSize)} + {layout == "material" && ( + + )} +
    +
    + ))} -
    - - - - - - - - - - - - -
    -
    -
    -
    -
    -
    - -
    -
    - ) - } - } - ] + {reCaptcha && reCaptchaSiteKey && reCaptchaSecretKey && ( +
    +
    +
    + )} + +
    + + + + + + + + + + + +
    +
    +
    +
    +
    +
    + +
    +
    + ); + }, + }, + ], }); diff --git a/assets/reactjs/src/blocks/contactform/style.scss b/assets/reactjs/src/blocks/contactform/style.scss index d790edc6..78348720 100644 --- a/assets/reactjs/src/blocks/contactform/style.scss +++ b/assets/reactjs/src/blocks/contactform/style.scss @@ -4,7 +4,7 @@ flex-wrap: wrap; .qubely-form-group { position: relative; - .qubely-form-group-inner{ + .qubely-form-group-inner { text-align: left; } .qubely-form-label { @@ -15,14 +15,14 @@ display: block; width: 100%; background-clip: padding-box; - transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; + transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, + box-shadow 0.15s ease-in-out; &.is-small { padding: 6px 8px; } &.is-medium { padding: 8.5px 12px; - } &.is-large { padding: 14.5px 16px; @@ -39,7 +39,7 @@ color: red; margin: 0; } - .qubely-block-btn-anchor:hover{ + .qubely-block-btn-anchor:hover { background-color: transparent; } } @@ -52,8 +52,8 @@ position: relative; } .qubely-form-label { - position:absolute; - pointer-events:none; + position: absolute; + pointer-events: none; top: 0px; transition: 0.2s ease all; } @@ -61,11 +61,11 @@ border-radius: 0; box-shadow: none; padding-left: 0; - padding-right: 0; - background: none; + padding-right: 0; + background: none; &:focus, &:valid { - outline:none; + outline: none; color: #333; } @@ -89,14 +89,14 @@ } } -.api-notice{ +.api-notice { margin: 0 0 15px; background: rgba(0, 255, 55, 0.15); padding: 8px 12px; - border: 1px solid rgba(0,0,0,.1); + border: 1px solid rgba(0, 0, 0, 0.1); border-radius: 5px; line-height: 1.6; &.warning { background: rgba(229, 195, 52, 0.25); } -} \ No newline at end of file +} diff --git a/assets/reactjs/src/blocks/counter/Edit.js b/assets/reactjs/src/blocks/counter/Edit.js index 664acd4d..11d788f8 100644 --- a/assets/reactjs/src/blocks/counter/Edit.js +++ b/assets/reactjs/src/blocks/counter/Edit.js @@ -1,5 +1,5 @@ const { __ } = wp.i18n; -const { InspectorControls, BlockControls } = wp.blockEditor +const { InspectorControls, BlockControls } = wp.blockEditor; const { Component, Fragment, createRef } = wp.element; const { PanelBody, TextControl, Toolbar } = wp.components; const { @@ -8,27 +8,20 @@ const { Alignment, Typography, Color, - gloalSettings: { - globalSettingsPanel, - animationSettings, - interactionSettings - }, + gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, Inline: { InlineToolbar }, - ContextMenu: { - ContextMenu, - handleContextMenu - }, + ContextMenu: { ContextMenu, handleContextMenu }, withCSSGenerator, InspectorTabs, - InspectorTab -} = wp.qubelyComponents + InspectorTab, +} = wp.qubelyComponents; class Edit extends Component { constructor(props) { - super(props) + super(props); this.state = { - device: 'md', - spacer: true + device: "md", + spacer: true, }; this.qubelyContextMenu = createRef(); } @@ -37,9 +30,7 @@ class Edit extends Component { const _client = clientId.substr(0, 6) if (!uniqueId) { setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } + } } render() { const { @@ -70,83 +61,114 @@ class Edit extends Component { positionYaxis, hideTablet, hideMobile, - globalCss - } } = this.props - const { device } = this.state + globalCss, + }, + } = this.props; + const { device } = this.state; return ( - - - - { setAttributes({ counterLimit: value }) }} /> - {counterLimit > 0 && + + + + { + setAttributes({ counterLimit: value }); + }} + /> + {counterLimit > 0 && ( - { setAttributes({ counterDuration: value }) }} /> + { + setAttributes({ counterDuration: value }); + }} + /> setAttributes({ alignment: val })} + onChange={(val) => setAttributes({ alignment: val })} disableJustify responsive device={device} - onDeviceChange={value => this.setState({ device: value })} /> + onDeviceChange={(value) => this.setState({ device: value })} + /> - } + )} - {counterLimit > 0 && - + {counterLimit > 0 && ( + setAttributes({ counterTypo: value })} device={device} - onDeviceChange={value => this.setState({ device: value })} /> + onDeviceChange={(value) => this.setState({ device: value })} + /> setAttributes({ counterColor: val })} /> + onChange={(val) => setAttributes({ counterColor: val })} + /> - } + )} - {counterLimit > 0 && - - setAttributes({ prefix: value })} /> - setAttributes({ postfix: value })} /> - {(prefix || postfix) && + {counterLimit > 0 && ( + + setAttributes({ prefix: value })} + /> + setAttributes({ postfix: value })} + /> + {(prefix || postfix) && ( setAttributes({ prepostTypo: value })} device={device} - onDeviceChange={value => this.setState({ device: value })} + onDeviceChange={(value) => this.setState({ device: value })} /> setAttributes({ prepostSpacing: value })} responsive device={device} - onDeviceChange={value => this.setState({ device: value })} /> + onDeviceChange={(value) => this.setState({ device: value })} + /> setAttributes({ prepostColor: val })} /> + onChange={(val) => setAttributes({ prepostColor: val })} + /> - } + )} - } + )} - + {animationSettings(uniqueId, animation, setAttributes)} {interactionSettings(uniqueId, interaction, setAttributes)} @@ -154,26 +176,39 @@ class Edit extends Component { - + - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} -
    +
    handleContextMenu(event, this.qubelyContextMenu.current)} + onContextMenu={(event) => handleContextMenu(event, this.qubelyContextMenu.current)} > {counterLimit <= 0 &&
    Please enter counter number
    } {counterDuration <= 0 &&
    Please enter counter Duration
    }
    - {counterLimit > 0 && counterDuration > 0 && + {counterLimit > 0 && counterDuration > 0 && ( {prefix && {prefix}} @@ -181,12 +216,9 @@ class Edit extends Component { {postfix && {postfix}} - } + )}
    -
    +
    - ); } } -export default withCSSGenerator()(Edit); \ No newline at end of file +export default withCSSGenerator()(Edit); diff --git a/assets/reactjs/src/blocks/counter/Save.js b/assets/reactjs/src/blocks/counter/Save.js index 41a3c985..501079d6 100644 --- a/assets/reactjs/src/blocks/counter/Save.js +++ b/assets/reactjs/src/blocks/counter/Save.js @@ -1,28 +1,34 @@ const { Component, Fragment } = wp.element; -const { HelperFunction: { animationAttr, IsInteraction } } = wp.qubelyComponents +const { + HelperFunction: { animationAttr, IsInteraction }, +} = wp.qubelyComponents; class Save extends Component { - render() { - const { uniqueId, counterLimit, counterDuration, postfix, prefix, animation, interaction } = this.props.attributes - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - return ( -
    -
    -
    - {counterLimit > 0 && - - {prefix && - {prefix} - } - {0} - {postfix && - {postfix} - } - - } -
    -
    -
    - ) - } + render() { + const { uniqueId, counterLimit, counterDuration, postfix, prefix, animation, interaction } = + this.props.attributes; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + return ( +
    +
    +
    + {counterLimit > 0 && ( + + {prefix && {prefix}} + + {0} + + {postfix && {postfix}} + + )} +
    +
    +
    + ); + } } -export default Save \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/counter/index.js b/assets/reactjs/src/blocks/counter/index.js index 3febb204..5fc3a876 100644 --- a/assets/reactjs/src/blocks/counter/index.js +++ b/assets/reactjs/src/blocks/counter/index.js @@ -1,47 +1,83 @@ -const { __ } = wp.i18n -import Edit from './Edit' -import Save from './Save' -const { registerBlockType } = wp.blocks -const { gloalSettings: { globalAttributes } } = wp.qubelyComponents +const { __ } = wp.i18n; +import Edit from "./Edit"; +import Save from "./Save"; +const { registerBlockType } = wp.blocks; +const { + gloalSettings: { globalAttributes }, +} = wp.qubelyComponents; -registerBlockType( 'qubely/counter', { - title: __('Counter'), - description: 'Set counters in your pages and posts with Qubely Counter.', - category: 'qubely', - icon: {__('Counter, - keywords: [ __('Counter'), __('Animated Number'), __('Count up'), ], - supports: { - align: ['center', 'wide', 'full'], - }, - example: { - attributes: { - counterLimit: 9999, - postfix: '+', - counterTypo: { - openTypography: 1, - size: { - md: 82, - unit: 'px' - } - }, - }, - }, - attributes: { - uniqueId: { type: 'string', default: '' }, - ...globalAttributes, - spacer: { type: 'object', default:{spaceTop: { md: '10', unit: "px"}, spaceBottom: { md: '10', unit: "px"}}, style: [{ selector: '{{QUBELY}}' }] }, - alignment: { type: 'object', default: {md: 'center'}, style: [{ selector: '{{QUBELY}} .qubely-block-counter {text-align: {{alignment}};}' }] }, - prefix: { type: 'string', default: '' }, - postfix: { type: 'string', default: '' }, - counterLimit: { type: 'string', default: "500" }, - counterDuration: { type: 'string', default: "500" }, - prepostTypo: { type: 'object', default: {}, style: [{ selector: '{{QUBELY}} .qubely-block-counter-prefix, {{QUBELY}} .qubely-block-counter-postfix' }] }, - prepostColor: { type: 'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-block-counter-prefix {color: {{prepostColor}};} {{QUBELY}} .qubely-block-counter-postfix {color: {{prepostColor}};}' }] }, - prepostSpacing: { type: 'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-block-counter-prefix {margin-right: {{prepostSpacing}};} {{QUBELY}} .qubely-block-counter-postfix {margin-left: {{prepostSpacing}};}' }] }, - counterTypo: { type: 'object', default: {}, style: [{ selector: '{{QUBELY}} .qubely-block-counter-content' }] }, - counterColor: { type: 'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-block-counter-content {color: {{counterColor}};}' }] }, - sourceOfCopiedStyle: { type: 'boolean', default: false } - }, - edit: Edit, - save: Save +registerBlockType("qubely/counter", { + title: __("Counter"), + description: "Set counters in your pages and posts with Qubely Counter.", + category: "qubely", + icon: {__("Counter, + keywords: [__("Counter"), __("Animated Number"), __("Count up")], + supports: { + align: ["center", "wide", "full"], + }, + example: { + attributes: { + counterLimit: 9999, + postfix: "+", + counterTypo: { + openTypography: 1, + size: { + md: 82, + unit: "px", + }, + }, + }, + }, + attributes: { + uniqueId: { type: "string", default: "" }, + ...globalAttributes, + spacer: { + type: "object", + default: { spaceTop: { md: "10", unit: "px" }, spaceBottom: { md: "10", unit: "px" } }, + style: [{ selector: "{{QUBELY}}" }], + }, + alignment: { + type: "object", + default: { md: "center" }, + style: [{ selector: "{{QUBELY}} .qubely-block-counter {text-align: {{alignment}};}" }], + }, + prefix: { type: "string", default: "" }, + postfix: { type: "string", default: "" }, + counterLimit: { type: "string", default: "500" }, + counterDuration: { type: "string", default: "500" }, + prepostTypo: { + type: "object", + default: {}, + style: [{ selector: "{{QUBELY}} .qubely-block-counter-prefix, {{QUBELY}} .qubely-block-counter-postfix" }], + }, + prepostColor: { + type: "string", + default: "", + style: [ + { + selector: + "{{QUBELY}} .qubely-block-counter-prefix {color: {{prepostColor}};} {{QUBELY}} .qubely-block-counter-postfix {color: {{prepostColor}};}", + }, + ], + }, + prepostSpacing: { + type: "string", + default: "", + style: [ + { + selector: + "{{QUBELY}} .qubely-block-counter-prefix {margin-right: {{prepostSpacing}};} {{QUBELY}} .qubely-block-counter-postfix {margin-left: {{prepostSpacing}};}", + }, + ], + }, + counterTypo: { type: "object", default: {}, style: [{ selector: "{{QUBELY}} .qubely-block-counter-content" }] }, + counterColor: { + type: "string", + default: "", + style: [{ selector: "{{QUBELY}} .qubely-block-counter-content {color: {{counterColor}};}" }], + }, + sourceOfCopiedStyle: { type: "boolean", default: false }, + }, + edit: Edit, + save: Save, }); diff --git a/assets/reactjs/src/blocks/divider/Edit.js b/assets/reactjs/src/blocks/divider/Edit.js index f142a1f9..1efd02e2 100644 --- a/assets/reactjs/src/blocks/divider/Edit.js +++ b/assets/reactjs/src/blocks/divider/Edit.js @@ -1,207 +1,238 @@ const { __ } = wp.i18n; -const { InspectorControls, BlockControls } = wp.blockEditor +const { InspectorControls, BlockControls } = wp.blockEditor; const { Component, Fragment, createRef } = wp.element; const { PanelBody, Toolbar, Tooltip, Dropdown } = wp.components; const { - Alignment, - Range, - Color, - ContextMenu: { ContextMenu, handleContextMenu }, - gloalSettings: { - globalSettingsPanel, - animationSettings, - interactionSettings - }, - Inline: { InlineToolbar }, - withCSSGenerator, - InspectorTabs, - InspectorTab -} = wp.qubelyComponents + Alignment, + Range, + Color, + ContextMenu: { ContextMenu, handleContextMenu }, + gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, + Inline: { InlineToolbar }, + withCSSGenerator, + InspectorTabs, + InspectorTab, +} = wp.qubelyComponents; -import icons from '../divider/icon' -const dividerOptions = ['fill', 'dot', 'dash', 'branch', 'dashes', 'leaf', 'line1', 'line2', 'line3', 'line4', 'line5', 'line6', 'line7', 'line8', 'line9', 'line10', 'line11', 'line12', 'line13', 'liner', 'mustache', 'shadow', 'slash', 'spring', 'valla', 'wave1', 'wave2', 'wave3'] +import icons from "../divider/icon"; +const dividerOptions = [ + "fill", + "dot", + "dash", + "branch", + "dashes", + "leaf", + "line1", + "line2", + "line3", + "line4", + "line5", + "line6", + "line7", + "line8", + "line9", + "line10", + "line11", + "line12", + "line13", + "liner", + "mustache", + "shadow", + "slash", + "spring", + "valla", + "wave1", + "wave2", + "wave3", +]; class Edit extends Component { + constructor(props) { + super(props); + this.state = { + device: "md", + isOpen: false, + spacer: true, + }; + this.qubelyContextMenu = createRef(); + } - constructor(props) { - super(props); - this.state = { - device: 'md', - isOpen: false, - spacer: true - }; - this.qubelyContextMenu = createRef(); - } + renderDividerOptions = () => { + const { setAttributes } = this.props; + return ( +
    +
      + {dividerOptions.map((item, index) => ( +
    • { + setAttributes({ style: item }); + }} + > + {icons[item]} +
    • + ))} +
    +
    + ); + }; - componentDidMount() { - const { setAttributes, clientId, attributes: { uniqueId } } = this.props - const _client = clientId.substr(0, 6) - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - } - renderDividerOptions = () => { - const { setAttributes } = this.props - return ( -
    -
      - {dividerOptions.map((item, index) => ( -
    • { setAttributes({ style: item }) }}> - {icons[item]} -
    • - ) - )} -
    -
    - ) - } + render() { + const { + name, + clientId, + attributes, + isSelected, + setAttributes, + attributes: { + uniqueId, + className, + color, + height, + width, + alignment, + style, + animation, + globalZindex, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + hideTablet, + hideMobile, + globalCss, + interaction, + }, + } = this.props; - render() { - const { - name, - clientId, - attributes, - isSelected, - setAttributes, - attributes: { - uniqueId, - className, - color, - height, - width, - alignment, - style, - animation, - globalZindex, - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - hideTablet, - hideMobile, - globalCss, - interaction - } - } = this.props + const { device } = this.state; + return ( + + + + + + ( +
    + +
    + )} + renderContent={() => this.renderDividerOptions()} + /> + setAttributes({ alignment: val })} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> +
    - const { device } = this.state; - return ( - - - - - - -
    - -
    - } - renderContent={() => this.renderDividerOptions()} - /> - setAttributes({ alignment: val })} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} /> -
    + + setAttributes({ color: val })} + /> + setAttributes({ height: val })} + min={0} + max={15} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ width: val })} + min={0} + max={1000} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + +
    + + {animationSettings(uniqueId, animation, setAttributes)} + {interactionSettings(uniqueId, interaction, setAttributes)} + +
    +
    - - setAttributes({ color: val })} /> - setAttributes({ height: val })} - min={0} - max={15} - unit={['px', 'em', '%']} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ width: val })} - min={0} - max={1000} - unit={['px', 'em', '%']} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} /> - -
    - - {animationSettings(uniqueId, animation, setAttributes)} - {interactionSettings(uniqueId, interaction, setAttributes)} - -
    -
    + + + + + - - - - - + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} - -
    handleContextMenu(event, this.qubelyContextMenu.current)} - > - -
    - {((style == 'fill') || (style == 'dot') || (style == 'dash')) ? -
    - : - icons[style] - } -
    - } - renderContent={() => this.renderDividerOptions()} - /> -
    - -
    -
    - - ); - } +
    handleContextMenu(event, this.qubelyContextMenu.current)} + > + ( +
    + {style == "fill" || style == "dot" || style == "dash" ? ( +
    + ) : ( + icons[style] + )} +
    + )} + renderContent={() => this.renderDividerOptions()} + /> +
    + +
    +
    + + ); + } } -export default withCSSGenerator()(Edit); \ No newline at end of file +export default withCSSGenerator()(Edit); diff --git a/assets/reactjs/src/blocks/divider/Save.js b/assets/reactjs/src/blocks/divider/Save.js index d8ea7760..1871b08f 100644 --- a/assets/reactjs/src/blocks/divider/Save.js +++ b/assets/reactjs/src/blocks/divider/Save.js @@ -1,22 +1,24 @@ -import icons from '../divider/icon'; +import icons from "../divider/icon"; const { Component } = wp.element; -const { HelperFunction: { animationAttr, IsInteraction } } = wp.qubelyComponents +const { + HelperFunction: { animationAttr, IsInteraction }, +} = wp.qubelyComponents; class Save extends Component { - render() { - const { uniqueId, style, animation, interaction } = this.props.attributes - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - return ( -
    -
    - { ((style == 'fill') || (style == 'dot') || (style == 'dash')) ? -
    - : - icons[style] - } -
    -
    - ) - } + render() { + const { uniqueId, style, animation, interaction } = this.props.attributes; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + return ( +
    +
    + {style == "fill" || style == "dot" || style == "dash" ? ( +
    + ) : ( + icons[style] + )} +
    +
    + ); + } } -export default Save \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/divider/editor.scss b/assets/reactjs/src/blocks/divider/editor.scss index c3780be7..4181cc0f 100644 --- a/assets/reactjs/src/blocks/divider/editor.scss +++ b/assets/reactjs/src/blocks/divider/editor.scss @@ -2,24 +2,24 @@ z-index: 6; } .qubely-divider-block { - display: inline-block; - position: relative; - width: 100%; - &:before { - content: ""; + display: inline-block; + position: relative; + width: 100%; + &:before { + content: ""; position: absolute; left: 0; width: 100%; height: 2px; background: #e5e5e5; top: 50%; - } - .qubely-divider-withicon { + } + .qubely-divider-withicon { position: relative; .qubely-divider-icon { position: absolute; i { - font-style: normal; + font-style: normal; color: #fff; width: 27px; height: 27px; @@ -30,8 +30,8 @@ font-size: 14px; } } - } - .qubely-divider-withimg { + } + .qubely-divider-withimg { position: relative; .qubely-divider-img { vertical-align: middle; @@ -40,23 +40,23 @@ width: 30px; height: 30px; } - } - .qubely-divider-withtext { - position: relative; - .qubely-divider-text{ + } + .qubely-divider-withtext { + position: relative; + .qubely-divider-text { text-transform: uppercase; background: #fff; padding: 0 10px; position: absolute; } - } - .qubely-divider-center { + } + .qubely-divider-center { .qubely-divider-text, .qubely-divider-img, .qubely-divider-icon { left: 50%; top: 50%; - transform: translate(-50%,-50%); + transform: translate(-50%, -50%); } } .qubely-divider-left { @@ -77,4 +77,4 @@ transform: translate(0, -50%); } } -} \ No newline at end of file +} diff --git a/assets/reactjs/src/blocks/divider/icon.js b/assets/reactjs/src/blocks/divider/icon.js index b5a67dfc..8b1dff5d 100644 --- a/assets/reactjs/src/blocks/divider/icon.js +++ b/assets/reactjs/src/blocks/divider/icon.js @@ -1,31 +1,222 @@ const icons = {}; -icons.fill = ; -icons.dot = ; -icons.dash = -icons.branch = -icons.dashes = -icons.leaf = -icons.line1 = -icons.line2 = -icons.line3 = -icons.line4 = -icons.line5 = -icons.line6 = -icons.line7 = -icons.line8 = -icons.line9 = -icons.line10 = -icons.line11 = -icons.line12 = -icons.line13 = -icons.liner = -icons.mustache = -icons.shadow = -icons.slash = -icons.spring = -icons.valla = -icons.wave1 = -icons.wave2 = -icons.wave3 = ; -export default icons; \ No newline at end of file +icons.fill = ( + + + +); +icons.dot = ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); +icons.dash = ( + + + +); +icons.branch = ( + + + +); +icons.dashes = ( + + + + + + + + + + +); +icons.leaf = ( + + + +); +icons.line1 = ( + + + +); +icons.line2 = ( + + + + + + +); +icons.line3 = ( + + + +); +icons.line4 = ( + + + +); +icons.line5 = ( + + + + +); +icons.line6 = ( + + + + +); +icons.line7 = ( + + + + +); +icons.line8 = ( + + + +); +icons.line9 = ( + + + +); +icons.line10 = ( + + + + + +); +icons.line11 = ( + + + +); +icons.line12 = ( + + + + + +); +icons.line13 = ( + + + +); +icons.liner = ( + + + +); +icons.mustache = ( + + + + +); +icons.shadow = ( + + + +); +icons.slash = ( + + + + + +); +icons.spring = ( + + + + +); +icons.valla = ( + + + +); +icons.wave1 = ( + + + +); +icons.wave2 = ( + + + +); +icons.wave3 = ( + + + +); +export default icons; diff --git a/assets/reactjs/src/blocks/divider/index.js b/assets/reactjs/src/blocks/divider/index.js index b74c064c..030d77d1 100644 --- a/assets/reactjs/src/blocks/divider/index.js +++ b/assets/reactjs/src/blocks/divider/index.js @@ -1,33 +1,65 @@ -import './style.scss' -import Edit from './Edit' -import Save from './Save'; -const { __ } = wp.i18n -const { registerBlockType } = wp.blocks -const { gloalSettings: { globalAttributes } } = wp.qubelyComponents +import "./style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +const { __ } = wp.i18n; +const { registerBlockType } = wp.blocks; +const { + gloalSettings: { globalAttributes }, +} = wp.qubelyComponents; -registerBlockType ( 'qubely/divider', { - title: __( 'Divider' ), - description: 'Use beautiful pre-designed dividers with Qubely Divider.', - icon: {__('Divider, - category: 'qubely', - keywords: [ __( 'Divider' ), __( 'Separator' ) ], - supports: { - align: ['center', 'wide', 'full'], - }, - example: { - attributes: {}, - }, - attributes: { - uniqueId:{ type: 'string', default: '' }, - ...globalAttributes, - spacer: { type: 'object', default:{spaceTop: { md: '10', unit: "px"}, spaceBottom: { md: '10', unit: "px"}}, style: [{ selector: '{{QUBELY}}' }] }, - style: { type: 'string', default: 'slash' }, - color: { type: 'string', default: '#252525', style: [{ selector: '{{QUBELY}} .qubely-block-divider > div { border-top-color: {{color}}; } {{QUBELY}} .qubely-block-divider path { fill: {{color}}; } {{QUBELY}} .qubely-block-divider circle { stroke: {{color}}; } {{QUBELY}} .qubely-block-divider ellipse { stroke: {{color}}; fill: {{color}}; }' }] }, - height: { type: 'object', default: {md: '2', unit: 'px'}, style: [{ selector: '{{QUBELY}} .qubely-block-divider > div { border-top-width: {{height}};}' }] }, - width: { type: 'object', default: {md: '280', unit: 'px'}, style: [{ selector: '{{QUBELY}} .qubely-block-divider > div { width: {{width}};} {{QUBELY}} .qubely-block-divider svg { width: {{width}};}' }] }, - alignment: { type: 'object', default: {md: 'center'}, style: [{ selector: '{{QUBELY}} {text-align: {{alignment}};}' }]}, - sourceOfCopiedStyle: { type: 'boolean', default: false } - }, - edit: Edit, - save: Save, +registerBlockType("qubely/divider", { + title: __("Divider"), + description: "Use beautiful pre-designed dividers with Qubely Divider.", + icon: {__("Divider, + category: "qubely", + keywords: [__("Divider"), __("Separator")], + supports: { + align: ["center", "wide", "full"], + }, + example: { + attributes: {}, + }, + attributes: { + uniqueId: { type: "string", default: "" }, + ...globalAttributes, + spacer: { + type: "object", + default: { spaceTop: { md: "10", unit: "px" }, spaceBottom: { md: "10", unit: "px" } }, + style: [{ selector: "{{QUBELY}}" }], + }, + style: { type: "string", default: "slash" }, + color: { + type: "string", + default: "#252525", + style: [ + { + selector: + "{{QUBELY}} .qubely-block-divider > div { border-top-color: {{color}}; } {{QUBELY}} .qubely-block-divider path { fill: {{color}}; } {{QUBELY}} .qubely-block-divider circle { stroke: {{color}}; } {{QUBELY}} .qubely-block-divider ellipse { stroke: {{color}}; fill: {{color}}; }", + }, + ], + }, + height: { + type: "object", + default: { md: "2", unit: "px" }, + style: [{ selector: "{{QUBELY}} .qubely-block-divider > div { border-top-width: {{height}};}" }], + }, + width: { + type: "object", + default: { md: "280", unit: "px" }, + style: [ + { + selector: + "{{QUBELY}} .qubely-block-divider > div { width: {{width}};} {{QUBELY}} .qubely-block-divider svg { width: {{width}};}", + }, + ], + }, + alignment: { + type: "object", + default: { md: "center" }, + style: [{ selector: "{{QUBELY}} {text-align: {{alignment}};}" }], + }, + sourceOfCopiedStyle: { type: "boolean", default: false }, + }, + edit: Edit, + save: Save, }); diff --git a/assets/reactjs/src/blocks/divider/style.scss b/assets/reactjs/src/blocks/divider/style.scss index ea40aa80..5d647cbb 100644 --- a/assets/reactjs/src/blocks/divider/style.scss +++ b/assets/reactjs/src/blocks/divider/style.scss @@ -1,56 +1,56 @@ .qubely-block-divider { - display: inline-block; - .qubely-block-divider-style-fill { - border-top-style: solid; - } - .qubely-block-divider-style-dot { - border-top-style: dotted; - } - .qubely-block-divider-style-dash { - border-top-style: dashed; - } - > div { - margin: 0 auto; - display: inline-block; - } - .divider-options-trigger { - display: block; - width: 100%; - margin: 0px; - padding: 0px; - color: inherit; - background: none; - box-shadow: none; - border: none; - outline: none; - cursor: pointer; - font: inherit; - &:focus { - outline: none !important; - } - } + display: inline-block; + .qubely-block-divider-style-fill { + border-top-style: solid; + } + .qubely-block-divider-style-dot { + border-top-style: dotted; + } + .qubely-block-divider-style-dash { + border-top-style: dashed; + } + > div { + margin: 0 auto; + display: inline-block; + } + .divider-options-trigger { + display: block; + width: 100%; + margin: 0px; + padding: 0px; + color: inherit; + background: none; + box-shadow: none; + border: none; + outline: none; + cursor: pointer; + font: inherit; + &:focus { + outline: none !important; + } + } } .qubely-divider-picker-options { - max-height: 300px; + max-height: 300px; } .qubely-divider-picker-option:hover { - background: #e8eaeb; - border-radius: 5px; + background: #e8eaeb; + border-radius: 5px; } .qubely-divider-picker.backend { - display: inline-block; + display: inline-block; } .components-panel__body { - .qubely-divider-picker { - width: 100%; - button { - cursor: pointer; - color: inherit; - } - } + .qubely-divider-picker { + width: 100%; + button { + cursor: pointer; + color: inherit; + } + } } .qubely-divider-picker-content .components-popover__content > div { - width: 250px; + width: 250px; } diff --git a/assets/reactjs/src/blocks/heading/Edit.js b/assets/reactjs/src/blocks/heading/Edit.js index ca6cc6ae..f0adcd30 100644 --- a/assets/reactjs/src/blocks/heading/Edit.js +++ b/assets/reactjs/src/blocks/heading/Edit.js @@ -1,283 +1,400 @@ -const { __ } = wp.i18n +const { __ } = wp.i18n; const { Fragment, Component, createRef } = wp.element; -const { PanelBody, Toolbar, SelectControl } = wp.components -const { RichText, InspectorControls, BlockControls } = wp.blockEditor +const { PanelBody, Toolbar, SelectControl } = wp.components; +const { RichText, InspectorControls, BlockControls } = wp.blockEditor; const { - Color, - Typography, - Alignment, - Range, - Toggle, - Headings, - RadioAdvanced, - gloalSettings: { - globalSettingsPanel, - animationSettings, - interactionSettings - }, - HeadingToolbar, - Inline: { - InlineToolbar, - InlineSelector - }, - ContextMenu: { - ContextMenu, - handleContextMenu - }, - withCSSGenerator, - InspectorTabs, - InspectorTab, - InspectorSections + Color, + Typography, + Alignment, + Range, + Toggle, + Headings, + RadioAdvanced, + gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, + HeadingToolbar, + Inline: { InlineToolbar, InlineSelector }, + ContextMenu: { ContextMenu, handleContextMenu }, + withCSSGenerator, + InspectorTabs, + InspectorTab, + InspectorSections, } = wp.qubelyComponents; -import svg from '../heading/separators' +import svg from "../heading/separators"; class Edit extends Component { - constructor() { - super(...arguments); - this.state = { - device: 'md', - selector: true, - spacer: true - }; - this.qubelyContextMenu = createRef(); - } + constructor() { + super(...arguments); + this.state = { + device: "md", + selector: true, + spacer: true, + }; + this.qubelyContextMenu = createRef(); + } - componentDidMount() { - const { setAttributes, clientId, attributes: { uniqueId } } = this.props - const _client = clientId.substr(0, 6) - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - } + render() { + const { + name, + clientId, + isSelected, + attributes, + setAttributes, + attributes: { + uniqueId, + className, + recreateStyles, + content, + typography, + alignment, + selector, + level, + textColor, - render() { - const { - name, - clientId, - isSelected, - attributes, - setAttributes, - attributes: { - uniqueId, - className, - recreateStyles, - content, - typography, - alignment, - selector, - level, - textColor, + separatorStyle, + separatorColor, + separatorStroke, + separatorPosition, + separatorWidth, + separatorSpacing, - separatorStyle, - separatorColor, - separatorStroke, - separatorPosition, - separatorWidth, - separatorSpacing, + subHeading, + subHeadingLevel, + subHeadingContent, + subHeadingTypography, + subHeadingColor, + subHeadingSpacing, + subHeadingPosition, - subHeading, - subHeadingLevel, - subHeadingContent, - subHeadingTypography, - subHeadingColor, - subHeadingSpacing, - subHeadingPosition, + animation, + globalZindex, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + hideTablet, + hideMobile, + globalCss, + interaction, + }, + } = this.props; - animation, - globalZindex, - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - hideTablet, - hideMobile, - globalCss, - interaction - } - } = this.props + const { device } = this.state; - const { device } = this.state + const separators = { + solid: { type: "css", separator: "solid", width: 300, stroke: 10 }, + double: { type: "css", separator: "double", width: 300, stroke: 10 }, + dotted: { type: "css", separator: "dotted", width: 300, stroke: 10 }, + dashed: { type: "css", separator: "dashed", width: 300, stroke: 10 }, + pin: { type: "svg", separator: "pin", svg: svg["pin"], width: 100, stroke: 0 }, + pin_filled: { type: "svg", separator: "pin_filled", svg: svg["pin_filled"], width: 100, stroke: 0 }, + zigzag: { type: "svg", separator: "zigzag", svg: svg["zigzag"], style: "fill", width: 88, stroke: 5 }, + zigzag_large: { + type: "svg", + separator: "zigzag_large", + svg: svg["zigzag_large"], + style: "fill", + width: 161, + stroke: 5, + }, + }; - const separators = { - solid: { type: 'css', separator: 'solid', width: 300, stroke: 10 }, - double: { type: 'css', separator: 'double', width: 300, stroke: 10 }, - dotted: { type: 'css', separator: 'dotted', width: 300, stroke: 10 }, - dashed: { type: 'css', separator: 'dashed', width: 300, stroke: 10 }, - pin: { type: 'svg', separator: 'pin', svg: svg['pin'], width: 100, stroke: 0 }, - pin_filled: { type: 'svg', separator: 'pin_filled', svg: svg['pin_filled'], width: 100, stroke: 0 }, - zigzag: { type: 'svg', separator: 'zigzag', svg: svg['zigzag'], style: 'fill', width: 88, stroke: 5 }, - zigzag_large: { type: 'svg', separator: 'zigzag_large', svg: svg['zigzag_large'], style: 'fill', width: 161, stroke: 5 }, - } + const subHeadingTagName = "h" + subHeadingLevel; - const subHeadingTagName = 'h' + subHeadingLevel; + const renderSeparators = ( + + {separatorStyle && ( + + {separators[separatorStyle].type == "css" && ( + + )} + {separators[separatorStyle].type == "svg" && ( + + {separators[separatorStyle].svg} + + )} + + )} + + ); - const renderSeparators = - {separatorStyle && - - {separators[separatorStyle].type == 'css' && - - } - {separators[separatorStyle].type == 'svg' && - {separators[separatorStyle].svg} - } - - } - + return ( + + + + + + + + + setAttributes({ alignment: val })} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ textColor: val })} + /> + + setAttributes({ + typography: val, + ...(val.openTypography !== typography.openTypography && { + recreateStyles: !recreateStyles, + }), + }) + } + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ subHeading: val })} + /> + {subHeading == 1 && ( + + setAttributes({ subHeadingLevel: value })} + /> + + setAttributes({ + subHeadingTypography: val, + ...(val.openTypography !== subHeadingTypography.openTypography && { + recreateStyles: !recreateStyles, + }), + }) + } + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ subHeadingColor: val })} + /> + setAttributes({ subHeadingSpacing: value })} + unit={["px", "em", "%"]} + min={0} + max={60} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ subHeadingPosition: val })} + options={[ + { + label: __("After Title"), + value: "after_title", + title: __("After Title"), + }, + { + label: __("Before Title"), + value: "before_title", + title: __("Before Title"), + }, + ]} + /> + + )} + + + setAttributes({ separatorStyle: val })} + /> + {separatorStyle && ( + + setAttributes({ separatorColor: val })} + /> + {separatorStyle != "pin" && separatorStyle != "pin_filled" && ( + setAttributes({ separatorStroke: parseInt(val) })} + min={1} + max={separators[separatorStyle].stroke} + /> + )} + setAttributes({ separatorWidth: val })} + min={20} + max={separators[separatorStyle].width} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ separatorSpacing: val })} + min={0} + max={100} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ separatorPosition: val })} + /> + + )} + + + + {animationSettings(uniqueId, animation, setAttributes)} + {interactionSettings(uniqueId, interaction, setAttributes)} + + + - return ( - - - - - - - - - setAttributes({ alignment: val })} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - setAttributes({ textColor: val })} /> - setAttributes({ typography: val, ...((val.openTypography !== typography.openTypography) && { recreateStyles: !recreateStyles }) })} device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - setAttributes({ subHeading: val })} /> - {subHeading == 1 && - - setAttributes({ subHeadingLevel: value })} /> - setAttributes({ subHeadingTypography: val, ...((val.openTypography !== subHeadingTypography.openTypography) && { recreateStyles: !recreateStyles }) })} device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ subHeadingColor: val })} /> - setAttributes({ subHeadingSpacing: value })} unit={['px', 'em', '%']} min={0} max={60} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ subHeadingPosition: val })} - options={[ - { label: __('After Title'), value: 'after_title', title: __('After Title') }, - { label: __('Before Title'), value: 'before_title', title: __('Before Title') } - ]} - /> - - } - - - setAttributes({ separatorStyle: val })} - /> - {separatorStyle && - - setAttributes({ separatorColor: val })} - /> - {(separatorStyle != 'pin' && separatorStyle != 'pin_filled') && - setAttributes({ separatorStroke: parseInt(val) })} min={1} max={separators[separatorStyle].stroke} /> - } - setAttributes({ separatorWidth: val })} min={20} max={separators[separatorStyle].width} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ separatorSpacing: val })} min={0} max={100} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ separatorPosition: val })} - /> - - } - - - - {animationSettings(uniqueId, animation, setAttributes)} - {interactionSettings(uniqueId, interaction, setAttributes)} - - - + + setAttributes({ level: newLevel, selector: `h${newLevel}` })} + /> + + + + - - setAttributes({ level: newLevel, selector: `h${newLevel}` })} /> - - - - + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} - -
    -
    handleContextMenu(event, this.qubelyContextMenu.current)} - className={`qubely-block-heading ${separatorStyle ? 'qubely-has-separator qubely-separator-position-' + separatorPosition : ''}`}> - {(subHeading == 1 && subHeadingPosition == 'before_title') && - setAttributes({ subHeadingContent: value })} - value={subHeadingContent} /> - } -
    - {separatorStyle !== '' && (separatorPosition == 'left' || separatorPosition == 'top' || separatorPosition == 'leftright') ?
    {renderSeparators}
    : ''} - setAttributes({ content: value })} - value={content} - /> - {separatorStyle != '' && (separatorPosition == 'right' || separatorPosition == 'bottom' || separatorPosition == 'leftright') ?
    {renderSeparators}
    : ''} -
    - {(subHeading == 1 && subHeadingPosition == 'after_title') && - setAttributes({ subHeadingContent: value })} - value={subHeadingContent} /> - } -
    - -
    -
    -
    - -
    - ) - } +
    +
    handleContextMenu(event, this.qubelyContextMenu.current)} + className={`qubely-block-heading ${ + separatorStyle ? "qubely-has-separator qubely-separator-position-" + separatorPosition : "" + }`} + > + {subHeading == 1 && subHeadingPosition == "before_title" && ( + setAttributes({ subHeadingContent: value })} + value={subHeadingContent} + /> + )} +
    + {separatorStyle !== "" && + (separatorPosition == "left" || + separatorPosition == "top" || + separatorPosition == "leftright") ? ( +
    {renderSeparators}
    + ) : ( + "" + )} + setAttributes({ content: value })} + value={content} + /> + {separatorStyle != "" && + (separatorPosition == "right" || + separatorPosition == "bottom" || + separatorPosition == "leftright") ? ( +
    {renderSeparators}
    + ) : ( + "" + )} +
    + {subHeading == 1 && subHeadingPosition == "after_title" && ( + setAttributes({ subHeadingContent: value })} + value={subHeadingContent} + /> + )} +
    + +
    +
    +
    +
    + ); + } } -export default withCSSGenerator()(Edit); \ No newline at end of file +export default withCSSGenerator()(Edit); diff --git a/assets/reactjs/src/blocks/heading/Save.js b/assets/reactjs/src/blocks/heading/Save.js index fda70d52..8d06af5b 100644 --- a/assets/reactjs/src/blocks/heading/Save.js +++ b/assets/reactjs/src/blocks/heading/Save.js @@ -1,64 +1,101 @@ const { Fragment, Component } = wp.element; -const { RichText } = wp.blockEditor -import svg from '../heading/separators'; -const { HelperFunction: { animationAttr, IsInteraction } } = wp.qubelyComponents +const { RichText } = wp.blockEditor; +import svg from "../heading/separators"; +const { + HelperFunction: { animationAttr, IsInteraction }, +} = wp.qubelyComponents; class Save extends Component { + renderSeparators = () => { + const { + attributes: { separatorStyle }, + } = this.props; + const separators = { + solid: { type: "css", separator: "solid", width: 300, stroke: 10 }, + double: { type: "css", separator: "double", width: 300, stroke: 10 }, + dotted: { type: "css", separator: "dotted", width: 300, stroke: 10 }, + dashed: { type: "css", separator: "dashed", width: 300, stroke: 10 }, + pin: { type: "svg", separator: "pin", svg: svg["pin"], width: 100, stroke: 0 }, + pin_filled: { type: "svg", separator: "pin_filled", svg: svg["pin_filled"], width: 100, stroke: 0 }, + zigzag: { type: "svg", separator: "zigzag", svg: svg["zigzag"], style: "fill", width: 88, stroke: 5 }, + zigzag_large: { + type: "svg", + separator: "zigzag_large", + svg: svg["zigzag_large"], + style: "fill", + width: 161, + stroke: 5, + }, + }; + return ( + + {separators[separatorStyle].type == "css" && ( + + )} + {separators[separatorStyle].type == "svg" && ( + + {separators[separatorStyle].svg} + + )} + + ); + }; + rendeSubHeading = () => { + const { subHeading, subHeadingLevel, subHeadingContent } = this.props.attributes; - renderSeparators = () => { - const { attributes: { separatorStyle } } = this.props - const separators = { - solid: { type: 'css', separator: 'solid', width: 300, stroke: 10 }, - double: { type: 'css', separator: 'double', width: 300, stroke: 10 }, - dotted: { type: 'css', separator: 'dotted', width: 300, stroke: 10 }, - dashed: { type: 'css', separator: 'dashed', width: 300, stroke: 10 }, - pin: { type: 'svg', separator: 'pin', svg: svg['pin'], width: 100, stroke: 0 }, - pin_filled: { type: 'svg', separator: 'pin_filled', svg: svg['pin_filled'], width: 100, stroke: 0 }, - zigzag: { type: 'svg', separator: 'zigzag', svg: svg['zigzag'], style: 'fill', width: 88, stroke: 5 }, - zigzag_large: { type: 'svg', separator: 'zigzag_large', svg: svg['zigzag_large'], style: 'fill', width: 161, stroke: 5 }, - } - return ( - - {separators[separatorStyle].type == 'css' && - - } - {separators[separatorStyle].type == 'svg' && - {separators[separatorStyle].svg} - } - - ) - } - rendeSubHeading = () => { - const { subHeading, subHeadingLevel, subHeadingContent } = this.props.attributes + if (subHeading) { + const subSubTagName = "h" + subHeadingLevel; + return ( + + ); + } else return null; + }; - if (subHeading) { - const subSubTagName = 'h' + subHeadingLevel; - return ( - - ) - } else return null - } - - - render() { - const { uniqueId, content, selector, separatorStyle, separatorPosition, subHeadingPosition, animation, interaction } = this.props.attributes - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - return ( -
    -
    - {subHeadingPosition == 'before_title' && this.rendeSubHeading()} -
    - {(separatorStyle && (separatorPosition == 'left' || separatorPosition == 'top' || separatorPosition == 'leftright')) &&
    {this.renderSeparators()}
    } - - {(separatorStyle && (separatorPosition == 'right' || separatorPosition == 'bottom' || separatorPosition == 'leftright')) &&
    {this.renderSeparators()}
    } -
    - {subHeadingPosition == 'after_title' && this.rendeSubHeading()} -
    -
    - ) - } + render() { + const { + uniqueId, + content, + selector, + separatorStyle, + separatorPosition, + subHeadingPosition, + animation, + interaction, + } = this.props.attributes; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + return ( +
    +
    + {subHeadingPosition == "before_title" && this.rendeSubHeading()} +
    + {separatorStyle && + (separatorPosition == "left" || + separatorPosition == "top" || + separatorPosition == "leftright") && ( +
    + {this.renderSeparators()} +
    + )} + + {separatorStyle && + (separatorPosition == "right" || + separatorPosition == "bottom" || + separatorPosition == "leftright") && ( +
    {this.renderSeparators()}
    + )} +
    + {subHeadingPosition == "after_title" && this.rendeSubHeading()} +
    +
    + ); + } } -export default Save \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/heading/index.js b/assets/reactjs/src/blocks/heading/index.js index 09c215af..e9eb7706 100644 --- a/assets/reactjs/src/blocks/heading/index.js +++ b/assets/reactjs/src/blocks/heading/index.js @@ -1,175 +1,189 @@ -import './style.scss' -import Edit from './Edit' -import Save from './Save'; -const { __ } = wp.i18n -const { registerBlockType } = wp.blocks -const { gloalSettings: { globalAttributes } } = wp.qubelyComponents +import "./style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +const { __ } = wp.i18n; +const { registerBlockType } = wp.blocks; +const { + gloalSettings: { globalAttributes }, +} = wp.qubelyComponents; -registerBlockType('qubely/heading', { - title: __('Heading'), - description: 'Make headlines/titles that attract users with Qubely Heading.', - category: 'qubely', - icon: {__('Heading, +registerBlockType("qubely/heading", { + title: __("Heading"), + description: "Make headlines/titles that attract users with Qubely Heading.", + category: "qubely", + icon: {__("Heading, supports: { - align: ['center', 'wide', 'full'], - anchor: true + align: ["center", "wide", "full"], + anchor: true, }, - keywords: [__('heading'), __('head'), __('title')], + keywords: [__("heading"), __("head"), __("title")], example: { attributes: { - content: __('Make headlines/titles that attract users with Qubely Heading.', 'qubely') + content: __("Make headlines/titles that attract users with Qubely Heading.", "qubely"), }, }, attributes: { - uniqueId: { type: 'string', default: '' }, + uniqueId: { type: "string", default: "" }, ...globalAttributes, recreateStyles: { - type: 'boolean', - default: true + type: "boolean", + default: true, + }, + spacer: { + type: "object", + default: { spaceTop: { md: "10", unit: "px" }, spaceBottom: { md: "10", unit: "px" } }, + style: [{ selector: "{{QUBELY}}" }], }, - spacer: { type: 'object', default: { spaceTop: { md: '10', unit: "px" }, spaceBottom: { md: '10', unit: "px" } }, style: [{ selector: '{{QUBELY}}' }] }, content: { - type: 'string', - source: 'html', - selector: '.qubely-heading-selector', - default: 'Qubely - A Full-fledged Gutenberg Builder' + type: "string", + source: "html", + selector: ".qubely-heading-selector", + default: "Qubely - A Full-fledged Gutenberg Builder", }, alignment: { - type: 'object', + type: "object", default: {}, - style: [ - { selector: '{{QUBELY}}{text-align: {{alignment}}; }' } - ], + style: [{ selector: "{{QUBELY}}{text-align: {{alignment}}; }" }], }, typography: { - type: 'object', - default: { openTypography: 1, size: { md: 24, unit: 'px' } }, - style: [{ selector: '{{QUBELY}} .qubely-block-heading .qubely-heading-selector' }] + type: "object", + default: { openTypography: 1, size: { md: 24, unit: "px" } }, + style: [{ selector: "{{QUBELY}} .qubely-block-heading .qubely-heading-selector" }], }, separatorStyle: { - type: 'string', - default: '', + type: "string", + default: "", style: [ { - condition: [{ key: 'separatorStyle', relation: '!=', value: '' }], - selector: '{{QUBELY}} .qubely-block-heading .qubely-separator-type-css {border-top-style: {{separatorStyle}};}' - } + condition: [{ key: "separatorStyle", relation: "!=", value: "" }], + selector: + "{{QUBELY}} .qubely-block-heading .qubely-separator-type-css {border-top-style: {{separatorStyle}};}", + }, ], }, - separatorPosition: { type: 'string', default: 'top' }, + separatorPosition: { type: "string", default: "top" }, separatorColor: { - type: 'string', - default: '#5D7FEB', + type: "string", + default: "#5D7FEB", style: [ { - condition: [{ key: 'separatorStyle', relation: '!=', value: '' }], - selector: '{{QUBELY}} .qubely-block-heading .qubely-separator-type-svg svg .qubely-separator-stroke {stroke: {{separatorColor}};} {{QUBELY}} .qubely-block-heading svg .qubely-separator-fill {fill: {{separatorColor}};} {{QUBELY}} .qubely-block-heading .qubely-separator-type-css {border-top-color: {{separatorColor}};}' - } + condition: [{ key: "separatorStyle", relation: "!=", value: "" }], + selector: + "{{QUBELY}} .qubely-block-heading .qubely-separator-type-svg svg .qubely-separator-stroke {stroke: {{separatorColor}};} {{QUBELY}} .qubely-block-heading svg .qubely-separator-fill {fill: {{separatorColor}};} {{QUBELY}} .qubely-block-heading .qubely-separator-type-css {border-top-color: {{separatorColor}};}", + }, ], }, separatorStroke: { - type: 'number', + type: "number", default: 3, style: [ { - condition: [{ key: 'separatorStyle', relation: '!=', value: '' }], - selector: '{{QUBELY}} .qubely-block-heading .qubely-separator-type-svg svg .qubely-separator-stroke {stroke-width: {{separatorStroke}}px;} {{QUBELY}} .qubely-block-heading .qubely-separator-type-css {border-top-width: {{separatorStroke}}px;}' - } - ] + condition: [{ key: "separatorStyle", relation: "!=", value: "" }], + selector: + "{{QUBELY}} .qubely-block-heading .qubely-separator-type-svg svg .qubely-separator-stroke {stroke-width: {{separatorStroke}}px;} {{QUBELY}} .qubely-block-heading .qubely-separator-type-css {border-top-width: {{separatorStroke}}px;}", + }, + ], }, separatorWidth: { - type: 'object', + type: "object", default: { md: 60 }, style: [ { - condition: [{ key: 'separatorStyle', relation: '!=', value: '' }], - selector: '{{QUBELY}} .qubely-block-heading .qubely-separator-type-css {width: {{separatorWidth}}px;} {{QUBELY}} .qubely-block-heading .qubely-separator-type-svg svg {width: {{separatorWidth}}px;}' - } - ] + condition: [{ key: "separatorStyle", relation: "!=", value: "" }], + selector: + "{{QUBELY}} .qubely-block-heading .qubely-separator-type-css {width: {{separatorWidth}}px;} {{QUBELY}} .qubely-block-heading .qubely-separator-type-svg svg {width: {{separatorWidth}}px;}", + }, + ], }, separatorSpacing: { - type: 'object', + type: "object", default: { md: 10 }, style: [ { - condition: [{ key: 'separatorStyle', relation: '!=', value: '' }], - selector: '{{QUBELY}} .qubely-separator-position-left .qubely-separator {margin-right: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-position-right .qubely-separator {margin-left: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-position-leftright .qubely-separator-before {margin-right: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-position-leftright .qubely-separator-after {margin-left: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-position-top .qubely-separator {margin-bottom: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-position-bottom .qubely-separator {margin-top: {{separatorSpacing}}px;}' - } + condition: [{ key: "separatorStyle", relation: "!=", value: "" }], + selector: + "{{QUBELY}} .qubely-separator-position-left .qubely-separator {margin-right: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-position-right .qubely-separator {margin-left: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-position-leftright .qubely-separator-before {margin-right: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-position-leftright .qubely-separator-after {margin-left: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-position-top .qubely-separator {margin-bottom: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-position-bottom .qubely-separator {margin-top: {{separatorSpacing}}px;}", + }, ], }, - subHeading: { type: 'boolean', default: false }, - subHeadingLevel: { type: 'number', default: 3 }, + subHeading: { type: "boolean", default: false }, + subHeadingLevel: { type: "number", default: 3 }, subHeadingContent: { - type: 'string', - source: 'html', - selector: '.qubely-sub-heading-selector', - default: 'Sub Heading' + type: "string", + source: "html", + selector: ".qubely-sub-heading-selector", + default: "Sub Heading", }, subHeadingTypography: { - type: 'object', - default: { openTypography: 1, size: { md: 16, unit: 'px' } }, + type: "object", + default: { openTypography: 1, size: { md: 16, unit: "px" } }, style: [ { - selector: '{{QUBELY}} .qubely-block-heading .qubely-sub-heading-selector' - } + selector: "{{QUBELY}} .qubely-block-heading .qubely-sub-heading-selector", + }, ], }, subHeadingColor: { - type: 'string', default: '#333', + type: "string", + default: "#333", style: [ { - condition: [{ key: 'subHeading', relation: '==', value: 1 }], - selector: '{{QUBELY}} .qubely-block-heading .qubely-sub-heading-selector {color: {{subHeadingColor}};}' - } + condition: [{ key: "subHeading", relation: "==", value: 1 }], + selector: + "{{QUBELY}} .qubely-block-heading .qubely-sub-heading-selector {color: {{subHeadingColor}};}", + }, ], }, subHeadingPosition: { - type: 'string', - default: 'after_title', + type: "string", + default: "after_title", }, subHeadingSpacing: { - type: 'object', + type: "object", default: { md: 10, - unit: 'px' + unit: "px", }, style: [ { condition: [ - { key: 'subHeading', relation: '==', value: 1 }, - { key: 'subHeadingPosition', relation: '==', value: 'after_title' } + { key: "subHeading", relation: "==", value: 1 }, + { key: "subHeadingPosition", relation: "==", value: "after_title" }, ], - selector: '{{QUBELY}} .qubely-block-heading .qubely-sub-heading-selector {margin-top: {{subHeadingSpacing}};}' + selector: + "{{QUBELY}} .qubely-block-heading .qubely-sub-heading-selector {margin-top: {{subHeadingSpacing}};}", }, { condition: [ - { key: 'subHeading', relation: '==', value: 1 }, - { key: 'subHeadingPosition', relation: '==', value: 'before_title' } + { key: "subHeading", relation: "==", value: 1 }, + { key: "subHeadingPosition", relation: "==", value: "before_title" }, ], - selector: '{{QUBELY}} .qubely-block-heading .qubely-sub-heading-selector {margin-bottom: {{subHeadingSpacing}};}' - } + selector: + "{{QUBELY}} .qubely-block-heading .qubely-sub-heading-selector {margin-bottom: {{subHeadingSpacing}};}", + }, ], }, selector: { - type: 'string', - default: 'h2' + type: "string", + default: "h2", }, level: { - type: 'number', - default: 2 + type: "number", + default: 2, }, textColor: { - type: 'string', default: '', + type: "string", + default: "", style: [ { - selector: '{{QUBELY}} .qubely-block-heading .qubely-heading-selector { color:{{textColor}}; }' - } + selector: "{{QUBELY}} .qubely-block-heading .qubely-heading-selector { color:{{textColor}}; }", + }, ], }, - sourceOfCopiedStyle: { type: 'boolean', default: false } + sourceOfCopiedStyle: { type: "boolean", default: false }, }, edit: Edit, save: Save, -}); \ No newline at end of file +}); diff --git a/assets/reactjs/src/blocks/heading/separators.js b/assets/reactjs/src/blocks/heading/separators.js index ebb6a93e..426cf366 100644 --- a/assets/reactjs/src/blocks/heading/separators.js +++ b/assets/reactjs/src/blocks/heading/separators.js @@ -1,6 +1,38 @@ const separators = {}; -separators.zigzag = ; -separators.zigzag_large = ; -separators.pin_filled = ; -separators.pin = ; -export default separators; \ No newline at end of file +separators.zigzag = ( + + + +); +separators.zigzag_large = ( + + + +); +separators.pin_filled = ( + + + +); +separators.pin = ( + + + +); +export default separators; diff --git a/assets/reactjs/src/blocks/heading/style.scss b/assets/reactjs/src/blocks/heading/style.scss index c3ac3f64..ca52cf78 100644 --- a/assets/reactjs/src/blocks/heading/style.scss +++ b/assets/reactjs/src/blocks/heading/style.scss @@ -1,41 +1,47 @@ .qubely-block-heading { - transition: color 200ms ease-in-out, background-color 200ms ease-in-out, border-color 200ms ease-in-out, box-shadow 200ms ease-in-out; - position: relative; - h1, h2, h3, h4, h5, h6 { - padding: 0; - margin: 0; - line-height: 1; - position: relative; - &::before, - &::after { - display: none !important; - } - } + transition: color 200ms ease-in-out, background-color 200ms ease-in-out, border-color 200ms ease-in-out, + box-shadow 200ms ease-in-out; + position: relative; + h1, + h2, + h3, + h4, + h5, + h6 { + padding: 0; + margin: 0; + line-height: 1; + position: relative; + &::before, + &::after { + display: none !important; + } + } - .qubely-text-has-bgcolor { - padding-left: 10px; - padding-right: 10px; - } + .qubely-text-has-bgcolor { + padding-left: 10px; + padding-right: 10px; + } - .qubely-separator { - font-size: 0; - .qubely-separator-type-css, - .qubely-separator-type-svg { - display: inline-block; - } - } + .qubely-separator { + font-size: 0; + .qubely-separator-type-css, + .qubely-separator-type-svg { + display: inline-block; + } + } - &.qubely-separator-position-left, - &.qubely-separator-position-right, - &.qubely-separator-position-leftright { - .qubely-heading-container { - display: inline-flex; - align-items: center; + &.qubely-separator-position-left, + &.qubely-separator-position-right, + &.qubely-separator-position-leftright { + .qubely-heading-container { + display: inline-flex; + align-items: center; - .qubely-heading-selector, - .qubely-separator { - display: inline-flex; - } - } - } -} \ No newline at end of file + .qubely-heading-selector, + .qubely-separator { + display: inline-flex; + } + } + } +} diff --git a/assets/reactjs/src/blocks/icon/Edit.js b/assets/reactjs/src/blocks/icon/Edit.js index bbad5706..f3ce23e9 100644 --- a/assets/reactjs/src/blocks/icon/Edit.js +++ b/assets/reactjs/src/blocks/icon/Edit.js @@ -2,8 +2,8 @@ import InspectorTab from "../../components/InspectorTab"; const { __ } = wp.i18n; const { Component, Fragment, createRef } = wp.element; -const { PanelBody, Toolbar } = wp.components -const { InspectorControls, BlockControls } = wp.blockEditor +const { PanelBody, Toolbar } = wp.components; +const { InspectorControls, BlockControls } = wp.blockEditor; const { Color, IconList, @@ -23,47 +23,41 @@ const { ContextMenu: { ContextMenu, handleContextMenu }, withCSSGenerator, InspectorTabs, - inspectorTab -} = wp.qubelyComponents + inspectorTab, +} = wp.qubelyComponents; -import icons from '../../helpers/icons' +import icons from "../../helpers/icons"; class Edit extends Component { constructor() { super(...arguments); this.state = { - device: 'md', - spacer: true + device: "md", + spacer: true, }; this.qubelyContextMenu = createRef(); } - componentDidMount() { - const { setAttributes, clientId, attributes: { uniqueId } } = this.props - const _client = clientId.substr(0, 6) - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - } changeIconStyle = (newStyle) => { - const { setAttributes, attributes: { border, iconStyle } } = this.props - let newBorder = JSON.parse(JSON.stringify(border)) - if (newStyle == 'outline') { - newBorder.widthType = border.widthType ? border.widthType : 'global' - newBorder.global = border.global ? border.global : { md: '1', sm: '1', xs: '1' } - newBorder.type = border.type ? border.type : 'solid' - newBorder.unit = border.unit ? border.unit : 'px' - newBorder.openBorder = border.openBorder ? border.openBorder : 1 + const { + setAttributes, + attributes: { border, iconStyle }, + } = this.props; + let newBorder = JSON.parse(JSON.stringify(border)); + if (newStyle == "outline") { + newBorder.widthType = border.widthType ? border.widthType : "global"; + newBorder.global = border.global ? border.global : { md: "1", sm: "1", xs: "1" }; + newBorder.type = border.type ? border.type : "solid"; + newBorder.unit = border.unit ? border.unit : "px"; + newBorder.openBorder = border.openBorder ? border.openBorder : 1; } - if (newStyle == 'fill') { - newBorder.type = iconStyle == 'fill' ? border.type : '' - newBorder.openBorder = iconStyle == 'fill' ? border.openBorder : 0 + if (newStyle == "fill") { + newBorder.type = iconStyle == "fill" ? border.type : ""; + newBorder.openBorder = iconStyle == "fill" ? border.openBorder : 0; } - setAttributes({ iconStyle: newStyle, border: newBorder }) - } + setAttributes({ iconStyle: newStyle, border: newBorder }); + }; render() { const { clientId, @@ -101,190 +95,209 @@ class Edit extends Component { hideTablet, hideMobile, globalCss, - interaction - } + interaction, + }, } = this.props; return ( - - - + + + this.changeIconStyle(val)} + onChange={(val) => this.changeIconStyle(val)} options={[ - { value: 'nofill', svg: icons.icon_classic, label: __('Classic') }, - { value: 'fill', svg: icons.icon_fill, label: __('Fill') }, - { value: 'outline', svg: icons.icon_line, label: __('Outline') }, + { value: "nofill", svg: icons.icon_classic, label: __("Classic") }, + { value: "fill", svg: icons.icon_fill, label: __("Fill") }, + { value: "outline", svg: icons.icon_line, label: __("Outline") }, ]} /> setAttributes({ alignment: val })} alignmentType="content" disableJustify responsive device={this.state.device} onDeviceChange={value => this.setState({ device: value })} /> + onChange={(val) => setAttributes({ alignment: val })} + alignmentType="content" + disableJustify + responsive + device={this.state.device} + onDeviceChange={(value) => this.setState({ device: value })} + /> - - setAttributes({ name: val })} /> + + setAttributes({ name: val })} /> setAttributes({ iconSize: value })} /> - {iconSize == 'custom' && + onChange={(value) => setAttributes({ iconSize: value })} + /> + {iconSize == "custom" && ( setAttributes({ iconSizeCustom: val })} + onChange={(val) => setAttributes({ iconSizeCustom: val })} min={12} max={300} - unit={['px', 'em', '%']} + unit={["px", "em", "%"]} responsive device={this.state.device} - onDeviceChange={value => this.setState({ device: value })} /> - } - setAttributes({ url: val })} /> + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + setAttributes({ url: val })} /> - + setAttributes({ iconColor: val })} /> + onChange={(val) => setAttributes({ iconColor: val })} + /> - + setAttributes({ iconHoverColor: val })} /> + onChange={(val) => setAttributes({ iconHoverColor: val })} + /> - {iconStyle != 'nofill' && - + {iconStyle != "nofill" && ( + - - {iconStyle == 'fill' && + + {iconStyle == "fill" && ( setAttributes({ bgColor: val })} /> - } + onChange={(val) => setAttributes({ bgColor: val })} + /> + )} setAttributes({ border: val })} + min={0} + max={10} + onChange={(val) => setAttributes({ border: val })} device={this.state.device} - onDeviceChange={value => this.setState({ device: value })} /> + onDeviceChange={(value) => this.setState({ device: value })} + /> - + setAttributes({ bgHoverColor: val })} /> - { - border.type && + onChange={(val) => setAttributes({ bgHoverColor: val })} + /> + {border.type && ( setAttributes({ borderHoverColor: val })} /> - } - + onChange={(val) => setAttributes({ borderHoverColor: val })} + /> + )} this.setState({ device: value })} - onChange={val => setAttributes({ iconBackgroundSize: val })} + onDeviceChange={(value) => this.setState({ device: value })} + onChange={(val) => setAttributes({ iconBackgroundSize: val })} /> setAttributes({ iconBorderRadius: val })} - onDeviceChange={value => this.setState({ device: value })} + onChange={(val) => setAttributes({ iconBorderRadius: val })} + onDeviceChange={(value) => this.setState({ device: value })} /> - } + )} - {iconStyle != 'nofill' && - + {iconStyle != "nofill" && ( + - + setAttributes({ iconShadow: val })} /> + onChange={(val) => setAttributes({ iconShadow: val })} + /> - + setAttributes({ iconHoverShadow: val })} /> + onChange={(val) => setAttributes({ iconHoverShadow: val })} + /> - } + )} - + {animationSettings(uniqueId, animation, setAttributes)} {interactionSettings(uniqueId, interaction, setAttributes)} - - + - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} -
    +
    handleContextMenu(event, this.qubelyContextMenu.current)} + onContextMenu={(event) => handleContextMenu(event, this.qubelyContextMenu.current)} >
    -
    +
    - {url.url ? - + {url.url ? ( + + + + ) : ( - - : - } + )}
    - ) - } + ); + } } -export default Save \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/icon/index.js b/assets/reactjs/src/blocks/icon/index.js index fc21ace6..b9c0ecbb 100644 --- a/assets/reactjs/src/blocks/icon/index.js +++ b/assets/reactjs/src/blocks/icon/index.js @@ -1,93 +1,165 @@ /* eslint-disable react/react-in-jsx-scope */ -import './style.scss' -const { __ } = wp.i18n -import Edit from './Edit' -import Save from './Save'; -const { registerBlockType } = wp.blocks -const { gloalSettings: { globalAttributes } } = wp.qubelyComponents +import "./style.scss"; +const { __ } = wp.i18n; +import Edit from "./Edit"; +import Save from "./Save"; +const { registerBlockType } = wp.blocks; +const { + gloalSettings: { globalAttributes }, +} = wp.qubelyComponents; -registerBlockType('qubely/icon', { - title: __('Icon'), - description: 'Place icons of various preset styles with Qubely icons.', - category: 'qubely', - icon: {__('Icon, +registerBlockType("qubely/icon", { + title: __("Icon"), + description: "Place icons of various preset styles with Qubely icons.", + category: "qubely", + icon: {__("Icon, supports: { - align: ['center', 'wide', 'full'], + align: ["center", "wide", "full"], }, - keywords: [__('Icon'), __('Font Awesome'), __('Line Icon')], - example: { + keywords: [__("Icon"), __("Font Awesome"), __("Line Icon")], + example: { attributes: { - name: 'fas fa-rocket', + name: "fas fa-rocket", }, }, attributes: { - uniqueId: { type: 'string', default: '' }, + uniqueId: { type: "string", default: "" }, ...globalAttributes, - spacer: { type: 'object', default: { spaceTop: { md: '10', unit: 'px' }, spaceBottom: { md: '10', unit: 'px' } }, style: [{ selector: '{{QUBELY}}' }] }, - name: { type: 'string', default: 'fas fa-rocket' }, - url: { type: 'object', default: {} }, - alignment: { type: 'object', default: { md: 'center' }, style: [{ selector: '{{QUBELY}} .qubely-block-icon-wrapper {text-align: {{alignment}};}' }] }, - iconStyle: { type: 'string', default: 'nofill' }, - iconColor: { type: 'string', default: 'var(--qubely-color-1)', style: [{ selector: '{{QUBELY}} .qubely-block-icon i {color: {{iconColor}};}' }] }, - iconHoverColor: { type: 'string', default: 'var(--qubely-color-2)', style: [{ selector: '{{QUBELY}} .qubely-block-icon:hover i {color: {{iconHoverColor}};}' }] }, - bgColor: { type: 'object', default: { openColor: 1, type: 'color', color: '#D6EBFF' }, style: [{ condition: [{ key: 'iconStyle', relation: '==', value: 'fill' }], selector: '{{QUBELY}} .qubely-block-icon' }] }, - bgHoverColor: { type: 'object', default: { openColor: 1, type: 'color', color: '#B4D9FF', gradient: {} }, style: [{ condition: [{ key: 'iconStyle', relation: '!=', value: 'nofill' }], selector: '{{QUBELY}} .qubely-block-icon:hover' }] }, + spacer: { + type: "object", + default: { spaceTop: { md: "10", unit: "px" }, spaceBottom: { md: "10", unit: "px" } }, + style: [{ selector: "{{QUBELY}}" }], + }, + name: { type: "string", default: "fas fa-rocket" }, + url: { type: "object", default: {} }, + alignment: { + type: "object", + default: { md: "center" }, + style: [{ selector: "{{QUBELY}} .qubely-block-icon-wrapper {text-align: {{alignment}};}" }], + }, + iconStyle: { type: "string", default: "nofill" }, + iconColor: { + type: "string", + default: "var(--qubely-color-1)", + style: [{ selector: "{{QUBELY}} .qubely-block-icon i {color: {{iconColor}};}" }], + }, + iconHoverColor: { + type: "string", + default: "var(--qubely-color-2)", + style: [{ selector: "{{QUBELY}} .qubely-block-icon:hover i {color: {{iconHoverColor}};}" }], + }, + bgColor: { + type: "object", + default: { openColor: 1, type: "color", color: "#D6EBFF" }, + style: [ + { + condition: [{ key: "iconStyle", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-block-icon", + }, + ], + }, + bgHoverColor: { + type: "object", + default: { openColor: 1, type: "color", color: "#B4D9FF", gradient: {} }, + style: [ + { + condition: [{ key: "iconStyle", relation: "!=", value: "nofill" }], + selector: "{{QUBELY}} .qubely-block-icon:hover", + }, + ], + }, border: { - type: 'object', + type: "object", default: { - color: 'var(--qubely-color-1)', + color: "var(--qubely-color-1)", }, - style: [{ condition: [{ key: 'iconStyle', relation: '!=', value: 'nofill' }], selector: '{{QUBELY}} .qubely-block-icon' }] + style: [ + { + condition: [{ key: "iconStyle", relation: "!=", value: "nofill" }], + selector: "{{QUBELY}} .qubely-block-icon", + }, + ], + }, + borderHoverColor: { + type: "string", + default: "var(--qubely-color-2)", + style: [ + { + condition: [{ key: "iconStyle", relation: "!=", value: "nofill" }], + selector: "{{QUBELY}} .qubely-block-icon:hover {border-color: {{borderHoverColor}};}", + }, + ], + }, + iconSize: { + type: "string", + default: "64px", + style: [ + { + condition: [{ key: "iconSize", relation: "!=", value: "custom" }], + selector: "{{QUBELY}} .qubely-block-icon {font-size: {{iconSize}};}", + }, + ], + }, + iconSizeCustom: { + type: "object", + default: { md: 64, unit: "px" }, + style: [ + { + condition: [{ key: "iconSize", relation: "==", value: "custom" }], + selector: "{{QUBELY}} .qubely-block-icon {font-size: {{iconSizeCustom}};}", + }, + ], + }, + iconBackgroundSize: { + type: "object", + default: { md: "20", unit: "px" }, + style: [ + { + condition: [{ key: "iconStyle", relation: "!=", value: "nofill" }], + selector: "{{QUBELY}} .qubely-block-icon { padding: {{iconBackgroundSize}};}", + }, + ], }, - borderHoverColor: { type: 'string', default: 'var(--qubely-color-2)', style: [{ condition: [{ key: 'iconStyle', relation: '!=', value: 'nofill' }], selector: '{{QUBELY}} .qubely-block-icon:hover {border-color: {{borderHoverColor}};}' }] }, - iconSize: { type: 'string', default: '64px', style: [{ condition: [{ key: 'iconSize', relation: '!=', value: 'custom' }], selector: '{{QUBELY}} .qubely-block-icon {font-size: {{iconSize}};}' }] }, - iconSizeCustom: { type: 'object', default: { md: 64, unit: 'px' }, style: [{ condition: [{ key: 'iconSize', relation: '==', value: 'custom' }], selector: '{{QUBELY}} .qubely-block-icon {font-size: {{iconSizeCustom}};}' }] }, - iconBackgroundSize: { type: 'object', default: { md: '20', unit: 'px' }, style: [{ condition: [{ key: 'iconStyle', relation: '!=', value: 'nofill' }], selector: '{{QUBELY}} .qubely-block-icon { padding: {{iconBackgroundSize}};}' }] }, iconBorderRadius: { - type: 'object', + type: "object", default: { openBorderRadius: 1, - radiusType: 'global', + radiusType: "global", global: { - md: 100 + md: 100, }, - unit: '%' + unit: "%", }, - style: [{ - condition: [{ key: 'iconStyle', relation: '!=', value: 'nofill' }], - selector: '{{QUBELY}} .qubely-block-icon' - }] + style: [ + { + condition: [{ key: "iconStyle", relation: "!=", value: "nofill" }], + selector: "{{QUBELY}} .qubely-block-icon", + }, + ], }, iconShadow: { - type: 'object', + type: "object", default: {}, style: [ { - condition: - [ - { key: 'iconStyle', relation: '!=', value: 'nofill' } - ], - selector: '{{QUBELY}} .qubely-block-icon' - } - ] + condition: [{ key: "iconStyle", relation: "!=", value: "nofill" }], + selector: "{{QUBELY}} .qubely-block-icon", + }, + ], }, iconHoverShadow: { - type: 'object', + type: "object", default: {}, style: [ { - condition: - [ - { key: 'iconStyle', relation: '!=', value: 'nofill' } - ], - selector: '{{QUBELY}} .qubely-block-icon:hover' - } - ] + condition: [{ key: "iconStyle", relation: "!=", value: "nofill" }], + selector: "{{QUBELY}} .qubely-block-icon:hover", + }, + ], }, - sourceOfCopiedStyle: { type: 'boolean', default: false } + sourceOfCopiedStyle: { type: "boolean", default: false }, }, edit: Edit, save: Save, }); - diff --git a/assets/reactjs/src/blocks/icon/style.scss b/assets/reactjs/src/blocks/icon/style.scss index 9bd06cef..6b557d97 100644 --- a/assets/reactjs/src/blocks/icon/style.scss +++ b/assets/reactjs/src/blocks/icon/style.scss @@ -1,28 +1,28 @@ .qubely-block-icon-wrapper { - .qubely-block-icon { - display: inline-block; - line-height: 1; - font-size: 36px; - text-align: center; - transition: color 400ms, border-color 400ms, background-color 400ms, box-shadow 400ms; - i { - font-style: normal; - width: 1em; - height: 1em; - position: relative; - display: block; - transition: 400ms; - &:before { - position: absolute; - left: 50%; - transform: translateX(-50%); - } - } - .qubely-icon-block-anchor { - text-decoration: none !important; - a { - text-decoration: none !important; - } - } - } -} \ No newline at end of file + .qubely-block-icon { + display: inline-block; + line-height: 1; + font-size: 36px; + text-align: center; + transition: color 400ms, border-color 400ms, background-color 400ms, box-shadow 400ms; + i { + font-style: normal; + width: 1em; + height: 1em; + position: relative; + display: block; + transition: 400ms; + &:before { + position: absolute; + left: 50%; + transform: translateX(-50%); + } + } + .qubely-icon-block-anchor { + text-decoration: none !important; + a { + text-decoration: none !important; + } + } + } +} diff --git a/assets/reactjs/src/blocks/iconlist/Edit.js b/assets/reactjs/src/blocks/iconlist/Edit.js index 671a7098..4cf1d298 100644 --- a/assets/reactjs/src/blocks/iconlist/Edit.js +++ b/assets/reactjs/src/blocks/iconlist/Edit.js @@ -1,397 +1,526 @@ const { __ } = wp.i18n; -const { InspectorControls } = wp.blockEditor +const { InspectorControls } = wp.blockEditor; const { Component, Fragment, createRef } = wp.element; const { PanelBody, Tooltip, Popover } = wp.components; const { - Typography, - Alignment, - Padding, - Styles, - Range, - Tabs, - Tab, - IconList, - Color, - RadioAdvanced, - Border, - BorderRadius, - BoxShadow, - Separator, - gloalSettings: { - globalSettingsPanel, - animationSettings, - interactionSettings - }, - ContextMenu: { - ContextMenu, - handleContextMenu - }, - withCSSGenerator, - InspectorTabs, - InspectorTab -} = wp.qubelyComponents + Typography, + Alignment, + Padding, + Styles, + Range, + Tabs, + Tab, + IconList, + Color, + RadioAdvanced, + Border, + BorderRadius, + BoxShadow, + Separator, + gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, + ContextMenu: { ContextMenu, handleContextMenu }, + withCSSGenerator, + InspectorTabs, + InspectorTab, +} = wp.qubelyComponents; -import icons from '../../helpers/icons' +import icons from "../../helpers/icons"; class Edit extends Component { - constructor(props) { - super(props); - this.state = { - device: 'md', - currentListItemIndex: 0, - openIconPopUp: false, - removeItemViaBackSpace: -1, - focusedItem: this.props.attributes.listItems.length - 1 - }; - this.textInput = React.createRef(); - this.qubelyContextMenu = createRef(); - } - componentDidMount() { - const { - setAttributes, - clientId, - attributes: { - uniqueId - } - } = this.props - const _client = clientId.substr(0, 6) - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - this.placeCaretAtEnd(document.querySelector(`.qubely-block-${uniqueId} .qubely-list-item-text-${this.state.focusedItem}`)) - } - componentDidUpdate(prevProps, prevState) { - if (this.props.attributes.listItems.length > prevProps.attributes.listItems.length) { - let focusedListItem = document.querySelector(`.qubely-block-${prevProps.attributes.uniqueId} .qubely-list-item-text-${this.state.focusedItem}`) - focusedListItem.focus(); - } else if (this.props.attributes.listItems.length < prevProps.attributes.listItems.length) { - const { focusedItem } = this.state - let focusedListItem = document.querySelector(`.qubely-block-${prevProps.attributes.uniqueId} .qubely-list-item-text-${focusedItem}`) - if (this.props.isSelected && focusedListItem) { - this.placeCaretAtEnd(focusedListItem) - } - } - } - modifySpecificItem = (value, index) => { - const { attributes: { listItems }, setAttributes } = this.props; - const modifiedListItems = listItems.map((listItem, currentIndex) => { - if (index === currentIndex) { - listItem = { ...listItem, ...value } - } - return listItem - }) - setAttributes({ listItems: modifiedListItems }) - } - updateListItems = (index, operation) => { - const { attributes: { listItems }, setAttributes } = this.props - let newList = JSON.parse(JSON.stringify(listItems)) - operation == 'add' ? newList.splice(index + 1, 0, { icon: 'fas fa-arrow-right', text: '' }) : newList.splice(index, 1) - this.setState({ openIconPopUp: false }) - setAttributes({ listItems: newList }) - } - placeCaretAtEnd = (el) => { - if (el) { - el.focus() - if (typeof window.getSelection != "undefined" - && typeof document.createRange != "undefined") { - var range = document.createRange(); - range.selectNodeContents(el); - range.collapse(false); - var sel = window.getSelection(); - sel.removeAllRanges(); - sel.addRange(range); - } else if (typeof document.body.createTextRange != "undefined") { - var textRange = document.body.createTextRange(); - textRange.moveToElementText(el); - textRange.collapse(false); - textRange.select(); - } - } + constructor(props) { + super(props); + this.state = { + device: "md", + currentListItemIndex: 0, + openIconPopUp: false, + removeItemViaBackSpace: -1, + focusedItem: this.props.attributes.listItems.length - 1, + }; + this.textInput = React.createRef(); + this.qubelyContextMenu = createRef(); + } + componentDidMount() { + const { + attributes: { uniqueId }, + } = this.props; - } - renderListItems = () => { - const { - isSelected, - attributes: { - iconPosition, - listItems, - }, - } = this.props; - const { focusedItem, removeItemViaBackSpace, currentListItemIndex, openIconPopUp } = this.state; - let tempItems = listItems; - if (Array.isArray(listItems)) { - tempItems = listItems; - } else { - tempItems = listItems.default; - } - return tempItems.map((item, index) => { - return ( -
  • -
    this.setState({ currentListItemIndex: index })}> - {iconPosition == 'left' && this.setState({ openIconPopUp: openIconPopUp ? (currentListItemIndex == index) ? false : true : true })} />} -
    this.modifySpecificItem({ text: event.target.innerText }, index)} - onKeyPress={(event) => { - if (event.key == 'Enter') { - event.preventDefault() - this.updateListItems(index, 'add') - this.setState({ focusedItem: index + 1 == listItems.length ? listItems.length : focusedItem + 1 }) - } - } - } - onKeyUp={(event) => { - if (event.key == 'Backspace') { - event.target.innerText.length == 0 && this.setState({ removeItemViaBackSpace: index }) - if (removeItemViaBackSpace == index) { - this.updateListItems(index, 'delete') - this.setState({ focusedItem: index > 0 ? index - 1 : index, removeItemViaBackSpace: -1 }) - } - } - }} - onClick={() => this.setState({ focusedItem: index })}> - {item.text} -
    - {iconPosition == 'right' && this.setState({ openIconPopUp: openIconPopUp ? (currentListItemIndex == index) ? false : true : true })} />} - { - item.text.length > 0 && - - { - this.updateListItems(index, 'delete') - index == focusedItem ? this.setState({ focusedItem: index > 0 ? index - 1 : index }) - : - this.setState({ focusedItem: focusedItem > 0 ? focusedItem - 1 : focusedItem }) + this.placeCaretAtEnd( + document.querySelector(`.qubely-block-${uniqueId} .qubely-list-item-text-${this.state.focusedItem}`) + ); + } + componentDidUpdate(prevProps, prevState) { + if (this.props.attributes.listItems.length > prevProps.attributes.listItems.length) { + let focusedListItem = document.querySelector( + `.qubely-block-${prevProps.attributes.uniqueId} .qubely-list-item-text-${this.state.focusedItem}` + ); + focusedListItem.focus(); + } else if (this.props.attributes.listItems.length < prevProps.attributes.listItems.length) { + const { focusedItem } = this.state; + let focusedListItem = document.querySelector( + `.qubely-block-${prevProps.attributes.uniqueId} .qubely-list-item-text-${focusedItem}` + ); + if (this.props.isSelected && focusedListItem) { + this.placeCaretAtEnd(focusedListItem); + } + } + } + modifySpecificItem = (value, index) => { + const { + attributes: { listItems }, + setAttributes, + } = this.props; + const modifiedListItems = listItems.map((listItem, currentIndex) => { + if (index === currentIndex) { + listItem = { ...listItem, ...value }; + } + return listItem; + }); + setAttributes({ listItems: modifiedListItems }); + }; + updateListItems = (index, operation) => { + const { + attributes: { listItems }, + setAttributes, + } = this.props; + let newList = JSON.parse(JSON.stringify(listItems)); + operation == "add" + ? newList.splice(index + 1, 0, { icon: "fas fa-arrow-right", text: "" }) + : newList.splice(index, 1); + this.setState({ openIconPopUp: false }); + setAttributes({ listItems: newList }); + }; + placeCaretAtEnd = (el) => { + if (el) { + el.focus(); + if (typeof window.getSelection != "undefined" && typeof document.createRange != "undefined") { + var range = document.createRange(); + range.selectNodeContents(el); + range.collapse(false); + var sel = window.getSelection(); + sel.removeAllRanges(); + sel.addRange(range); + } else if (typeof document.body.createTextRange != "undefined") { + var textRange = document.body.createTextRange(); + textRange.moveToElementText(el); + textRange.collapse(false); + textRange.select(); + } + } + }; + renderListItems = () => { + const { + isSelected, + attributes: { iconPosition, listItems }, + } = this.props; + const { focusedItem, removeItemViaBackSpace, currentListItemIndex, openIconPopUp } = this.state; + let tempItems = listItems; + if (Array.isArray(listItems)) { + tempItems = listItems; + } else { + tempItems = listItems.default; + } + return tempItems.map((item, index) => { + return ( +
  • +
    this.setState({ currentListItemIndex: index })} + > + {iconPosition == "left" && ( + + this.setState({ + openIconPopUp: openIconPopUp + ? currentListItemIndex == index + ? false + : true + : true, + }) + } + /> + )} +
    this.modifySpecificItem({ text: event.target.innerText }, index)} + onKeyPress={(event) => { + if (event.key == "Enter") { + event.preventDefault(); + this.updateListItems(index, "add"); + this.setState({ + focusedItem: index + 1 == listItems.length ? listItems.length : focusedItem + 1, + }); + } + }} + onKeyUp={(event) => { + if (event.key == "Backspace") { + event.target.innerText.length == 0 && + this.setState({ removeItemViaBackSpace: index }); + if (removeItemViaBackSpace == index) { + this.updateListItems(index, "delete"); + this.setState({ + focusedItem: index > 0 ? index - 1 : index, + removeItemViaBackSpace: -1, + }); + } + } + }} + onClick={() => this.setState({ focusedItem: index })} + > + {item.text} +
    + {iconPosition == "right" && ( + + this.setState({ + openIconPopUp: openIconPopUp + ? currentListItemIndex == index + ? false + : true + : true, + }) + } + /> + )} + {item.text.length > 0 && ( + + { + this.updateListItems(index, "delete"); + index == focusedItem + ? this.setState({ focusedItem: index > 0 ? index - 1 : index }) + : this.setState({ + focusedItem: focusedItem > 0 ? focusedItem - 1 : focusedItem, + }); + }} + > + + + + )} + {currentListItemIndex == index && openIconPopUp && isSelected && ( + + 0 && listItems[index].icon} + onChange={(value) => this.modifySpecificItem({ icon: value }, index)} + /> + + )} +
    +
  • + ); + }); + }; - }}> - - - - } - {(currentListItemIndex == index && openIconPopUp && isSelected) && + render() { + const { + name, + clientId, + attributes, + isSelected, + setAttributes, + attributes: { + uniqueId, + className, + iconSize, + iconSizeCustom, + iconSpacing, + layout, + iconPosition, + listItems, + typography, + alignment, + iconColor, + iconHoverColor, + spacing, + color, + colorHover, + padding, + background, + backgroundHover, + border, + borderRadius, + borderColorHover, + shadow, + shadowHover, + animation, + globalZindex, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + hideTablet, + hideMobile, + globalCss, + interaction, + }, + } = this.props; - - 0 && listItems[index].icon} - onChange={(value) => this.modifySpecificItem({ icon: value }, index)} /> - - } -
    - - ) - }) + const { device } = this.state; - } + return ( + + + + + + setAttributes({ layout: val })} + options={[ + { value: "fill", svg: icons.list_fill, label: __("Fill") }, + { value: "classic", svg: icons.list_classic, label: __("Classic") }, + ]} + /> + setAttributes({ alignment: val })} + disableJustify + responsive + /> + - render() { - const { - name, - clientId, - attributes, - isSelected, - setAttributes, - attributes: { - uniqueId, - className, - iconSize, - iconSizeCustom, - iconSpacing, - layout, - iconPosition, - listItems, - typography, - alignment, - iconColor, - iconHoverColor, - spacing, - color, - colorHover, - padding, - background, - backgroundHover, - border, - borderRadius, - borderColorHover, - shadow, - shadowHover, - animation, - globalZindex, - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - hideTablet, - hideMobile, - globalCss, - interaction - } - } = this.props; + + setAttributes({ typography: val })} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + - const { device } = this.state; + + setAttributes({ iconSize: val })} + options={[ + { label: "S", value: "12px", title: __("Small") }, + { label: "M", value: "16px", title: __("Medium") }, + { label: "L", value: "20px", title: __("Large") }, + { label: "XL", value: "28px", title: __("Extra Large") }, + { icon: "fas fa-cog", value: "custom", title: __("Custom") }, + ]} + /> + {iconSize == "custom" && ( + setAttributes({ iconSizeCustom: value })} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + setAttributes({ iconPosition: val })} + options={[ + { label: "Left", value: "left", title: __("Left") }, + { label: "Right", value: "right", title: __("Right") }, + ]} + /> + setAttributes({ iconSpacing: val })} + min={0} + max={60} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ iconColor: value })} + /> + + + setAttributes({ iconHoverColor: value })} + /> + + + - return ( - - - - - - setAttributes({ layout: val })} - options={[ - { value: 'fill', svg: icons.list_fill, label: __('Fill') }, - { value: 'classic', svg: icons.list_classic, label: __('Classic') } - ]} - /> - setAttributes({ alignment: val })} disableJustify responsive /> - + + setAttributes({ spacing: val })} + min={0} + max={60} + /> + {layout == "fill" && ( + + setAttributes({ padding: val })} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + setAttributes({ borderRadius: val })} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + )} - - setAttributes({ typography: val })} device={device} onDeviceChange={value => this.setState({ device: value })} /> - + + + setAttributes({ color: val })} + /> + {layout == "fill" && ( + setAttributes({ background: val })} + /> + )} + setAttributes({ border: val })} + min={0} + max={10} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ colorHover: val })} + /> + {layout == "fill" && ( + setAttributes({ backgroundHover: val })} + /> + )} + {border.openBorder != undefined && border.openBorder == 1 && ( + setAttributes({ borderColorHover: value })} + /> + )} + + + + {layout == "fill" && ( + + + + setAttributes({ shadow: value })} + /> + + + setAttributes({ shadowHover: value })} + /> + + + + )} + + + {animationSettings(uniqueId, animation, setAttributes)} + {interactionSettings(uniqueId, interaction, setAttributes)} + + + - - setAttributes({ iconSize: val })} - options={[ - { label: 'S', value: '12px', title: __('Small') }, - { label: 'M', value: '16px', title: __('Medium') }, - { label: 'L', value: '20px', title: __('Large') }, - { label: 'XL', value: '28px', title: __('Extra Large') }, - { icon: 'fas fa-cog', value: 'custom', title: __('Custom') } - ]} - /> - {iconSize == 'custom' && - setAttributes({ iconSizeCustom: value })} min={0} max={100} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - } - setAttributes({ iconPosition: val })} - options={[ - { label: 'Left', value: 'left', title: __('Left') }, - { label: 'Right', value: 'right', title: __('Right') } - ]} - /> - setAttributes({ iconSpacing: val })} min={0} max={60} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - setAttributes({ iconColor: value })} /> - - - setAttributes({ iconHoverColor: value })} /> - - - + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} - - setAttributes({ spacing: val })} min={0} max={60} /> - {layout == 'fill' && - - setAttributes({ padding: val })} - onDeviceChange={value => this.setState({ device: value })} - /> - - setAttributes({ borderRadius: val })} - min={0} - max={100} - unit={['px', 'em', '%']} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - - } - - - - setAttributes({ color: val })} /> - {layout == 'fill' && - setAttributes({ background: val })} /> - } - setAttributes({ border: val })} min={0} max={10} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - setAttributes({ colorHover: val })} /> - {layout == 'fill' && - setAttributes({ backgroundHover: val })} /> - } - {(border.openBorder != undefined && border.openBorder == 1) && - setAttributes({ borderColorHover: value })} /> - } - - - - - {layout == 'fill' && - - - - setAttributes({ shadow: value })} /> - - - setAttributes({ shadowHover: value })} /> - - - - } - - - {animationSettings(uniqueId, animation, setAttributes)} - {interactionSettings(uniqueId, interaction, setAttributes)} - - - - - - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} - -
    -
    handleContextMenu(event, this.qubelyContextMenu.current)} - > -
      - {this.renderListItems()} -
    - -
    - -
    -
    -
    -
    - ); - } +
    +
    handleContextMenu(event, this.qubelyContextMenu.current)} + > +
      {this.renderListItems()}
    + +
    + +
    +
    +
    + + ); + } } export default withCSSGenerator()(Edit); diff --git a/assets/reactjs/src/blocks/iconlist/Save.js b/assets/reactjs/src/blocks/iconlist/Save.js index 478547fe..bff28c43 100644 --- a/assets/reactjs/src/blocks/iconlist/Save.js +++ b/assets/reactjs/src/blocks/iconlist/Save.js @@ -1,36 +1,38 @@ const { Component } = wp.element; -const { RichText } = wp.blockEditor -const { HelperFunction: { IsInteraction, animationAttr } } = wp.qubelyComponents +const { RichText } = wp.blockEditor; +const { + HelperFunction: { IsInteraction, animationAttr }, +} = wp.qubelyComponents; class Save extends Component { + renderListItems = () => { + const { + attributes: { listItems, iconPosition }, + } = this.props; + return listItems.map((item, index) => { + return ( +
  • + {iconPosition == "left" && } + + {iconPosition == "right" && } +
  • + ); + }); + }; - renderListItems = () => { - const { attributes: { listItems, iconPosition } } = this.props - return listItems.map((item, index) => { - return ( -
  • - {iconPosition == 'left' && } - - {iconPosition == 'right' && } -
  • - ) - }) - - } - - render() { - const { attributes: { uniqueId, interaction, animation } } = this.props - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - return ( -
    -
    -
      - {this.renderListItems()} -
    -
    -
    - ); - } + render() { + const { + attributes: { uniqueId, interaction, animation }, + } = this.props; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + return ( +
    +
    +
      {this.renderListItems()}
    +
    +
    + ); + } } -export default Save; \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/iconlist/index.js b/assets/reactjs/src/blocks/iconlist/index.js index 0e3568ea..f9f0665d 100644 --- a/assets/reactjs/src/blocks/iconlist/index.js +++ b/assets/reactjs/src/blocks/iconlist/index.js @@ -1,235 +1,286 @@ /* eslint-disable react/react-in-jsx-scope */ -import './style.scss' -import Edit from './Edit' -import Save from './Save'; -const { __ } = wp.i18n -const { RichText } = wp.blockEditor -const { registerBlockType } = wp.blocks -const { gloalSettings: { globalAttributes }, HelperFunction: { IsInteraction } } = wp.qubelyComponents +import "./style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +const { __ } = wp.i18n; +const { RichText } = wp.blockEditor; +const { registerBlockType } = wp.blocks; +const { + gloalSettings: { globalAttributes }, + HelperFunction: { IsInteraction }, +} = wp.qubelyComponents; const attributes = { - uniqueId: { type: 'string', default: '' }, - ...globalAttributes, - listStyle: { type: 'string', default: 'ordered' }, - ordered: { type: 'boolean', default: false, }, - alignment: { - type: 'object', default: { md: 'left' }, - style: [ - { - selector: '{{QUBELY}} .qubely-block-icon-list {text-align: {{alignment}};}' - } - ] - }, + uniqueId: { type: "string", default: "" }, + ...globalAttributes, + listStyle: { type: "string", default: "ordered" }, + ordered: { type: "boolean", default: false }, + alignment: { + type: "object", + default: { md: "left" }, + style: [ + { + selector: "{{QUBELY}} .qubely-block-icon-list {text-align: {{alignment}};}", + }, + ], + }, - layout: { type: 'string', default: 'classic' }, + layout: { type: "string", default: "classic" }, - listItems: { - type: 'array', - default: [ - { - icon: 'far fa-star', - text: 'Add beautiful icons and text' - }, - { - icon: 'far fa-heart', - text: 'Set icon color for normal and hover state' - }, - { - icon: 'fas fa-check', - text: 'Manage space between icon and the text' - }, - { - icon: 'fas fa-burn', - text: 'Choose a desired layout from the list' - }, - ] - }, + listItems: { + type: "array", + default: [ + { + icon: "far fa-star", + text: "Add beautiful icons and text", + }, + { + icon: "far fa-heart", + text: "Set icon color for normal and hover state", + }, + { + icon: "fas fa-check", + text: "Manage space between icon and the text", + }, + { + icon: "fas fa-burn", + text: "Choose a desired layout from the list", + }, + ], + }, - spacer: { type: 'object', default: { spaceTop: { md: '10', unit: 'px' }, spaceBottom: { md: '10', unit: 'px' } }, style: [{ selector: '{{QUBELY}}' }] }, + spacer: { + type: "object", + default: { spaceTop: { md: "10", unit: "px" }, spaceBottom: { md: "10", unit: "px" } }, + style: [{ selector: "{{QUBELY}}" }], + }, + typography: { + type: "object", + default: { openTypography: 1, size: { md: 16, unit: "px" } }, + style: [{ selector: "{{QUBELY}} .qubely-list .qubely-list-li" }], + }, + iconSize: { + type: "string", + default: "16px", + style: [ + { + condition: [{ key: "iconSize", relation: "!=", value: "custom" }], + selector: "{{QUBELY}} .qubely-list .qubely-list-item-icon {font-size: {{iconSize}};}", + }, + ], + }, + iconSizeCustom: { + type: "object", + default: { md: 16, unit: "px" }, + style: [ + { + condition: [{ key: "iconSize", relation: "==", value: "custom" }], + selector: "{{QUBELY}} .qubely-list .qubely-list-item-icon {font-size: {{iconSizeCustom}};}", + }, + ], + }, + iconPosition: { type: "string", default: "left" }, + iconSpacing: { + type: "object", + default: { md: 10, unit: "px" }, + style: [ + { + condition: [{ key: "iconPosition", relation: "==", value: "left" }], + selector: "{{QUBELY}} .qubely-list .qubely-list-item-icon {margin-right: {{iconSpacing}};}", + }, + { + condition: [{ key: "iconPosition", relation: "==", value: "right" }], + selector: "{{QUBELY}} .qubely-list .qubely-list-item-icon {margin-left: {{iconSpacing}};}", + }, + ], + }, - typography: { type: 'object', default: { openTypography: 1, size: { md: 16, unit: 'px' } }, style: [{ selector: '{{QUBELY}} .qubely-list .qubely-list-li' }] }, - iconSize: { - type: 'string', - default: '16px', - style: [ - { - condition: [ - { key: 'iconSize', relation: '!=', value: 'custom' } - ], - selector: '{{QUBELY}} .qubely-list .qubely-list-item-icon {font-size: {{iconSize}};}' - } - ] - }, - iconSizeCustom: { - type: 'object', default: { md: 16, unit: 'px' }, - style: [ - { - condition: [ - { key: 'iconSize', relation: '==', value: 'custom' } - ], - selector: '{{QUBELY}} .qubely-list .qubely-list-item-icon {font-size: {{iconSizeCustom}};}' - } - ] - }, - iconPosition: { type: 'string', default: 'left' }, - iconSpacing: { - type: 'object', default: { md: 10, unit: 'px' }, - style: [ - { - condition: [ - { key: 'iconPosition', relation: '==', value: 'left' } - ], - selector: '{{QUBELY}} .qubely-list .qubely-list-item-icon {margin-right: {{iconSpacing}};}' - }, - { - condition: [ - { key: 'iconPosition', relation: '==', value: 'right' } - ], - selector: '{{QUBELY}} .qubely-list .qubely-list-item-icon {margin-left: {{iconSpacing}};}' - } - ] - }, + iconColor: { + type: "string", + default: "var(--qubely-color-1)", + style: [{ selector: "{{QUBELY}} .qubely-list .qubely-list-li .qubely-list-item-icon {color: {{iconColor}};}" }], + }, + iconHoverColor: { + type: "string", + default: "", + style: [ + { + selector: + "{{QUBELY}} .qubely-list .qubely-list-li:hover .qubely-list-item-icon {color: {{iconHoverColor}};}", + }, + ], + }, - iconColor: { type: 'string', default: 'var(--qubely-color-1)', style: [{ selector: '{{QUBELY}} .qubely-list .qubely-list-li .qubely-list-item-icon {color: {{iconColor}};}' }] }, - iconHoverColor: { type: 'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-list .qubely-list-li:hover .qubely-list-item-icon {color: {{iconHoverColor}};}' }] }, + color: { + type: "string", + default: "#333", + style: [{ selector: "{{QUBELY}} .qubely-list .qubely-list-li {color: {{color}};}" }], + }, + colorHover: { + type: "string", + default: "", + style: [{ selector: "{{QUBELY}} .qubely-list .qubely-list-li:hover {color: {{colorHover}};}" }], + }, + spacing: { + type: "string", + default: "5", + style: [ + { selector: "{{QUBELY}} .qubely-list .qubely-list-li:not(:last-child) {margin-bottom: {{spacing}}px;}" }, + ], + }, + padding: { + type: "object", + default: { + openPadding: 1, + paddingType: "custom", + global: { md: "5" }, + custom: { md: "5 10 5 10" }, + unit: "px", + }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-list .qubely-list-li ", + }, + ], + }, + background: { + type: "string", + default: "#f5f5f5", + style: [ + { + condition: [{ key: "layout", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-list .qubely-list-li {background-color: {{background}};}", + }, + ], + }, + backgroundHover: { + type: "string", + default: "", + style: [ + { + condition: [{ key: "layout", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-list .qubely-list-li:hover {background-color: {{backgroundHover}};}", + }, + ], + }, + shadow: { + type: "object", + default: { color: "" }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-list .qubely-list-li", + }, + ], + }, + shadowHover: { + type: "object", + default: { color: "" }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "fill" }], + selector: "{{QUBELY}} .qubely-list .qubely-list-li:hover", + }, + ], + }, - color: { type: 'string', default: '#333', style: [{ selector: '{{QUBELY}} .qubely-list .qubely-list-li {color: {{color}};}' }] }, - colorHover: { type: 'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-list .qubely-list-li:hover {color: {{colorHover}};}' }] }, - spacing: { type: 'string', default: '5', style: [{ selector: '{{QUBELY}} .qubely-list .qubely-list-li:not(:last-child) {margin-bottom: {{spacing}}px;}' }] }, - padding: { - type: 'object', - default: { - openPadding: 1, - paddingType: 'custom', - global: { md: '5' }, - custom: { md: '5 10 5 10' }, - unit: 'px' - }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-list .qubely-list-li ' - } - ] - }, - background: { - type: 'string', default: '#f5f5f5', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-list .qubely-list-li {background-color: {{background}};}' - } - ] - }, - backgroundHover: { - type: 'string', default: '', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'fill' } - ], - selector: '{{QUBELY}} .qubely-list .qubely-list-li:hover {background-color: {{backgroundHover}};}' - } - ] - }, + border: { + type: "object", + default: {}, + style: [{ selector: "{{QUBELY}} .qubely-list .qubely-list-li" }], + }, - shadow: { type: 'object', default: { color: '' }, style: [{ condition: [{ key: 'layout', relation: '==', value: 'fill' }], selector: '{{QUBELY}} .qubely-list .qubely-list-li' }] }, - shadowHover: { type: 'object', default: { color: '' }, style: [{ condition: [{ key: 'layout', relation: '==', value: 'fill' }], selector: '{{QUBELY}} .qubely-list .qubely-list-li:hover' }] }, + borderRadius: { + type: "object", + default: {}, + style: [{ selector: "{{QUBELY}} .qubely-list .qubely-list-li" }], + }, + borderColorHover: { + type: "string", + default: "", + style: [ + { selector: "{{QUBELY}} .qubely-list .qubely-list-li:hover {border-bottom-color: {{borderColorHover}};}" }, + ], + }, + sourceOfCopiedStyle: { type: "boolean", default: false }, +}; - border: { - type: 'object', - default: {}, - style: [{ selector: '{{QUBELY}} .qubely-list .qubely-list-li' }] - }, +registerBlockType("qubely/iconlist", { + title: __("Icon List"), + description: __("Include attractive icon lists with Qubely Icon List."), + category: "qubely", + icon: {__("Icon, + keywords: [__("icon", "list", "icon list")], + supports: { + align: ["center", "wide", "full"], + }, + example: { + attributes: { + listItems: { + type: "array", + default: [ + { + icon: "far fa-star", + text: "Add beautiful icons and text", + }, + { + icon: "far fa-heart", + text: "Set icon color for normal and hover state", + }, + { + icon: "fas fa-check", + text: "Manage space between icon and the text", + }, + { + icon: "fas fa-burn", + text: "Choose a desired layout from the list", + }, + ], + }, + }, + }, - borderRadius: { - type: 'object', - default: {}, - style: [{ selector: '{{QUBELY}} .qubely-list .qubely-list-li' }] - }, - borderColorHover: { type: 'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-list .qubely-list-li:hover {border-bottom-color: {{borderColorHover}};}' }] }, - sourceOfCopiedStyle: { type: 'boolean', default: false } -} + attributes, + edit: Edit, + save: Save, + deprecated: [ + { + attributes, + save(props) { + const { uniqueId, interaction } = props.attributes; -registerBlockType('qubely/iconlist', { - title: __('Icon List'), - description: __('Include attractive icon lists with Qubely Icon List.'), - category: 'qubely', - icon: {__('Icon, - keywords: [__('icon', 'list', 'icon list')], - supports: { - align: ['center', 'wide', 'full'], - }, - example: { - attributes:{ - listItems: { - type: 'array', - default: [ - { - icon: 'far fa-star', - text: 'Add beautiful icons and text' - }, - { - icon: 'far fa-heart', - text: 'Set icon color for normal and hover state' - }, - { - icon: 'fas fa-check', - text: 'Manage space between icon and the text' - }, - { - icon: 'fas fa-burn', - text: 'Choose a desired layout from the list' - }, - ] - }, - } - }, + const renderListItems = () => { + const { + attributes: { listItems, iconPosition }, + } = props; + return listItems.map((item, index) => { + return ( +
  • + {iconPosition == "left" && ( + + )} + + {iconPosition == "right" && ( + + )} +
  • + ); + }); + }; - attributes, - edit: Edit, - save: Save, - deprecated: [ - { - attributes, - save(props) { - const { - uniqueId, - interaction, - } = props.attributes + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; - const renderListItems = () => { - const { attributes: { listItems, iconPosition } } = props - return listItems.map((item, index) => { - return ( -
  • - {iconPosition == 'left' && } - - {iconPosition == 'right' && } -
  • - ) - }) - - } - - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - - return ( -
    -
    -
      - {renderListItems()} -
    -
    -
    - ) - } - } - ] + return ( +
    +
    +
      {renderListItems()}
    +
    +
    + ); + }, + }, + ], }); diff --git a/assets/reactjs/src/blocks/image-comparison/Edit.js b/assets/reactjs/src/blocks/image-comparison/Edit.js index 62cf13f7..c3c694e7 100644 --- a/assets/reactjs/src/blocks/image-comparison/Edit.js +++ b/assets/reactjs/src/blocks/image-comparison/Edit.js @@ -1,439 +1,445 @@ -import icons from '../../helpers/icons'; -import classnames from 'classnames'; +import icons from "../../helpers/icons"; +import classnames from "classnames"; const { __ } = wp.i18n; -const { - Fragment, - Component, - createRef -} = wp.element; +const { Fragment, Component, createRef } = wp.element; -const { - PanelBody, - Toolbar, - Tooltip -} = wp.components; +const { PanelBody, Toolbar, Tooltip } = wp.components; -const { - RichText, - BlockControls, - MediaPlaceholder, - InspectorControls, - MediaUpload -} = wp.blockEditor; +const { RichText, BlockControls, MediaPlaceholder, InspectorControls, MediaUpload } = wp.blockEditor; const { - Range, - RadioAdvanced, - Color, - Media, - Toggle, - Typography, - Inline: { - InlineToolbar - }, - ContextMenu: { - ContextMenu, - handleContextMenu - }, - gloalSettings: { - animationSettings, - interactionSettings, - globalSettingsPanel, - }, - InspectorTab, - InspectorTabs, - withCSSGenerator, + Range, + RadioAdvanced, + Color, + Media, + Toggle, + Typography, + Inline: { InlineToolbar }, + ContextMenu: { ContextMenu, handleContextMenu }, + gloalSettings: { animationSettings, interactionSettings, globalSettingsPanel }, + InspectorTab, + InspectorTabs, + withCSSGenerator, } = wp.qubelyComponents; -const DEFAULT_SIZE_SLUG = 'large'; -const ALLOWED_MEDIA_TYPES = ['image']; - +const DEFAULT_SIZE_SLUG = "large"; +const ALLOWED_MEDIA_TYPES = ["image"]; class Edit extends Component { - constructor(props) { - super(props) - this.state = { - device: 'md' - }; - this.qubelyContextMenu = createRef(); - } - - componentDidMount() { - const { - clientId, - setAttributes, - attributes: { - uniqueId - } - } = this.props; - const _client = clientId.substr(0, 6); - - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - - // image width - const imageComparisonRoot = document.querySelector('.qubely-block-image-comparison'); - const imageComparisonImages = document.querySelectorAll('.qubely-block-image-comparison img'); - imageComparisonImages.forEach((eachImg) => { - eachImg.style.width = imageComparisonRoot.offsetWidth + 'px'; - }); - } - - - dragFunc = (event) => { - const container = event.target.parentNode; - const resizeElement = container.querySelector('.resizable-img'); - const dragCircle = container.querySelector('.comparison-scrollCircle'); - this.draging(container, dragCircle, resizeElement); - } - - draging = (container, dragCircle, resizeElement) => { - let moving = () => { - let containerOffset = container.getBoundingClientRect().left - 40, - containerWidth = container.offsetWidth, - movingValue = ((event.pageX - 37) - containerOffset) / (containerWidth / 100); - if (movingValue < 10) - movingValue = 10; - else if (movingValue > 90) - movingValue = 90; - dragCircle.style.left = movingValue + '%'; - resizeElement.style.width = movingValue + '%'; - } - - container.addEventListener('mousemove', moving); - - let dragRevoveFunc = () => { - container.removeEventListener('mousemove', moving); - } - - container.addEventListener('mouseup', dragRevoveFunc); - window.addEventListener('mouseup', dragRevoveFunc); - - } - onSelectImage = (media, imageId) => { - if (!media || !media.url) { - return; - } - this.props.setAttributes(imageId === 'A' ? { - image: media - } : { - image2: media - } - ); - } - onUploadError = (message) => { - const { noticeOperations } = this.props; - noticeOperations.removeAllNotices(); - noticeOperations.createErrorNotice(message); - } - onSelectURL = (newURL, imageId) => { - - const { image, image2 } = this.props.attributes; - let currentImage = image; - if (imageId === 'B') { - currentImage = image2; - } - if (newURL !== currentImage.url) { - currentImage = { - ...currentImage, - url: newURL, - id: undefined, - sizeSlug: DEFAULT_SIZE_SLUG - } - } - this.props.setAttributes(imageId === 'A' ? { - image: currentImage - } : { - image2: currentImage - }); - } - - render() { - const { - name, - clientId, - noticeUI, - attributes, - setAttributes, - attributes: { - uniqueId, - className, - imageATitle, - titleColor, - typography, - imageBTitle, - controlColor, - disableTitle, - verticalAlign, - horizontalOffset, - verticalOffset, - image, - image2x, - imgAlt, - image2, - image2_2x, - imgAlt2, - - animation, - globalZindex, - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - hideTablet, - hideMobile, - globalCss, - interaction - } - } = this.props; - - const { device } = this.state; - - const renderPlaceholder = (imageId, title) => { - let selectedImage = image; - if (imageId === 'B') { - selectedImage = image2; - } - const mediaPreview = !!selectedImage.url && ( - {__('Edit - ); - return ( - this.onUploadError()} - labels={{ title }} - onSelect={media => this.onSelectImage(media, imageId)} - onSelectURL={newUrl => this.onSelectURL(newUrl, imageId)} - disableMediaButtons={selectedImage.url} - value={{ id: selectedImage.id, src: selectedImage.src }} - /> - ) - } - - const actionButtons = (id, attr) => { - return ( -
    - { - setAttributes({ [attr]: selectedImage }); - }} - allowedTypes={['image']} - render={({ open }) => ( - - - - )} - /> - - - - -
    - ) - } - - let validImageA = false, validImageB = false; - - if (image.url || image2x.url) { - validImageA = true; - } - if (image2.url || image2_2x.url) { - validImageB = true; - } - - - return ( - - - - - - setAttributes({ disableTitle: val })} /> - {disableTitle && - - setAttributes({ titleColor: value })} /> - setAttributes({ typography: value })} disableLineHeight device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ verticalAlign })} /> - - } - - setAttributes({ verticalOffset: value })} - unit={['px', '%']} - responsive device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - - setAttributes({ horizontalOffset: value })} - unit={['px', '%']} - responsive device={device} - onDeviceChange={value => this.setState({ device: value })} - /> - - setAttributes({ controlColor: value })} /> - - - setAttributes({ image2_2x: val })} /> - setAttributes({ image2x: val })} /> - - - - {animationSettings(uniqueId, animation, setAttributes)} - {interactionSettings(uniqueId, interaction, setAttributes)} - - - - - - - - - - - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} - -
    -
    handleContextMenu(event, this.qubelyContextMenu.current)} - > - -
    - { - validImageB ? -
    - {imgAlt2 - { - disableTitle && ( - setAttributes({ imageBTitle: value })} - /> - ) - } - {actionButtons(image2.id, 'image2')} -
    - : - renderPlaceholder('B', 'Image One') - - } -
    - -
    - { - validImageA ? -
    - { - {imgAlt - } - { - disableTitle && ( - setAttributes({ imageATitle: value })} - /> - ) - } - {actionButtons(image.id, 'image')} -
    - : - renderPlaceholder('A', 'Image Two') - - } -
    - { - (validImageA && validImageB) && - this.dragFunc(event)} /> - } - -
    - -
    - -
    -
    -
    - ) - } + constructor(props) { + super(props); + this.state = { + device: "md", + }; + this.qubelyContextMenu = createRef(); + } + + componentDidMount() { + // image width + const imageComparisonRoot = document.querySelector(".qubely-block-image-comparison"); + const imageComparisonImages = document.querySelectorAll(".qubely-block-image-comparison img"); + imageComparisonImages.forEach((eachImg) => { + eachImg.style.width = imageComparisonRoot.offsetWidth + "px"; + }); + } + + dragFunc = (event) => { + const container = event.target.parentNode; + const resizeElement = container.querySelector(".resizable-img"); + const dragCircle = container.querySelector(".comparison-scrollCircle"); + this.draging(container, dragCircle, resizeElement); + }; + + draging = (container, dragCircle, resizeElement) => { + let moving = () => { + let containerOffset = container.getBoundingClientRect().left - 40, + containerWidth = container.offsetWidth, + movingValue = (event.pageX - 37 - containerOffset) / (containerWidth / 100); + if (movingValue < 10) movingValue = 10; + else if (movingValue > 90) movingValue = 90; + dragCircle.style.left = movingValue + "%"; + resizeElement.style.width = movingValue + "%"; + }; + + container.addEventListener("mousemove", moving); + + let dragRevoveFunc = () => { + container.removeEventListener("mousemove", moving); + }; + + container.addEventListener("mouseup", dragRevoveFunc); + window.addEventListener("mouseup", dragRevoveFunc); + }; + onSelectImage = (media, imageId) => { + if (!media || !media.url) { + return; + } + this.props.setAttributes( + imageId === "A" + ? { + image: media, + } + : { + image2: media, + } + ); + }; + onUploadError = (message) => { + const { noticeOperations } = this.props; + noticeOperations.removeAllNotices(); + noticeOperations.createErrorNotice(message); + }; + onSelectURL = (newURL, imageId) => { + const { image, image2 } = this.props.attributes; + let currentImage = image; + if (imageId === "B") { + currentImage = image2; + } + if (newURL !== currentImage.url) { + currentImage = { + ...currentImage, + url: newURL, + id: undefined, + sizeSlug: DEFAULT_SIZE_SLUG, + }; + } + this.props.setAttributes( + imageId === "A" + ? { + image: currentImage, + } + : { + image2: currentImage, + } + ); + }; + + render() { + const { + name, + clientId, + noticeUI, + attributes, + setAttributes, + attributes: { + uniqueId, + className, + imageATitle, + titleColor, + typography, + imageBTitle, + controlColor, + disableTitle, + verticalAlign, + horizontalOffset, + verticalOffset, + image, + image2x, + imgAlt, + image2, + image2_2x, + imgAlt2, + + animation, + globalZindex, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + hideTablet, + hideMobile, + globalCss, + interaction, + }, + } = this.props; + + const { device } = this.state; + + const renderPlaceholder = (imageId, title) => { + let selectedImage = image; + if (imageId === "B") { + selectedImage = image2; + } + const mediaPreview = !!selectedImage.url && ( + {__("Edit + ); + return ( + this.onUploadError()} + labels={{ title }} + onSelect={(media) => this.onSelectImage(media, imageId)} + onSelectURL={(newUrl) => this.onSelectURL(newUrl, imageId)} + disableMediaButtons={selectedImage.url} + value={{ id: selectedImage.id, src: selectedImage.src }} + /> + ); + }; + + const actionButtons = (id, attr) => { + return ( +
    + { + setAttributes({ [attr]: selectedImage }); + }} + allowedTypes={["image"]} + render={({ open }) => ( + + + + )} + /> + + + + +
    + ); + }; + + let validImageA = false, + validImageB = false; + + if (image.url || image2x.url) { + validImageA = true; + } + if (image2.url || image2_2x.url) { + validImageB = true; + } + + return ( + + + + + + setAttributes({ disableTitle: val })} + /> + {disableTitle && ( + + setAttributes({ titleColor: value })} + /> + setAttributes({ typography: value })} + disableLineHeight + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ verticalAlign })} + /> + + )} + + setAttributes({ verticalOffset: value })} + unit={["px", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + setAttributes({ horizontalOffset: value })} + unit={["px", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + setAttributes({ controlColor: value })} + /> + + + setAttributes({ image2_2x: val })} + /> + setAttributes({ image2x: val })} + /> + + + + {animationSettings(uniqueId, animation, setAttributes)} + {interactionSettings(uniqueId, interaction, setAttributes)} + + + + + + + + + + + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} + +
    +
    handleContextMenu(event, this.qubelyContextMenu.current)} + > +
    + {validImageB ? ( +
    + {imgAlt2 + {disableTitle && ( + setAttributes({ imageBTitle: value })} + /> + )} + {actionButtons(image2.id, "image2")} +
    + ) : ( + renderPlaceholder("B", "Image One") + )} +
    + +
    + {validImageA ? ( +
    + { + {imgAlt + } + {disableTitle && ( + setAttributes({ imageATitle: value })} + /> + )} + {actionButtons(image.id, "image")} +
    + ) : ( + renderPlaceholder("A", "Image Two") + )} +
    + {validImageA && validImageB && ( + this.dragFunc(event)} /> + )} +
    + +
    + +
    +
    +
    + ); + } } -export default withCSSGenerator()(Edit); \ No newline at end of file +export default withCSSGenerator()(Edit); diff --git a/assets/reactjs/src/blocks/image-comparison/Save.js b/assets/reactjs/src/blocks/image-comparison/Save.js index 8288f720..2912aa62 100644 --- a/assets/reactjs/src/blocks/image-comparison/Save.js +++ b/assets/reactjs/src/blocks/image-comparison/Save.js @@ -1,7 +1,9 @@ -import classnames from 'classnames'; +import classnames from "classnames"; const { Component, Fragment } = wp.element; const { RichText } = wp.blockEditor; -const { HelperFunction: { animationAttr } } = wp.qubelyComponents; +const { + HelperFunction: { animationAttr }, +} = wp.qubelyComponents; class Save extends Component { render() { @@ -17,10 +19,11 @@ class Save extends Component { image2_2x, imgAlt2, animation, - verticalAlign + verticalAlign, } = this.props.attributes; - let validImageA = false, validImageB = false; + let validImageA = false, + validImageB = false; if (image.url || image2x.url) { validImageA = true; @@ -30,67 +33,72 @@ class Save extends Component { } return ( -
    - -
    - -
    - { - validImageB ? - - {imgAlt2 - - - : -
    - - } +
    +
    +
    + {validImageB ? ( + + {imgAlt2 + + + ) : ( +
    + +
    + )}
    -
    - { - validImageA ? - - {imgAlt - - - : -
    - } +
    + {validImageA ? ( + + {imgAlt + + + ) : ( +
    + +
    + )}
    - { - (validImageA && validImageB) && - - } + {validImageA && validImageB && }
    -
    ); } } -export default Save; \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/image-comparison/attributes.js b/assets/reactjs/src/blocks/image-comparison/attributes.js index 6ac1b5a2..4dffdbb0 100644 --- a/assets/reactjs/src/blocks/image-comparison/attributes.js +++ b/assets/reactjs/src/blocks/image-comparison/attributes.js @@ -1,182 +1,193 @@ const { - gloalSettings: { - globalAttributes - } -} = wp.qubelyComponents + gloalSettings: { globalAttributes }, +} = wp.qubelyComponents; export const attributes = { - uniqueId: { - type: 'string', - default: '' - }, - // Global - ...globalAttributes, - recreateStyles: { - type: 'boolean', - default: true - }, + uniqueId: { + type: "string", + default: "", + }, + // Global + ...globalAttributes, + recreateStyles: { + type: "boolean", + default: true, + }, - ...globalAttributes, - spacer: { - type: 'object', - default: { - spaceTop: { - md: '10', - unit: "px" - }, - spaceBottom: { - md: '10', - unit: "px" - } - }, - style: [ - { selector: '{{QUBELY}}' } - ] - }, - alignment: { - type: 'object', - default: { - md: 'left' - }, - style: [{ - selector: '{{QUBELY}} .qubely-block-image {text-align: {{alignment}};}' - }] - }, - animateOnHover: { - type: 'boolean', - default: true - }, - // original image - imgSize: { - type: 'string', - default: 'full' - }, - image: { - type: 'object', - default: {} - }, - imageType: { - type: 'string', - default: 'local' - }, - externalImageUrl: { - type: 'object', - default: {} - }, - imageUrl: { type: 'object', default: {} }, - // modified image - image2x: { - type: 'object', - default: {} - }, - imgAlt: { - type: 'string', - default: '' - }, - imgSize2: { - type: 'string', - default: 'full' - }, - image2: { - type: 'object', - default: {} - }, - imageType2: { - type: 'string', - default: 'local' - }, - verticalAlign: { - type: 'string', - default: 'bottom' - }, - externalImageUrl2: { - type: 'object', - default: {} - }, - image2_2x: { - type: 'object', - default: {} - }, - imageUrl2: { type: 'object', default: {} }, - imgAlt2: { - type: 'string', - default: '' - }, + ...globalAttributes, + spacer: { + type: "object", + default: { + spaceTop: { + md: "10", + unit: "px", + }, + spaceBottom: { + md: "10", + unit: "px", + }, + }, + style: [{ selector: "{{QUBELY}}" }], + }, + alignment: { + type: "object", + default: { + md: "left", + }, + style: [ + { + selector: "{{QUBELY}} .qubely-block-image {text-align: {{alignment}};}", + }, + ], + }, + animateOnHover: { + type: "boolean", + default: true, + }, + // original image + imgSize: { + type: "string", + default: "full", + }, + image: { + type: "object", + default: {}, + }, + imageType: { + type: "string", + default: "local", + }, + externalImageUrl: { + type: "object", + default: {}, + }, + imageUrl: { type: "object", default: {} }, + // modified image + image2x: { + type: "object", + default: {}, + }, + imgAlt: { + type: "string", + default: "", + }, + imgSize2: { + type: "string", + default: "full", + }, + image2: { + type: "object", + default: {}, + }, + imageType2: { + type: "string", + default: "local", + }, + verticalAlign: { + type: "string", + default: "bottom", + }, + externalImageUrl2: { + type: "object", + default: {}, + }, + image2_2x: { + type: "object", + default: {}, + }, + imageUrl2: { type: "object", default: {} }, + imgAlt2: { + type: "string", + default: "", + }, - // Title - imageATitle: { - type: 'string', - default: 'Original', - }, - titleLevel: { - type: 'number', - default: 3 - }, - typography: { - type: 'object', - default: { - openTypography: 0, - size: { - md: 30, - unit: 'px' - } - }, - style: [{ - selector: '{{QUBELY}} .qubely-block-image-comparison .image-container .comparison-image-text' - }] - }, - titleColor: { - type: 'string', - default: '#FFF', - style: [{ - selector: '{{QUBELY}} .qubely-block-image-comparison .image-container .comparison-image-text {color: {{titleColor}};}' - }] - }, - imageBTitle: { - type: 'string', - default: 'Modified' - }, + // Title + imageATitle: { + type: "string", + default: "Original", + }, + titleLevel: { + type: "number", + default: 3, + }, + typography: { + type: "object", + default: { + openTypography: 0, + size: { + md: 30, + unit: "px", + }, + }, + style: [ + { + selector: "{{QUBELY}} .qubely-block-image-comparison .image-container .comparison-image-text", + }, + ], + }, + titleColor: { + type: "string", + default: "#FFF", + style: [ + { + selector: + "{{QUBELY}} .qubely-block-image-comparison .image-container .comparison-image-text {color: {{titleColor}};}", + }, + ], + }, + imageBTitle: { + type: "string", + default: "Modified", + }, - horizontalOffset: { - type: 'object', - default: { md: 25, unit: 'px' }, - style: [{ - selector: '{{QUBELY}} .qubely-block-image-comparison .image-container.image-A .comparison-image-text {right: {{horizontalOffset}}}' + - '{{QUBELY}} .qubely-block-image-comparison .image-container.image-B .comparison-image-text {left: {{horizontalOffset}}}' - }] - }, + horizontalOffset: { + type: "object", + default: { md: 25, unit: "px" }, + style: [ + { + selector: + "{{QUBELY}} .qubely-block-image-comparison .image-container.image-A .comparison-image-text {right: {{horizontalOffset}}}" + + "{{QUBELY}} .qubely-block-image-comparison .image-container.image-B .comparison-image-text {left: {{horizontalOffset}}}", + }, + ], + }, - verticalOffset: { - type: 'object', - default: { md: 15, unit: 'px' }, - style: [{ - selector: '.qubely-block-image-comparison .image-container .comparison-image-text.text-vertical-align-top { top: {{verticalOffset}}; }' + - '.qubely-block-image-comparison .image-container .comparison-image-text.text-vertical-align-bottom { bottom: {{verticalOffset}}; }' - }] - }, + verticalOffset: { + type: "object", + default: { md: 15, unit: "px" }, + style: [ + { + selector: + ".qubely-block-image-comparison .image-container .comparison-image-text.text-vertical-align-top { top: {{verticalOffset}}; }" + + ".qubely-block-image-comparison .image-container .comparison-image-text.text-vertical-align-bottom { bottom: {{verticalOffset}}; }", + }, + ], + }, - // circle + // circle - controlColor: { - type: 'string', - default: '#ffffff', - style: [{ - selector: '{{QUBELY}} .qubely-block-image-comparison:not(.has-child-placeholder) .image-container.image-B {border-right-color: {{controlColor}}}' + - '{{QUBELY}} .qubely-block-image-comparison .comparison-scrollCircle {background-color: {{controlColor}}}' + - '{{QUBELY}} .qubely-block-image-comparison .comparison-scrollCircle::after {border-right-color: {{controlColor}}}' + - '{{QUBELY}} .qubely-block-image-comparison .comparison-scrollCircle::before {border-left-color: {{controlColor}}}' - }] - }, + controlColor: { + type: "string", + default: "#ffffff", + style: [ + { + selector: + "{{QUBELY}} .qubely-block-image-comparison:not(.has-child-placeholder) .image-container.image-B {border-right-color: {{controlColor}}}" + + "{{QUBELY}} .qubely-block-image-comparison .comparison-scrollCircle {background-color: {{controlColor}}}" + + "{{QUBELY}} .qubely-block-image-comparison .comparison-scrollCircle::after {border-right-color: {{controlColor}}}" + + "{{QUBELY}} .qubely-block-image-comparison .comparison-scrollCircle::before {border-left-color: {{controlColor}}}", + }, + ], + }, + disableTitle: { + type: "boolean", + default: true, + }, - disableTitle: { - type: 'boolean', - default: true - }, - - // Content - contentAnimation: { - type: 'string', - default: 'zoom-out' - }, -}; \ No newline at end of file + // Content + contentAnimation: { + type: "string", + default: "zoom-out", + }, +}; diff --git a/assets/reactjs/src/blocks/image-comparison/index.js b/assets/reactjs/src/blocks/image-comparison/index.js index d5f65b2b..2dcc488c 100644 --- a/assets/reactjs/src/blocks/image-comparison/index.js +++ b/assets/reactjs/src/blocks/image-comparison/index.js @@ -1,33 +1,25 @@ -import './style.scss'; -import Edit from './Edit'; -import Save from './Save'; -import { attributes } from './attributes'; +import "./style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +import { attributes } from "./attributes"; const { __ } = wp.i18n; const { registerBlockType } = wp.blocks; -registerBlockType('qubely/imagecomparison', { - title: __('Image Comparison'), - description: __('Compare Images with Qubely'), - category: 'qubely', - icon: {__('Image, - keywords: [ - __('image'), - __('image comparison'), - __('comparison'), - ], - supports: { - align: [ - 'center', - 'wide', - 'full' - ], - }, - example: { - attributes: { - - }, - }, - attributes, - edit: Edit, - save: Save, -}); \ No newline at end of file +registerBlockType("qubely/imagecomparison", { + title: __("Image Comparison"), + description: __("Compare Images with Qubely"), + category: "qubely", + icon: ( + {__("Image + ), + keywords: [__("image"), __("image comparison"), __("comparison")], + supports: { + align: ["center", "wide", "full"], + }, + example: { + attributes: {}, + }, + attributes, + edit: Edit, + save: Save, +}); diff --git a/assets/reactjs/src/blocks/image-comparison/style.scss b/assets/reactjs/src/blocks/image-comparison/style.scss index bc5e1e4d..a5e39498 100644 --- a/assets/reactjs/src/blocks/image-comparison/style.scss +++ b/assets/reactjs/src/blocks/image-comparison/style.scss @@ -1,162 +1,160 @@ // image comparison css .qubely-block-image-comparison { - position: relative; - width: 100%; - margin: 0 auto; - display: -webkit-box; - display: -ms-flexbox; - display: flex; + position: relative; + width: 100%; + margin: 0 auto; + display: -webkit-box; + display: -ms-flexbox; + display: flex; - .image-container { - position: relative; - &.valid-images { - display: inline-block; - } - .qubely-media-actions { - top: 13px; - right: 15px; - position: absolute; - display: inline-flex; - vertical-align: middle; - opacity: 0; - visibility: hidden; - transition: 200ms; - .qubely-button { - font-size: 15px; - &:not(:last-child){ - border-right: none; - border-top-right-radius: 0; - border-bottom-right-radius: 0; - } - &:not(:first-child) { - border-top-left-radius: 0; - border-bottom-left-radius: 0; - } - } - } + .image-container { + position: relative; + &.valid-images { + display: inline-block; + } + .qubely-media-actions { + top: 13px; + right: 15px; + position: absolute; + display: inline-flex; + vertical-align: middle; + opacity: 0; + visibility: hidden; + transition: 200ms; + .qubely-button { + font-size: 15px; + &:not(:last-child) { + border-right: none; + border-top-right-radius: 0; + border-bottom-right-radius: 0; + } + &:not(:first-child) { + border-top-left-radius: 0; + border-bottom-left-radius: 0; + } + } + } - &:hover .qubely-media-actions{ - opacity: 1; - visibility: visible; - } + &:hover .qubely-media-actions { + opacity: 1; + visibility: visible; + } - .comparison-image-text { - position: absolute; - opacity: 1; - color: #fff; - bottom: 15px; - left: 25px; - font-size: 20px; - user-select: none; - white-space: nowrap; - &.text-vertical-align-top{ - bottom: auto; - top: 15px; - } - } + .comparison-image-text { + position: absolute; + opacity: 1; + color: #fff; + bottom: 15px; + left: 25px; + font-size: 20px; + user-select: none; + white-space: nowrap; + &.text-vertical-align-top { + bottom: auto; + top: 15px; + } + } - img{ - display: block; - width: 100%; - user-select: none; - } + img { + display: block; + width: 100%; + user-select: none; + } - &.image-A { - &.valid-images { - width: 100%; - } - .comparison-image-text{ - left: auto; - right: 25px; - } - } - &.image-B { - .qubely-media-actions{ - right: auto; - left: 15px; - } - &.resizable-img { - z-index: 1; - position: absolute; - top: 0; - left: 0; - width: 50%; - height: 100%; - overflow: hidden; - img { - position: absolute; - left: 0; - top: 0; - height: 100%; - width: auto; - max-width: none; - } - } - } + &.image-A { + &.valid-images { + width: 100%; + } + .comparison-image-text { + left: auto; + right: 25px; + } + } + &.image-B { + .qubely-media-actions { + right: auto; + left: 15px; + } + &.resizable-img { + z-index: 1; + position: absolute; + top: 0; + left: 0; + width: 50%; + height: 100%; + overflow: hidden; + img { + position: absolute; + left: 0; + top: 0; + height: 100%; + width: auto; + max-width: none; + } + } + } + } + &:not(.has-child-placeholder) { + .image-container.image-B { + border-right: 3px solid #ffffff; + } + } - } - &:not(.has-child-placeholder) { - .image-container.image-B{ - border-right: 3px solid #ffffff; - } - } - - &.has-child-placeholder .image-container{ - max-width: 50%; - flex-basis: 50%; - flex-grow: 1; - margin: 0 5px; - img{ - min-height: 100%; - object-fit: cover; - - } - .components-placeholder__instructions{ - display: block; - } - .image-container-inner{ - height: 100%; - } - } - .comparison-scrollCircle { - position: absolute; - top: 50%; - left: calc(50%); - cursor: move; - transform: translateY(-50%); - z-index: 9; - text-align: center; - height: 52px; - width: 8px; - background: white; - border-radius: 1px; - margin-left: -5.5px; - &::after, - &::before{ - content: ''; - position: absolute; - border: 7px solid transparent; - border-left: 8px solid white; - left: 100%; - top: 50%; - transform: translateY(-50%) translateX(3px); - transition: 300ms; - } - &::after{ - border-left-color: transparent; - border-right: 8px solid white; - left: auto; - right: 100%; - margin-left: 0; - transform: translateY(-50%) translateX(-3px); - } - &:hover { - &::before { - transform: translateY(-50%) translateX(5px); - } - &::after{ - transform: translateY(-50%) translateX(-5px); - } - } - } + &.has-child-placeholder .image-container { + max-width: 50%; + flex-basis: 50%; + flex-grow: 1; + margin: 0 5px; + img { + min-height: 100%; + object-fit: cover; + } + .components-placeholder__instructions { + display: block; + } + .image-container-inner { + height: 100%; + } + } + .comparison-scrollCircle { + position: absolute; + top: 50%; + left: calc(50%); + cursor: move; + transform: translateY(-50%); + z-index: 9; + text-align: center; + height: 52px; + width: 8px; + background: white; + border-radius: 1px; + margin-left: -5.5px; + &::after, + &::before { + content: ""; + position: absolute; + border: 7px solid transparent; + border-left: 8px solid white; + left: 100%; + top: 50%; + transform: translateY(-50%) translateX(3px); + transition: 300ms; + } + &::after { + border-left-color: transparent; + border-right: 8px solid white; + left: auto; + right: 100%; + margin-left: 0; + transform: translateY(-50%) translateX(-3px); + } + &:hover { + &::before { + transform: translateY(-50%) translateX(5px); + } + &::after { + transform: translateY(-50%) translateX(-5px); + } + } + } } diff --git a/assets/reactjs/src/blocks/image/Edit.js b/assets/reactjs/src/blocks/image/Edit.js index fbfe7931..4d85186e 100644 --- a/assets/reactjs/src/blocks/image/Edit.js +++ b/assets/reactjs/src/blocks/image/Edit.js @@ -1,399 +1,741 @@ -const { __ } = wp.i18n +const { __ } = wp.i18n; const { Fragment, Component, createRef } = wp.element; -const { PanelBody, TextControl, Toolbar, SelectControl } = wp.components -const { RichText, InspectorControls, BlockControls } = wp.blockEditor -const { Media, Range, BoxShadow, ButtonGroup, Tabs, Tab, RadioAdvanced, Typography, Toggle, Styles, Alignment, ColorAdvanced, Color, Headings, Border, BorderRadius, Padding, Separator, Select, Margin, Url, gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, Inline: { InlineToolbar }, ContextMenu: { ContextMenu, handleContextMenu }, withCSSGenerator, InspectorTabs, InspectorTab } = wp.qubelyComponents -import icons from '../../helpers/icons' +const { PanelBody, TextControl, Toolbar, SelectControl } = wp.components; +const { RichText, InspectorControls, BlockControls } = wp.blockEditor; +const { + Media, + Range, + BoxShadow, + ButtonGroup, + Tabs, + Tab, + RadioAdvanced, + Typography, + Toggle, + Styles, + Alignment, + ColorAdvanced, + Color, + Headings, + Border, + BorderRadius, + Padding, + Separator, + Select, + Margin, + Url, + gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, + Inline: { InlineToolbar }, + ContextMenu: { ContextMenu, handleContextMenu }, + withCSSGenerator, + InspectorTabs, + InspectorTab, +} = wp.qubelyComponents; +import icons from "../../helpers/icons"; class Edit extends Component { - - constructor(props) { - super(props) - this.state = { - device: 'md', - selector: true, - spacer: true, - openPanelSetting: '' - }; - this.qubelyContextMenu = createRef(); - } - - componentDidMount() { - const { setAttributes, clientId, attributes: { uniqueId } } = this.props - const _client = clientId.substr(0, 6) - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - } - } - - handlePanelOpenings = (panelName) => { - this.setState({ ...this.state, openPanelSetting: panelName }) - } - - render() { - const { - uniqueId, - recreateStyles, - className, - layout, - alignment, - animateOnHover, - title, - titleLevel, - titleTypography, - titleColor, - titleVisibleOnHover, - - enableSubTitle, - subTitle, - subTitleTypography, - subTitleColor, - subTitleSpacing, - subTitleVisibleOnHover, - - - contentAnimation, - contentPadding, - contentVerticalAlign, - contentAlignment, - - imgSize, - image, - imageType, - externalImageUrl, - image2x, - imgAlt, - imageUrl, - imageSize, - imageHeight, - imageSizeCustom, - imageCustomHeight, - imageBorderRadius, - imageOpacity, - imageBoxShadow, - imageBoxShadowHover, - - enableCaption, - imageCaption, - captionTypography, - captionColor, - captionSpacing, - - enableOverlay, - overlayBg, - overlayHoverBg, - overlayBlend, - - enableFrame, - frameBorder, - frameMargin, - frameSendToBack, - frameAnimateOnHover, - frameBorderRadius, - - animation, - globalZindex, - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - hideTablet, - hideMobile, - globalCss, - interaction - } = this.props.attributes - - const { name, clientId, attributes, setAttributes, isSelected } = this.props - const { openPanelSetting, device } = this.state - - const titleTagName = 'h' + titleLevel; - return ( - - - - - - setAttributes({ layout: val })} - options={[ - { value: 'simple', svg: icons.image.simple, label: __('Simple') }, - { value: 'blurb', svg: icons.image.blurb, label: __('Blurb') } - ]} - /> - setAttributes({ alignment: val })} alignmentType="content" disableJustify responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - setAttributes({ imageType: value })} - /> - { - imageType === 'local' ? - - setAttributes({ image: val })} /> - setAttributes({ image2x: val })} /> - - : - setAttributes({ externalImageUrl: newUrl })} /> - } - - setAttributes({ imageUrl: value })} /> - - setAttributes({ imgAlt: val })} /> - setAttributes({ imageSize: value, recreateStyles: !recreateStyles })} - options={[ - { label: __('Auto'), value: 'auto', title: __('Auto') }, - { label: __('S'), value: '300px', title: __('Small') }, - { label: __('M'), value: '600px', title: __('Medium') }, - { label: __('L'), value: '800px', title: __('Large') }, - { icon: 'fas fa-cog', value: 'custom', title: __('Custom') }, - ]} - /> - {imageSize == 'custom' && - - setAttributes({ imageSizeCustom: val })} min={10} max={1920} responsive unit={['px', 'em', '%']} device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - } - setAttributes({ imageHeight: value, recreateStyles: !recreateStyles })} - options={[ - { label: __('Auto'), value: 'auto', title: __('Auto') }, - { label: __('Custom'), value: 'custom', title: __('Custom') }, - ]} - /> - {imageHeight == 'custom' && - - setAttributes({ imageCustomHeight: val })} min={10} max={1920} responsive unit={['px', 'em', '%']} device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - } - setAttributes({ imageOpacity: parseFloat(val) })} min={0.1} max={1} step={.1} /> - setAttributes({ imageBorderRadius: val })} min={0} max={100} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - setAttributes({ imageBoxShadow: val })} disableInset /> - - - setAttributes({ imageBoxShadowHover: val })} disableInset /> - - - - - {layout == 'blurb' && - - - setAttributes({ titleLevel: value })} /> - setAttributes({ titleTypography: val })} device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ titleColor: val })} /> - - - setAttributes({ enableSubTitle: val })} /> - {enableSubTitle == 1 && - - setAttributes({ subTitleColor: val })} /> - setAttributes({ subTitleTypography: val })} device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ subTitleSpacing: val })} min={0} max={100} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - } - - - setAttributes({ animateOnHover: val })} /> - {animateOnHover == 1 && - - setAttributes({ overlayBlend: val })} /> - - } - - - - setAttributes({ enableFrame: val })} /> - {enableFrame == 1 && - - setAttributes({ frameBorder: val })} responsive unit={['px', 'em', '%']} device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ frameMargin: value })} - unit={['px', 'em', '%']} - max={150} - min={-150} - responsive - device={device} - onDeviceChange={value => this.setState({ device: value })} /> - - setAttributes({ frameBorderRadius: val })} min={0} max={100} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - setAttributes({ frameSendToBack: val })} /> - {animateOnHover == 1 && - setAttributes({ frameAnimateOnHover: val })} /> - } - - } - - - } - - {layout == 'simple' && - - setAttributes({ enableCaption: val })} /> - {enableCaption == 1 && - - setAttributes({ captionTypography: val })} device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ captionColor: val })} /> - setAttributes({ captionSpacing: val })} min={0} max={100} responsive unit={['px', 'em', '%']} device={device} onDeviceChange={value => this.setState({ device: value })} /> - - } - - } - - - {animationSettings(uniqueId, animation, setAttributes)} - {interactionSettings(uniqueId, interaction, setAttributes)} - - - - - - - - - - - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} - -
    -
    handleContextMenu(event, this.qubelyContextMenu.current)} - > -
    this.handlePanelOpenings('Media')}> -
    -
    - - { - (imageType === 'local' && image.url != undefined) ? - - {image2x.url != undefined ? - {imgAlt - : - {imgAlt - } - - : - (imageType === 'external' && externalImageUrl.url != undefined) ? - {imgAlt - : -
    - } - - {layout == 'blurb' && -
    -
    - setAttributes({ title: value })} - placeholder={__('Add Title…')} - /> - - {enableSubTitle == 1 && - setAttributes({ subTitle: value })} - placeholder={__('Add Sub Title…')} - /> - } - - -
    -
    - } -
    - - {(layout == 'simple' && enableCaption == 1) && - setAttributes({ imageCaption: value })} - value={imageCaption} - /> - } -
    -
    -
    - -
    -
    -
    -
    - ) - } + constructor(props) { + super(props); + this.state = { + device: "md", + selector: true, + spacer: true, + openPanelSetting: "", + }; + this.qubelyContextMenu = createRef(); + } + + handlePanelOpenings = (panelName) => { + this.setState({ ...this.state, openPanelSetting: panelName }); + }; + + render() { + const { + uniqueId, + recreateStyles, + className, + layout, + alignment, + animateOnHover, + title, + titleLevel, + titleTypography, + titleColor, + titleVisibleOnHover, + + enableSubTitle, + subTitle, + subTitleTypography, + subTitleColor, + subTitleSpacing, + subTitleVisibleOnHover, + + contentAnimation, + contentPadding, + contentVerticalAlign, + contentAlignment, + + imgSize, + image, + imageType, + externalImageUrl, + image2x, + imgAlt, + imageUrl, + imageSize, + imageHeight, + imageSizeCustom, + imageCustomHeight, + imageBorderRadius, + imageOpacity, + imageBoxShadow, + imageBoxShadowHover, + + enableCaption, + imageCaption, + captionTypography, + captionColor, + captionSpacing, + + enableOverlay, + overlayBg, + overlayHoverBg, + overlayBlend, + + enableFrame, + frameBorder, + frameMargin, + frameSendToBack, + frameAnimateOnHover, + frameBorderRadius, + + animation, + globalZindex, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + hideTablet, + hideMobile, + globalCss, + interaction, + } = this.props.attributes; + + const { name, clientId, attributes, setAttributes, isSelected } = this.props; + const { openPanelSetting, device } = this.state; + + const titleTagName = "h" + titleLevel; + return ( + + + + + + setAttributes({ layout: val })} + options={[ + { value: "simple", svg: icons.image.simple, label: __("Simple") }, + { value: "blurb", svg: icons.image.blurb, label: __("Blurb") }, + ]} + /> + setAttributes({ alignment: val })} + alignmentType="content" + disableJustify + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ imageType: value })} + /> + {imageType === "local" ? ( + + setAttributes({ image: val })} + /> + setAttributes({ image2x: val })} + /> + + ) : ( + setAttributes({ externalImageUrl: newUrl })} + /> + )} + + setAttributes({ imageUrl: value })} + /> + + setAttributes({ imgAlt: val })} + /> + + setAttributes({ imageSize: value, recreateStyles: !recreateStyles }) + } + options={[ + { label: __("Auto"), value: "auto", title: __("Auto") }, + { label: __("S"), value: "300px", title: __("Small") }, + { label: __("M"), value: "600px", title: __("Medium") }, + { label: __("L"), value: "800px", title: __("Large") }, + { icon: "fas fa-cog", value: "custom", title: __("Custom") }, + ]} + /> + {imageSize == "custom" && ( + + setAttributes({ imageSizeCustom: val })} + min={10} + max={1920} + responsive + unit={["px", "em", "%"]} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + )} + + setAttributes({ imageHeight: value, recreateStyles: !recreateStyles }) + } + options={[ + { label: __("Auto"), value: "auto", title: __("Auto") }, + { label: __("Custom"), value: "custom", title: __("Custom") }, + ]} + /> + {imageHeight == "custom" && ( + + setAttributes({ imageCustomHeight: val })} + min={10} + max={1920} + responsive + unit={["px", "em", "%"]} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + )} + setAttributes({ imageOpacity: parseFloat(val) })} + min={0.1} + max={1} + step={0.1} + /> + setAttributes({ imageBorderRadius: val })} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ imageBoxShadow: val })} + disableInset + /> + + + setAttributes({ imageBoxShadowHover: val })} + disableInset + /> + + + + + {layout == "blurb" && ( + + + setAttributes({ titleLevel: value })} + /> + setAttributes({ titleTypography: val })} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ titleColor: val })} + /> + + + setAttributes({ enableSubTitle: val })} + /> + {enableSubTitle == 1 && ( + + setAttributes({ subTitleColor: val })} + /> + setAttributes({ subTitleTypography: val })} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ subTitleSpacing: val })} + min={0} + max={100} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + )} + + + setAttributes({ animateOnHover: val })} + /> + {animateOnHover == 1 && ( + + setAttributes({ overlayBlend: val })} + /> + + )} + + + + setAttributes({ enableFrame: val })} + /> + {enableFrame == 1 && ( + + setAttributes({ frameBorder: val })} + responsive + unit={["px", "em", "%"]} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ frameMargin: value })} + unit={["px", "em", "%"]} + max={150} + min={-150} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + setAttributes({ frameBorderRadius: val })} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + setAttributes({ frameSendToBack: val })} + /> + {animateOnHover == 1 && ( + setAttributes({ frameAnimateOnHover: val })} + /> + )} + + )} + + + )} + + {layout == "simple" && ( + + setAttributes({ enableCaption: val })} + /> + {enableCaption == 1 && ( + + setAttributes({ captionTypography: val })} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ captionColor: val })} + /> + setAttributes({ captionSpacing: val })} + min={0} + max={100} + responsive + unit={["px", "em", "%"]} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + )} + + )} + + + {animationSettings(uniqueId, animation, setAttributes)} + {interactionSettings(uniqueId, interaction, setAttributes)} + + + + + + + + + + + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} + +
    +
    handleContextMenu(event, this.qubelyContextMenu.current)} + > +
    this.handlePanelOpenings("Media")} + > +
    +
    + {imageType === "local" && image.url != undefined ? ( + + {image2x.url != undefined ? ( + {imgAlt + ) : ( + {imgAlt + )} + + ) : imageType === "external" && externalImageUrl.url != undefined ? ( + {imgAlt + ) : ( +
    + +
    + )} + + {layout == "blurb" && ( +
    +
    + setAttributes({ title: value })} + placeholder={__("Add Title…")} + /> + + {enableSubTitle == 1 && ( + setAttributes({ subTitle: value })} + placeholder={__("Add Sub Title…")} + /> + )} +
    +
    + )} +
    + + {layout == "simple" && enableCaption == 1 && ( + setAttributes({ imageCaption: value })} + value={imageCaption} + /> + )} +
    +
    +
    + +
    +
    +
    +
    + ); + } } -export default withCSSGenerator()(Edit); \ No newline at end of file +export default withCSSGenerator()(Edit); diff --git a/assets/reactjs/src/blocks/image/Save.js b/assets/reactjs/src/blocks/image/Save.js index fb2aa0ed..1d5aa16a 100644 --- a/assets/reactjs/src/blocks/image/Save.js +++ b/assets/reactjs/src/blocks/image/Save.js @@ -1,118 +1,171 @@ const { Component, Fragment } = wp.element; -const { RichText } = wp.blockEditor -const { HelperFunction: { IsInteraction, animationAttr } } = wp.qubelyComponents +const { RichText } = wp.blockEditor; +const { + HelperFunction: { IsInteraction, animationAttr }, +} = wp.qubelyComponents; class Save extends Component { + renderImage = () => { + const { + attributes: { image, imageType, image2x, imgAlt, externalImageUrl }, + } = this.props; + return ( + + {imageType === "local" && image.url != undefined ? ( + + {image2x.url != undefined ? ( + {imgAlt + ) : ( + {imgAlt + )} + + ) : imageType === "external" && externalImageUrl.url != undefined ? ( + {imgAlt + ) : ( +
    + +
    + )} +
    + ); + }; - renderImage = () => { - const { attributes: { image, imageType, image2x, imgAlt, externalImageUrl } } = this.props - return ( - - { - (imageType === 'local' && image.url != undefined) ? - - {image2x.url != undefined ? - {imgAlt - : - {imgAlt - } - - : - (imageType === 'external' && externalImageUrl.url != undefined) ? - {imgAlt - : -
    - } -
    - ) - } + render() { + const { + attributes: { + uniqueId, + layout, + imageUrl, + animateOnHover, + titleVisibleOnHover, + subTitleVisibleOnHover, + title, + titleLevel, + subTitle, + enableSubTitle, + imageCaption, + enableCaption, + contentAnimation, + contentVerticalAlign, + contentAlignment, + enableFrame, + frameAnimateOnHover, + interaction, + animation, + }, + } = this.props; - render() { - const { - attributes: { - uniqueId, - layout, - imageUrl, - animateOnHover, - titleVisibleOnHover, - subTitleVisibleOnHover, - title, - titleLevel, - subTitle, - enableSubTitle, - imageCaption, - enableCaption, - contentAnimation, - contentVerticalAlign, - contentAlignment, - enableFrame, - frameAnimateOnHover, - interaction, - animation - } - } = this.props + const titleTagName = "h" + titleLevel; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + let ContainerTag = "div"; + if (layout === "blurb") { + ContainerTag = "a"; + } + return ( +
    +
    +
    +
    + + {imageUrl.url && layout === "simple" ? ( + + {this.renderImage()} + + ) : ( + this.renderImage() + )} - const titleTagName = 'h' + titleLevel; - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - let ContainerTag = 'div'; - if (layout === 'blurb') { - ContainerTag = 'a'; - } - return ( -
    -
    -
    -
    - - { - (imageUrl.url && layout === 'simple') ? - - {this.renderImage()} - - : this.renderImage() - } + {layout == "blurb" && ( +
    +
    + - {layout == 'blurb' && -
    -
    - + {enableSubTitle == 1 && ( + + )} +
    +
    + )} + - {enableSubTitle == 1 && - - } -
    -
    - } -
    - - {(layout == 'simple' && enableCaption == 1) && - - } -
    -
    -
    -
    - ); - } + {layout == "simple" && enableCaption == 1 && ( + + )} +
    +
    +
    +
    + ); + } } -export default Save; \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/image/index.js b/assets/reactjs/src/blocks/image/index.js index 94d597c8..4ed50c3a 100644 --- a/assets/reactjs/src/blocks/image/index.js +++ b/assets/reactjs/src/blocks/image/index.js @@ -1,779 +1,917 @@ -import './style.scss' -import Edit from './Edit' -import Save from './Save'; -const { __ } = wp.i18n -const { RichText } = wp.blockEditor -const { registerBlockType } = wp.blocks +import "./style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +const { __ } = wp.i18n; +const { RichText } = wp.blockEditor; +const { registerBlockType } = wp.blocks; const { Component, Fragment } = wp.element; const { - gloalSettings: { globalAttributes }, - HelperFunction: { IsInteraction, animationAttr } -} = wp.qubelyComponents + gloalSettings: { globalAttributes }, + HelperFunction: { IsInteraction, animationAttr }, +} = wp.qubelyComponents; const attributes = { - - uniqueId: { - type: 'string', - default: '' - }, - recreateStyles: { - type: 'boolean', - default: true - }, - ...globalAttributes, - spacer: { - type: 'object', - default: { - spaceTop: { - md: '10', - unit: "px" - }, - spaceBottom: { - md: '10', - unit: "px" - } - }, - style: [ - { selector: '{{QUBELY}}' } - ] - }, - - alignment: { - type: 'object', - default: { - md: 'left' - }, - style: [{ - selector: '{{QUBELY}} .qubely-block-image {text-align: {{alignment}};}' - }] - }, - - animateOnHover: { - type: 'boolean', - default: true - }, - - layout: { - type: 'string', - default: 'simple' - }, - imgSize: { - type: 'string', - default: 'full' - }, - - image: { - type: 'object', - default: {} - }, - imageType: { - type: 'string', - default: 'local' - }, - externalImageUrl: { - type: 'object', - default: {} - }, - - image2x: { - type: 'object', - default: {} - }, - imageUrl: { type: 'object', default: {} }, - imageSize: { - type: 'string', - default: 'auto', - style: [{ - condition: [ - { key: 'imageSize', relation: '!=', value: 'auto' }, - { key: 'imageSize', relation: '!=', value: 'custom' }, - ], - selector: '{{QUBELY}} .qubely-image-image {width: {{imageSize}};}' - }] - }, - - imageSizeCustom: { - type: 'object', - default: { - md: 300, - unit: 'px' - }, - style: [{ - condition: [ - { key: 'imageSize', relation: '==', value: 'custom' }, - ], - selector: '{{QUBELY}} .qubely-image-image {width: {{imageSizeCustom}};}' - }] - }, - imageHeight: { - type: 'string', - default: 'auto', - style: [{ - condition: [ - { key: 'imageHeight', relation: '==', value: 'auto' }, - ], - selector: '{{QUBELY}} .qubely-image-image {height: auto;}' - }] - }, - - imageCustomHeight: { - type: 'object', - default: { - md: 300, - unit: 'px' - }, - style: [{ - condition: [ - { key: 'imageHeight', relation: '==', value: 'custom' }, - ], - selector: '{{QUBELY}} .qubely-image-image {height: {{imageCustomHeight}};}' - }] - }, - - imgAlt: { - type: 'string', - default: '' - }, - - imageOpacity: { - type: 'number', - default: 1, - style: [{ - selector: '{{QUBELY}} .qubely-image-image {opacity: {{imageOpacity}};}' - }] - }, - - imageBorderRadius: { - type: 'object', - default: { - openBorderRadius: 0, - radiusType: 'global', - global: {}, - unit: 'px', - - }, - style: [{ - selector: '{{QUBELY}} .qubely-block-image .qubely-image-container, {{QUBELY}} .qubely-block-image .qubely-image-container img' - }] - }, - - imageBoxShadow: { - type: 'object', - default: {}, - style: [{ - selector: '{{QUBELY}} .qubely-image-container' - }] - }, - - imageBoxShadowHover: { - type: 'object', - default: {}, - style: [{ - selector: '{{QUBELY}} .qubely-image-media:hover .qubely-image-container' - }] - }, - - // Caption - enableCaption: { - type: 'boolean', - default: false, - }, - - imageCaption: { - type: 'string', - default: 'Image Caption' - }, - - captionTypography: { - type: 'object', - default: { - openTypography: 1, - size: { - md: 16, - unit: 'px' - } - }, - style: [{ - condition: [ - { key: 'layout', relation: '==', value: 'simple' }, - { key: 'enableCaption', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-image-caption' - }] - }, - captionColor: { - type: 'string', - default: '#566372', - style: [{ - condition: [ - { key: 'layout', relation: '==', value: 'simple' }, - { key: 'enableCaption', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-image-caption {color: {{captionColor}};}' - }] - }, - - captionSpacing: { - type: 'object', - default: { - md: 20, - unit: 'px' - }, - style: [{ - selector: '{{QUBELY}} .qubely-image-caption {margin-top: {{captionSpacing}};}' - }] - }, - - // Title - title: { - type: 'string', - default: 'Image Block' - }, - titleLevel: { - type: 'number', - default: 3 - }, - titleTypography: { - type: 'object', - default: { - openTypography: 1, - size: { - md: 38, - unit: 'px' - } - }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - ], - selector: '{{QUBELY}} .qubely-image-container .qubely-image-content .qubely-image-content-inner .qubely-image-title' - }] - }, - titleColor: { - type: 'string', - default: '#FFF', - style: [{ - selector: '{{QUBELY}} .qubely-image-container .qubely-image-content .qubely-image-content-inner .qubely-image-title {color: {{titleColor}};}' - }] - }, - - titleVisibleOnHover: { - type: 'boolean', - default: false, - }, - - // Sub Title - enableSubTitle: { - type: 'boolean', - default: true, - }, - subTitle: { - type: 'string', - default: 'Insert images and beautify them with Qubely Image Block.' - }, - subTitleTypography: { - type: 'object', - default: { - openTypography: 1, - size: { - md: 21, - unit: 'px' - } - }, - style: [{ - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'enableSubTitle', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-image-container .qubely-image-content .qubely-image-content-inner .qubely-image-sub-title' - }] - }, - subTitleColor: { - type: 'string', - default: '#FFF', - style: [{ - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'enableSubTitle', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-image-container .qubely-image-content .qubely-image-content-inner .qubely-image-sub-title {color: {{subTitleColor}};}' - }] - }, - subTitleSpacing: { - type: 'object', - default: { - md: 10, - unit: 'px' - }, - style: [{ - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'enableSubTitle', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-image-sub-title {margin-top: {{subTitleSpacing}};}' - }] - }, - - subTitleVisibleOnHover: { - type: 'boolean', - default: false, - }, - - // Overlay - enableOverlay: { - type: 'boolean', - default: true, - }, - - overlayBg: { - type: 'object', - default: { - openColor: 1, - type: 'gradient', - color: 'rgba(6, 80, 183, 0.7)', - gradient: { - color1: 'rgba(6, 80, 183, 0.7)', - color2: 'rgba(96, 10, 255, 0.7)', - direction: 45, - start: 0, - stop: 100, - type: 'linear' - }, - }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'enableOverlay', relation: '==', value: true } - ], - selector: '{{QUBELY}} .qubely-image-container:before' - } - ] - }, - - overlayHoverBg: { - type: 'object', - default: { - type: 'gradient', - openColor: 1, - color: 'rgba(6, 80, 183, 0.85)', - gradient: { - color1: 'rgba(6, 80, 183, 0.85)', - color2: 'rgba(96, 10, 255, 0.85)', - direction: 45, - start: 0, - stop: 100, - type: 'linear' - } - }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'enableOverlay', relation: '==', value: true }, - { key: 'animateOnHover', relation: '==', value: true }, - ], - selector: '{{QUBELY}} .qubely-image-container:after' - } - ] - }, - - overlayBlend: { - type: 'string', - default: '', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'enableOverlay', relation: '==', value: true }, - { key: 'overlayBlend', relation: '!=', value: 'normal' } - ], - selector: '{{QUBELY}} .qubely-image-container:before {mix-blend-mode: {{overlayBlend}};} {{QUBELY}} .qubely-image-container:after {mix-blend-mode: {{overlayBlend}};}' - } - ] - }, - - // Content - contentAnimation: { - type: 'string', - default: 'zoom-out' - }, - - contentPadding: { - type: 'object', - default: { - openPadding: 1, - paddingType: 'global', - global: { - md: 30, - }, - unit: 'px' - }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - ], - selector: '{{QUBELY}} .qubely-image-content' - } - ] - }, - - contentVerticalAlign: { - type: 'string', - default: 'center', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'contentVerticalAlign', relation: '==', value: 'top' } - ], - selector: '{{QUBELY}} .qubely-image-content {-webkit-box-align: start; -ms-flex-align: start; -ms-grid-row-align: flex-start; align-items: flex-start;}' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'contentVerticalAlign', relation: '==', value: 'center' } - ], - selector: '{{QUBELY}} .qubely-image-content {-webkit-box-align: center; -ms-flex-align: center; -ms-grid-row-align: center; align-items: center;}' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'contentVerticalAlign', relation: '==', value: 'bottom' } - ], - selector: '{{QUBELY}} .qubely-image-content {-webkit-box-align: end; -ms-flex-align: end; -ms-grid-row-align: flex-end; align-items: flex-end;}' - } - ] - }, - - contentAlignment: { - type: 'string', - default: 'center', - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'contentAlignment', relation: '==', value: 'left' } - ], - selector: '{{QUBELY}} .qubely-image-content {-webkit-box-pack: start; -ms-flex-pack: start; justify-content: flex-start; text-align: left;}' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'contentAlignment', relation: '==', value: 'center' } - ], - selector: '{{QUBELY}} .qubely-image-content {-webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; text-align: center;}' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'contentAlignment', relation: '==', value: 'right' } - ], - selector: '{{QUBELY}} .qubely-image-content {-webkit-box-pack: end; -ms-flex-pack: end; justify-content: flex-end; text-align: right;}' - } - ] - }, - - // Frame - enableFrame: { - type: 'boolean', - default: false - }, - - frameMargin: { - type: 'object', - default: { - openMargin: 1, - marginType: 'global', - global: { md: 30 }, - unit: 'px' - }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'enableFrame', relation: '==', value: true } - ], - selector: '{{QUBELY}} .qubely-has-frame figure:after' - } - ] - }, - frameBorder: { - type: 'object', - default: { - openBorder: 1, - widthType: "global", - global: { - md: 5 - }, - type: 'solid', - color: '#FFF' - }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'enableFrame', relation: '==', value: true } - ], - selector: '{{QUBELY}} .qubely-has-frame figure:after' - } - ] - }, - - frameBorderRadius: { - type: 'object', - default: { - openBorderRadius: 0, - radiusType: 'global', - global: {}, - unit: 'px', - - }, - style: [{ - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'enableFrame', relation: '==', value: true } - ], - selector: '{{QUBELY}} .qubely-has-frame figure::after' - }] - }, - - frameSendToBack: { - type: 'boolean', - default: false, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 'blurb' }, - { key: 'enableFrame', relation: '==', value: true }, - { key: 'frameSendToBack', relation: '==', value: true }, - ], - selector: '{{QUBELY}} .qubely-has-frame figure::after {z-index: -1;}' - } - ] - }, - - frameAnimateOnHover: { - type: 'boolean', - default: false - } -} - -registerBlockType('qubely/image', { - title: __('Image'), - description: __('Insert images and beautify them with Qubely Image Block.'), - category: 'qubely', - icon: {__('Image')}, - keywords: [__('image', 'advanced image', 'fancy image'), 'image overlay'], - supports: { - align: ['center', 'wide', 'full'], - }, - example: { - attributes: { - image: { url: 'https://qubely.io/wp-content/uploads/qubely-assets/demo/image8.jpg' }, - enableCaption: true, - imageCaption: __('Qubely is a full-fledged Gutenberg block toolkit.', 'qubely'), - }, - }, - attributes, - edit: Edit, - save: Save, - deprecated: [ - { - attributes, - save(props) { - const { - attributes: { - uniqueId, - layout, - imageUrl, - animateOnHover, - titleVisibleOnHover, - subTitleVisibleOnHover, - title, - titleLevel, - subTitle, - enableSubTitle, - imageCaption, - enableCaption, - contentAnimation, - contentVerticalAlign, - contentAlignment, - enableFrame, - frameAnimateOnHover, - interaction, - animation } - } = props - - const titleTagName = 'h' + titleLevel; - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - const renderImage = () => { - const { attributes: { image, image2x, imgAlt } } = props - return ( - - {image.url != undefined ? - - {image2x.url != undefined ? - {imgAlt - : - {imgAlt - } - - : -
    - } -
    - ) - } - return ( -
    -
    -
    -
    -
    - { - (imageUrl.url && layout === 'simple') ? - - {renderImage()} - - : renderImage() - } - - {layout == 'blurb' && -
    -
    - - - {enableSubTitle == 1 && - - } -
    -
    - } -
    - - {(layout == 'simple' && enableCaption == 1) && - - } -
    -
    -
    -
    - ); - } - }, - { - attributes, - save(props) { - const { - attributes: { - uniqueId, - layout, - imageUrl, - image, - imageType, - image2x, - imgAlt, - externalImageUrl, - animateOnHover, - titleVisibleOnHover, - subTitleVisibleOnHover, - title, - titleLevel, - subTitle, - enableSubTitle, - imageCaption, - enableCaption, - contentAnimation, - contentVerticalAlign, - contentAlignment, - enableFrame, - frameAnimateOnHover, - interaction, - animation - } - } = props - - const titleTagName = 'h' + titleLevel; - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; - const renderImage = () => { - return ( - - { - (imageType === 'local' && image.url != undefined) ? - - {image2x.url != undefined ? - {imgAlt - : - {imgAlt - } - - : - (imageType === 'external' && externalImageUrl.url != undefined) ? - {imgAlt - : -
    - } -
    - ) - } - return ( - -
    -
    -
    -
    -
    - { - (imageUrl.url && layout === 'simple') ? - - {renderImage()} - - : renderImage() - } - - {layout == 'blurb' && -
    -
    - - - {enableSubTitle == 1 && - - } -
    -
    - } -
    - - {(layout == 'simple' && enableCaption == 1) && - - } -
    -
    -
    -
    - ); - } - } - ] -}); \ No newline at end of file + uniqueId: { + type: "string", + default: "", + }, + recreateStyles: { + type: "boolean", + default: true, + }, + ...globalAttributes, + spacer: { + type: "object", + default: { + spaceTop: { + md: "10", + unit: "px", + }, + spaceBottom: { + md: "10", + unit: "px", + }, + }, + style: [{ selector: "{{QUBELY}}" }], + }, + + alignment: { + type: "object", + default: { + md: "left", + }, + style: [ + { + selector: "{{QUBELY}} .qubely-block-image {text-align: {{alignment}};}", + }, + ], + }, + + animateOnHover: { + type: "boolean", + default: true, + }, + + layout: { + type: "string", + default: "simple", + }, + imgSize: { + type: "string", + default: "full", + }, + + image: { + type: "object", + default: {}, + }, + imageType: { + type: "string", + default: "local", + }, + externalImageUrl: { + type: "object", + default: {}, + }, + + image2x: { + type: "object", + default: {}, + }, + imageUrl: { type: "object", default: {} }, + imageSize: { + type: "string", + default: "auto", + style: [ + { + condition: [ + { key: "imageSize", relation: "!=", value: "auto" }, + { key: "imageSize", relation: "!=", value: "custom" }, + ], + selector: "{{QUBELY}} .qubely-image-image {width: {{imageSize}};}", + }, + ], + }, + + imageSizeCustom: { + type: "object", + default: { + md: 300, + unit: "px", + }, + style: [ + { + condition: [{ key: "imageSize", relation: "==", value: "custom" }], + selector: "{{QUBELY}} .qubely-image-image {width: {{imageSizeCustom}};}", + }, + ], + }, + imageHeight: { + type: "string", + default: "auto", + style: [ + { + condition: [{ key: "imageHeight", relation: "==", value: "auto" }], + selector: "{{QUBELY}} .qubely-image-image {height: auto;}", + }, + ], + }, + + imageCustomHeight: { + type: "object", + default: { + md: 300, + unit: "px", + }, + style: [ + { + condition: [{ key: "imageHeight", relation: "==", value: "custom" }], + selector: "{{QUBELY}} .qubely-image-image {height: {{imageCustomHeight}};}", + }, + ], + }, + + imgAlt: { + type: "string", + default: "", + }, + + imageOpacity: { + type: "number", + default: 1, + style: [ + { + selector: "{{QUBELY}} .qubely-image-image {opacity: {{imageOpacity}};}", + }, + ], + }, + + imageBorderRadius: { + type: "object", + default: { + openBorderRadius: 0, + radiusType: "global", + global: {}, + unit: "px", + }, + style: [ + { + selector: + "{{QUBELY}} .qubely-block-image .qubely-image-container, {{QUBELY}} .qubely-block-image .qubely-image-container img", + }, + ], + }, + + imageBoxShadow: { + type: "object", + default: {}, + style: [ + { + selector: "{{QUBELY}} .qubely-image-container", + }, + ], + }, + + imageBoxShadowHover: { + type: "object", + default: {}, + style: [ + { + selector: "{{QUBELY}} .qubely-image-media:hover .qubely-image-container", + }, + ], + }, + + // Caption + enableCaption: { + type: "boolean", + default: false, + }, + + imageCaption: { + type: "string", + default: "Image Caption", + }, + + captionTypography: { + type: "object", + default: { + openTypography: 1, + size: { + md: 16, + unit: "px", + }, + }, + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "simple" }, + { key: "enableCaption", relation: "==", value: 1 }, + ], + selector: "{{QUBELY}} .qubely-image-caption", + }, + ], + }, + captionColor: { + type: "string", + default: "#566372", + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "simple" }, + { key: "enableCaption", relation: "==", value: 1 }, + ], + selector: "{{QUBELY}} .qubely-image-caption {color: {{captionColor}};}", + }, + ], + }, + + captionSpacing: { + type: "object", + default: { + md: 20, + unit: "px", + }, + style: [ + { + selector: "{{QUBELY}} .qubely-image-caption {margin-top: {{captionSpacing}};}", + }, + ], + }, + + // Title + title: { + type: "string", + default: "Image Block", + }, + titleLevel: { + type: "number", + default: 3, + }, + titleTypography: { + type: "object", + default: { + openTypography: 1, + size: { + md: 38, + unit: "px", + }, + }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "blurb" }], + selector: + "{{QUBELY}} .qubely-image-container .qubely-image-content .qubely-image-content-inner .qubely-image-title", + }, + ], + }, + titleColor: { + type: "string", + default: "#FFF", + style: [ + { + selector: + "{{QUBELY}} .qubely-image-container .qubely-image-content .qubely-image-content-inner .qubely-image-title {color: {{titleColor}};}", + }, + ], + }, + + titleVisibleOnHover: { + type: "boolean", + default: false, + }, + + // Sub Title + enableSubTitle: { + type: "boolean", + default: true, + }, + subTitle: { + type: "string", + default: "Insert images and beautify them with Qubely Image Block.", + }, + subTitleTypography: { + type: "object", + default: { + openTypography: 1, + size: { + md: 21, + unit: "px", + }, + }, + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "enableSubTitle", relation: "==", value: 1 }, + ], + selector: + "{{QUBELY}} .qubely-image-container .qubely-image-content .qubely-image-content-inner .qubely-image-sub-title", + }, + ], + }, + subTitleColor: { + type: "string", + default: "#FFF", + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "enableSubTitle", relation: "==", value: 1 }, + ], + selector: + "{{QUBELY}} .qubely-image-container .qubely-image-content .qubely-image-content-inner .qubely-image-sub-title {color: {{subTitleColor}};}", + }, + ], + }, + subTitleSpacing: { + type: "object", + default: { + md: 10, + unit: "px", + }, + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "enableSubTitle", relation: "==", value: 1 }, + ], + selector: "{{QUBELY}} .qubely-image-sub-title {margin-top: {{subTitleSpacing}};}", + }, + ], + }, + + subTitleVisibleOnHover: { + type: "boolean", + default: false, + }, + + // Overlay + enableOverlay: { + type: "boolean", + default: true, + }, + + overlayBg: { + type: "object", + default: { + openColor: 1, + type: "gradient", + color: "rgba(6, 80, 183, 0.7)", + gradient: { + color1: "rgba(6, 80, 183, 0.7)", + color2: "rgba(96, 10, 255, 0.7)", + direction: 45, + start: 0, + stop: 100, + type: "linear", + }, + }, + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "enableOverlay", relation: "==", value: true }, + ], + selector: "{{QUBELY}} .qubely-image-container:before", + }, + ], + }, + + overlayHoverBg: { + type: "object", + default: { + type: "gradient", + openColor: 1, + color: "rgba(6, 80, 183, 0.85)", + gradient: { + color1: "rgba(6, 80, 183, 0.85)", + color2: "rgba(96, 10, 255, 0.85)", + direction: 45, + start: 0, + stop: 100, + type: "linear", + }, + }, + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "enableOverlay", relation: "==", value: true }, + { key: "animateOnHover", relation: "==", value: true }, + ], + selector: "{{QUBELY}} .qubely-image-container:after", + }, + ], + }, + + overlayBlend: { + type: "string", + default: "", + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "enableOverlay", relation: "==", value: true }, + { key: "overlayBlend", relation: "!=", value: "normal" }, + ], + selector: + "{{QUBELY}} .qubely-image-container:before {mix-blend-mode: {{overlayBlend}};} {{QUBELY}} .qubely-image-container:after {mix-blend-mode: {{overlayBlend}};}", + }, + ], + }, + + // Content + contentAnimation: { + type: "string", + default: "zoom-out", + }, + + contentPadding: { + type: "object", + default: { + openPadding: 1, + paddingType: "global", + global: { + md: 30, + }, + unit: "px", + }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: "blurb" }], + selector: "{{QUBELY}} .qubely-image-content", + }, + ], + }, + + contentVerticalAlign: { + type: "string", + default: "center", + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "contentVerticalAlign", relation: "==", value: "top" }, + ], + selector: + "{{QUBELY}} .qubely-image-content {-webkit-box-align: start; -ms-flex-align: start; -ms-grid-row-align: flex-start; align-items: flex-start;}", + }, + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "contentVerticalAlign", relation: "==", value: "center" }, + ], + selector: + "{{QUBELY}} .qubely-image-content {-webkit-box-align: center; -ms-flex-align: center; -ms-grid-row-align: center; align-items: center;}", + }, + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "contentVerticalAlign", relation: "==", value: "bottom" }, + ], + selector: + "{{QUBELY}} .qubely-image-content {-webkit-box-align: end; -ms-flex-align: end; -ms-grid-row-align: flex-end; align-items: flex-end;}", + }, + ], + }, + + contentAlignment: { + type: "string", + default: "center", + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "contentAlignment", relation: "==", value: "left" }, + ], + selector: + "{{QUBELY}} .qubely-image-content {-webkit-box-pack: start; -ms-flex-pack: start; justify-content: flex-start; text-align: left;}", + }, + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "contentAlignment", relation: "==", value: "center" }, + ], + selector: + "{{QUBELY}} .qubely-image-content {-webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; text-align: center;}", + }, + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "contentAlignment", relation: "==", value: "right" }, + ], + selector: + "{{QUBELY}} .qubely-image-content {-webkit-box-pack: end; -ms-flex-pack: end; justify-content: flex-end; text-align: right;}", + }, + ], + }, + + // Frame + enableFrame: { + type: "boolean", + default: false, + }, + + frameMargin: { + type: "object", + default: { + openMargin: 1, + marginType: "global", + global: { md: 30 }, + unit: "px", + }, + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "enableFrame", relation: "==", value: true }, + ], + selector: "{{QUBELY}} .qubely-has-frame figure:after", + }, + ], + }, + frameBorder: { + type: "object", + default: { + openBorder: 1, + widthType: "global", + global: { + md: 5, + }, + type: "solid", + color: "#FFF", + }, + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "enableFrame", relation: "==", value: true }, + ], + selector: "{{QUBELY}} .qubely-has-frame figure:after", + }, + ], + }, + + frameBorderRadius: { + type: "object", + default: { + openBorderRadius: 0, + radiusType: "global", + global: {}, + unit: "px", + }, + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "enableFrame", relation: "==", value: true }, + ], + selector: "{{QUBELY}} .qubely-has-frame figure::after", + }, + ], + }, + + frameSendToBack: { + type: "boolean", + default: false, + style: [ + { + condition: [ + { key: "layout", relation: "==", value: "blurb" }, + { key: "enableFrame", relation: "==", value: true }, + { key: "frameSendToBack", relation: "==", value: true }, + ], + selector: "{{QUBELY}} .qubely-has-frame figure::after {z-index: -1;}", + }, + ], + }, + + frameAnimateOnHover: { + type: "boolean", + default: false, + }, +}; + +registerBlockType("qubely/image", { + title: __("Image"), + description: __("Insert images and beautify them with Qubely Image Block."), + category: "qubely", + icon: {__("Image")}, + keywords: [__("image", "advanced image", "fancy image"), "image overlay"], + supports: { + align: ["center", "wide", "full"], + }, + example: { + attributes: { + image: { url: "https://qubely.io/wp-content/uploads/qubely-assets/demo/image8.jpg" }, + enableCaption: true, + imageCaption: __("Qubely is a full-fledged Gutenberg block toolkit.", "qubely"), + }, + }, + attributes, + edit: Edit, + save: Save, + deprecated: [ + { + attributes, + save(props) { + const { + attributes: { + uniqueId, + layout, + imageUrl, + animateOnHover, + titleVisibleOnHover, + subTitleVisibleOnHover, + title, + titleLevel, + subTitle, + enableSubTitle, + imageCaption, + enableCaption, + contentAnimation, + contentVerticalAlign, + contentAlignment, + enableFrame, + frameAnimateOnHover, + interaction, + animation, + }, + } = props; + + const titleTagName = "h" + titleLevel; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + const renderImage = () => { + const { + attributes: { image, image2x, imgAlt }, + } = props; + return ( + + {image.url != undefined ? ( + + {image2x.url != undefined ? ( + {imgAlt + ) : ( + {imgAlt + )} + + ) : ( +
    + +
    + )} +
    + ); + }; + return ( +
    +
    +
    +
    +
    + {imageUrl.url && layout === "simple" ? ( + + {renderImage()} + + ) : ( + renderImage() + )} + + {layout == "blurb" && ( +
    +
    + + + {enableSubTitle == 1 && ( + + )} +
    +
    + )} +
    + + {layout == "simple" && enableCaption == 1 && ( + + )} +
    +
    +
    +
    + ); + }, + }, + { + attributes, + save(props) { + const { + attributes: { + uniqueId, + layout, + imageUrl, + image, + imageType, + image2x, + imgAlt, + externalImageUrl, + animateOnHover, + titleVisibleOnHover, + subTitleVisibleOnHover, + title, + titleLevel, + subTitle, + enableSubTitle, + imageCaption, + enableCaption, + contentAnimation, + contentVerticalAlign, + contentAlignment, + enableFrame, + frameAnimateOnHover, + interaction, + animation, + }, + } = props; + + const titleTagName = "h" + titleLevel; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; + const renderImage = () => { + return ( + + {imageType === "local" && image.url != undefined ? ( + + {image2x.url != undefined ? ( + {imgAlt + ) : ( + {imgAlt + )} + + ) : imageType === "external" && externalImageUrl.url != undefined ? ( + {imgAlt + ) : ( +
    + +
    + )} +
    + ); + }; + return ( +
    +
    +
    +
    +
    + {imageUrl.url && layout === "simple" ? ( + + {renderImage()} + + ) : ( + renderImage() + )} + + {layout == "blurb" && ( +
    +
    + + + {enableSubTitle == 1 && ( + + )} +
    +
    + )} +
    + + {layout == "simple" && enableCaption == 1 && ( + + )} +
    +
    +
    +
    + ); + }, + }, + ], +}); diff --git a/assets/reactjs/src/blocks/image/style.scss b/assets/reactjs/src/blocks/image/style.scss index c28b4e66..2a289730 100644 --- a/assets/reactjs/src/blocks/image/style.scss +++ b/assets/reactjs/src/blocks/image/style.scss @@ -1,15 +1,15 @@ .qubely-block-image { - &.qubely-image-layout-blurb { - line-height: 0; - .qubely-image-media { - display: inline-block; - } - } + &.qubely-image-layout-blurb { + line-height: 0; + .qubely-image-media { + display: inline-block; + } + } figure { padding: 0; margin: 0; position: relative; - + .qubely-image-image { margin: 0; padding: 0; @@ -18,14 +18,14 @@ display: inline-flex; } } - + .qubely-image-container { display: block; overflow: hidden; position: relative; z-index: 0; transition: box-shadow 0.35s; - img{ + img { display: inline-block; -webkit-transition: ease-in 300ms; transition: ease-in 300ms; @@ -38,12 +38,12 @@ left: 0; bottom: 0; right: 0; - z-index: 10; - line-height: normal; + z-index: 10; + line-height: normal; } } div.qubely-image-container { - font-size: 0; + font-size: inherit; } } @@ -74,12 +74,11 @@ } .qubely-hover-animation-on { - .qubely-image-title { margin: 0; line-height: 1; } - + &:hover { .qubely-image-container:after { opacity: 1; @@ -193,9 +192,9 @@ transition: transform 0.35s; } } - + .qubely-image-sub-title { - line-height: 1; + line-height: 1; &.qubely-visible-on-hover { transform: translate3d(0, -30px, 0); opacity: 0; @@ -215,12 +214,12 @@ opacity: 1; transform: translate3d(0, 0px, 0); } - + &.qubely-visible-on-hover-enabled { transform: translate3d(0, 30px, 0); } } - + .qubely-image-sub-title { &.qubely-visible-on-hover { transform: translate3d(0, 0px, 0); @@ -250,7 +249,7 @@ transition: transform 0.35s; } } - + .qubely-image-sub-title { &.qubely-visible-on-hover { transform: translate3d(0, 40px, 0); @@ -265,12 +264,12 @@ opacity: 1; transform: translate3d(0, 0, 0); } - + &.qubely-visible-on-hover-enabled { transform: translate3d(0, 0, 0); } } - + .qubely-image-sub-title { &.qubely-visible-on-hover { transform: translate3d(0, 0, 0); @@ -281,31 +280,31 @@ } } } - } - - &.qubely-image-layout-blurb { - figure { - .qubely-image-container { - &:before, - &:after { - content: " "; - position: absolute; - top: 0; - left: 0; - bottom: 0; - right: 0; - z-index: 1; - } - &:after { - z-index: 2; - opacity: 0; - transition: opacity 600ms; - } - } - } - } + } + + &.qubely-image-layout-blurb { + figure { + .qubely-image-container { + &:before, + &:after { + content: " "; + position: absolute; + top: 0; + left: 0; + bottom: 0; + right: 0; + z-index: 1; + } + &:after { + z-index: 2; + opacity: 0; + transition: opacity 600ms; + } + } + } + } } -.qubely-image-image.qubely-image-placeholder{ +.qubely-image-image.qubely-image-placeholder { min-height: 200px; min-width: 200px; -} \ No newline at end of file +} diff --git a/assets/reactjs/src/blocks/infobox/Edit.js b/assets/reactjs/src/blocks/infobox/Edit.js index 5e459b04..7c587a42 100644 --- a/assets/reactjs/src/blocks/infobox/Edit.js +++ b/assets/reactjs/src/blocks/infobox/Edit.js @@ -1,567 +1,1089 @@ -const { __ } = wp.i18n +const { __ } = wp.i18n; const { Fragment, Component, createRef } = wp.element; -const { PanelBody, SelectControl, TextControl, Toolbar } = wp.components -const { RichText, InspectorControls, BlockControls } = wp.blockEditor -const { QubelyButtonEdit, ButtonGroup, Url, Media, Tabs, Tab, Range, BoxShadow, ContextMenu: { ContextMenu, handleContextMenu }, RadioAdvanced, Typography, Toggle, Styles, Alignment, IconList, ColorAdvanced, Color, Headings, Border, BorderRadius, Padding, gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, Inline: { InlineToolbar }, QubelyButton: { buttonSettings }, withCSSGenerator, InspectorTabs, InspectorTab } = wp.qubelyComponents -import icons from '../../helpers/icons'; -import svg from '../heading/separators'; +const { PanelBody, SelectControl, TextControl, Toolbar } = wp.components; +const { RichText, InspectorControls, BlockControls } = wp.blockEditor; +const { + QubelyButtonEdit, + ButtonGroup, + Url, + Media, + Tabs, + Tab, + Range, + BoxShadow, + ContextMenu: { ContextMenu, handleContextMenu }, + RadioAdvanced, + Typography, + Toggle, + Styles, + Alignment, + IconList, + ColorAdvanced, + Color, + Headings, + Border, + BorderRadius, + Padding, + gloalSettings: { globalSettingsPanel, animationSettings, interactionSettings }, + Inline: { InlineToolbar }, + QubelyButton: { buttonSettings }, + withCSSGenerator, + InspectorTabs, + InspectorTab, +} = wp.qubelyComponents; +import icons from "../../helpers/icons"; +import svg from "../heading/separators"; class Edit extends Component { + constructor(props) { + super(props); + this.state = { + device: "md", + selector: true, + spacer: true, + openPanelSetting: "", + }; + this.qubelyContextMenu = createRef(); + } - constructor(props) { - super(props); - this.state = { - device: 'md', - selector: true, - spacer: true, - openPanelSetting: '' - }; - this.qubelyContextMenu = createRef(); - } - - componentDidMount() { - const { setAttributes, clientId, attributes: { uniqueId } } = this.props - const _client = clientId.substr(0, 6) - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId != _client) { - setAttributes({ uniqueId: _client }); - - } - } - handlePanelOpenings = (panelName) => { - this.setState({ ...this.state, openPanelSetting: panelName }) - } - - render() { - const { - uniqueId, - className, - layout, - recreateStyles, - mediaType, - alignment, - titleLevel, - title, - titleTypography, - titleColor, - titleColorHover, - titleSpacing, - - subTitle, - subTitleLevel, - subTitleContent, - subTitleTypography, - subTitleColor, - subTitleColorHover, - subTitleSpacing, - - separatorStyle, - separatorColor, - separatorColorHover, - separatorStroke, - separatorPosition, - separatorWidth, - separatorSpacing, - - //content - enableContent, - content, - contentTypography, - contentColor, - contentColorHover, - contentPadding, - contentSpacing, - - iconName, - iconSize, - iconSizeCustom, - iconColor, - iconHoverColor, - useMediaBg, - mediaBg, - mediaBgHover, - mediaBorderRadius, - mediaBackgroundSize, - mediaBorder, - mediaBorderColorHover, - mediaShadow, - mediaShadowHover, - mediaSpacing, - - image, - image2x, - imgAlt, - imageType, - imageSize, - imageWidth, - imageHeight, - imageCustomHeight, - externalImageUrl, - - number, - numberColor, - numberColorHover, - numberTypography, - - bgColor, - bgColorHover, - bgBorder, - bgBorderColorHover, - bgPadding, - bgBorderRadius, - bgShadow, - bgShadowHover, - enableButton, - - // Button - buttonSize, - buttonFillType, - buttonText, - buttonIconName, - buttonIconPosition, - buttonUrl, - - animation, - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - globalZindex, - hideTablet, - hideMobile, - globalCss, - interaction - } = this.props.attributes - - const { name, clientId, attributes, isSelected, setAttributes } = this.props - const { openPanelSetting, device } = this.state - const separators = { - solid: { type: 'css', separator: 'solid', width: 300, stroke: 10 }, - double: { type: 'css', separator: 'double', width: 300, stroke: 10 }, - dotted: { type: 'css', separator: 'dotted', width: 300, stroke: 10 }, - dashed: { type: 'css', separator: 'dashed', width: 300, stroke: 10 }, - pin: { type: 'svg', separator: 'pin', svg: svg['pin'], width: 100, stroke: 0 }, - pin_filled: { type: 'svg', separator: 'pin_filled', svg: svg['pin_filled'], width: 100, stroke: 0 }, - zigzag: { type: 'svg', separator: 'zigzag', svg: svg['zigzag'], style: 'fill', width: 88, stroke: 5 }, - zigzag_large: { type: 'svg', separator: 'zigzag_large', svg: svg['zigzag_large'], style: 'fill', width: 161, stroke: 5 }, - } - - const titleTagName = 'h' + titleLevel; - const subTitleTagName = 'h' + subTitleLevel; - - const renderSeparators = - {separatorStyle && - - {separators[separatorStyle].type == 'css' && - - } - {separators[separatorStyle].type == 'svg' && - {separators[separatorStyle].svg} - } - - } - - - return ( - - - - - - setAttributes({ layout: val })} - options={[ - { value: 1, svg: icons.infobox_1, label: __('Layout 1') }, - { value: 2, svg: icons.infobox_2, label: __('Layout 2') }, - { value: 3, svg: icons.infobox_3, label: __('Layout 3') }, - { value: 4, svg: icons.infobox_4, label: __('Layout 4') }, - ]} - /> - {(layout == 1 || layout == 4) && - setAttributes({ alignment: val })} alignmentType="content" disableJustify responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - } - - - {layout != 4 && - this.handlePanelOpenings(openPanelSetting !== 'Media' ? 'Media' : '')}> - setAttributes({ mediaType: val, recreateStyles: !recreateStyles })} - /> - {mediaType && - - {mediaType == 'icon' && - - setAttributes({ iconName: val })} disableToggle /> - setAttributes({ iconSize: value })} - options={[ - { label: 'S', value: '36px', title: 'Small' }, - { label: 'M', value: '64px', title: 'Medium' }, - { label: 'L', value: '128px', title: 'Large' }, - { icon: 'fas fa-cog', value: 'custom', title: 'Custom' } - ]} - /> - {iconSize == 'custom' && - setAttributes({ iconSizeCustom: val })} min={12} max={300} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - } - - } - - {mediaType == 'image' && - - setAttributes({ imageType: value })} - /> - { - imageType === 'local' ? - - setAttributes({ image: val })} /> - setAttributes({ image2x: val })} /> - - : - setAttributes({ externalImageUrl: newUrl })} /> - } - setAttributes({ imgAlt: val })} /> - - setAttributes({ imageSize: value, recreateStyles: !recreateStyles })} - options={[ - { label: __('Auto'), value: 'auto', title: __('Auto') }, - { label: __('S'), value: '100px', title: __('Small') }, - { label: __('M'), value: '300px', title: __('Medium') }, - { label: __('L'), value: '500px', title: __('Large') }, - { icon: 'fas fa-cog', value: 'custom', title: __('Custom') }, - ]} - /> - {imageSize == 'custom' && - - setAttributes({ imageWidth: val })} min={0} max={2000} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - } - setAttributes({ imageHeight: value, recreateStyles: !recreateStyles })} - options={[ - { label: __('Auto'), value: 'auto', title: __('Auto') }, - { label: __('Custom'), value: 'custom', title: __('Custom') }, - ]} - /> - {imageHeight == 'custom' && - - setAttributes({ imageCustomHeight: val })} min={10} max={1920} responsive unit={['px', 'em', '%']} device={device} onDeviceChange={value => this.setState({ device: value })} /> - - } - - } - - {mediaType == 'number' && - - setAttributes({ number: parseInt(val) })} /> - setAttributes({ numberTypography: value })} disableLineHeight device={device} onDeviceChange={value => this.setState({ device: value })} /> - - } - - {mediaType != 'image' && - - setAttributes({ useMediaBg: val })} /> - {useMediaBg == 1 && - setAttributes({ mediaBackgroundSize: val })} min={0} max={200} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - } - - - {mediaType == 'icon' && - setAttributes({ iconColor: val })} /> - } - {mediaType == 'number' && - setAttributes({ numberColor: value })} /> - } - {useMediaBg == 1 && - - setAttributes({ mediaBg: val })} /> - setAttributes({ mediaBorder: val })} min={0} max={10} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ mediaShadow: value })} /> - - } - - - {mediaType == 'icon' && - setAttributes({ iconHoverColor: val })} /> - } - {mediaType == 'number' && - setAttributes({ numberColorHover: value })} /> - } - {useMediaBg == 1 && - - setAttributes({ mediaBgHover: val })} /> - setAttributes({ mediaBorderColorHover: value })} /> - setAttributes({ mediaShadowHover: value })} /> - - } - - - - } - - setAttributes({ mediaBorderRadius: val })} min={0} max={100} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ mediaSpacing: val })} min={0} max={200} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - } - - } - - this.handlePanelOpenings(openPanelSetting !== 'Title' ? 'Title' : '')}> - setAttributes({ titleLevel: value })} /> - setAttributes({ titleTypography: value })} device={device} onDeviceChange={value => this.setState({ device: value })} /> - Spacing } value={titleSpacing} onChange={val => setAttributes({ titleSpacing: val })} min={0} max={200} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - setAttributes({ titleColor: value })} /> - - - setAttributes({ titleColorHover: value })} /> - - - - setAttributes({ separatorStyle: val })} - /> - {separatorStyle && - - - - setAttributes({ separatorColor: val })} /> - - - setAttributes({ separatorColorHover: val })} /> - - - {(separatorStyle != 'pin' && separatorStyle != 'pin_filled') && - setAttributes({ separatorStroke: val })} min={1} max={separators[separatorStyle].stroke} /> - } - setAttributes({ separatorWidth: val })} min={20} max={separators[separatorStyle].width} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ separatorSpacing: val })} min={0} max={100} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ separatorPosition: val })} - /> - - } - - - this.handlePanelOpenings(openPanelSetting !== 'Sub Title' ? 'Sub Title' : '')}> - setAttributes({ subTitle: val })} /> - {subTitle == 1 && - - setAttributes({ subTitleLevel: value })} /> - setAttributes({ subTitleTypography: val })} device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - setAttributes({ subTitleColor: val })} /> - - - setAttributes({ subTitleColorHover: val })} /> - - - setAttributes({ subTitleSpacing: value })} unit={['px', 'em', '%']} min={0} max={100} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - } - - - - this.handlePanelOpenings(openPanelSetting !== 'Content' ? 'Content' : '')}> - setAttributes({ enableContent: val })} /> - { - enableContent && - - - setAttributes({ contentTypography: value })} device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - setAttributes({ contentColor: value })} /> - - - setAttributes({ contentColorHover: value })} /> - - - setAttributes({ contentPadding: val })} min={0} max={200} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - {enableButton && - setAttributes({ contentSpacing: value })} unit={['px', 'em', '%']} min={0} max={100} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - } - - } - - - - - - setAttributes({ bgColor: val })} /> - setAttributes({ bgPadding: val })} min={0} max={200} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ bgBorder: val })} min={0} max={10} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - setAttributes({ bgShadow: value })} /> - setAttributes({ bgBorderRadius: value })} min={0} max={100} unit={['px', 'em', '%']} responsive device={device} onDeviceChange={value => this.setState({ device: value })} /> - - - setAttributes({ bgColorHover: val })} /> - setAttributes({ bgShadowHover: value })} /> - setAttributes({ bgBorderColorHover: value })} /> - - - - {buttonSettings(this.props.attributes, device, (key, value) => { setAttributes({ [key]: value }) }, (key, value) => { this.setState({ [key]: value }) })} - - - {animationSettings(uniqueId, animation, setAttributes)} - {interactionSettings(uniqueId, interaction, setAttributes)} - - - - - - - - - - - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} - -
    -
    handleContextMenu(event, this.qubelyContextMenu.current)} - > - {(layout != 4 && mediaType) && -
    this.handlePanelOpenings('Media')}> - {(mediaType == 'icon' && iconName) && - - } - {(mediaType == 'image') && - - { - (imageType === 'local' && image.url != undefined) ? - {imgAlt - : - (imageType === 'external' && externalImageUrl.url != undefined) ? - {imgAlt - : -
    - } -
    - } - {(mediaType == 'number' && number) && - {number} - } -
    - } - -
    -
    -
    - {separatorStyle && (separatorPosition == 'left' || separatorPosition == 'top' || separatorPosition == 'leftright') ?
    {renderSeparators}
    : ''} -
    this.handlePanelOpenings('Title')}> - setAttributes({ title: value })} - value={title} /> -
    - {separatorStyle != '' && (separatorPosition == 'right' || separatorPosition == 'bottom' || separatorPosition == 'leftright') ?
    {renderSeparators}
    : ''} -
    - - {subTitle == 1 && -
    this.handlePanelOpenings('Sub Title')}> - setAttributes({ subTitleContent: value })} - value={subTitleContent} /> -
    - } -
    - - { - enableContent && -
    this.handlePanelOpenings('Content')}> - setAttributes({ content: value })} - value={content} - /> -
    - } - {enableButton && - setAttributes({ buttonText: value })} - /> - } -
    -
    - -
    -
    -
    -
    - ) - } + handlePanelOpenings = (panelName) => { + this.setState({ ...this.state, openPanelSetting: panelName }); + }; + + render() { + const { + uniqueId, + className, + layout, + recreateStyles, + mediaType, + alignment, + titleLevel, + title, + titleTypography, + titleColor, + titleColorHover, + titleSpacing, + + subTitle, + subTitleLevel, + subTitleContent, + subTitleTypography, + subTitleColor, + subTitleColorHover, + subTitleSpacing, + + separatorStyle, + separatorColor, + separatorColorHover, + separatorStroke, + separatorPosition, + separatorWidth, + separatorSpacing, + + //content + enableContent, + content, + contentTypography, + contentColor, + contentColorHover, + contentPadding, + contentSpacing, + + iconName, + iconSize, + iconSizeCustom, + iconColor, + iconHoverColor, + useMediaBg, + mediaBg, + mediaBgHover, + mediaBorderRadius, + mediaBackgroundSize, + mediaBorder, + mediaBorderColorHover, + mediaShadow, + mediaShadowHover, + mediaSpacing, + + image, + image2x, + imgAlt, + imageType, + imageSize, + imageWidth, + imageHeight, + imageCustomHeight, + externalImageUrl, + + number, + numberColor, + numberColorHover, + numberTypography, + + bgColor, + bgColorHover, + bgBorder, + bgBorderColorHover, + bgPadding, + bgBorderRadius, + bgShadow, + bgShadowHover, + enableButton, + + // Button + buttonSize, + buttonFillType, + buttonText, + buttonIconName, + buttonIconPosition, + buttonUrl, + + animation, + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + interaction, + } = this.props.attributes; + + const { name, clientId, attributes, isSelected, setAttributes } = this.props; + const { openPanelSetting, device } = this.state; + const separators = { + solid: { type: "css", separator: "solid", width: 300, stroke: 10 }, + double: { type: "css", separator: "double", width: 300, stroke: 10 }, + dotted: { type: "css", separator: "dotted", width: 300, stroke: 10 }, + dashed: { type: "css", separator: "dashed", width: 300, stroke: 10 }, + pin: { type: "svg", separator: "pin", svg: svg["pin"], width: 100, stroke: 0 }, + pin_filled: { type: "svg", separator: "pin_filled", svg: svg["pin_filled"], width: 100, stroke: 0 }, + zigzag: { type: "svg", separator: "zigzag", svg: svg["zigzag"], style: "fill", width: 88, stroke: 5 }, + zigzag_large: { + type: "svg", + separator: "zigzag_large", + svg: svg["zigzag_large"], + style: "fill", + width: 161, + stroke: 5, + }, + }; + + const titleTagName = "h" + titleLevel; + const subTitleTagName = "h" + subTitleLevel; + + const renderSeparators = ( + + {separatorStyle && ( + + {separators[separatorStyle].type == "css" && ( + + )} + {separators[separatorStyle].type == "svg" && ( + + {separators[separatorStyle].svg} + + )} + + )} + + ); + + return ( + + + + + + setAttributes({ layout: val })} + options={[ + { value: 1, svg: icons.infobox_1, label: __("Layout 1") }, + { value: 2, svg: icons.infobox_2, label: __("Layout 2") }, + { value: 3, svg: icons.infobox_3, label: __("Layout 3") }, + { value: 4, svg: icons.infobox_4, label: __("Layout 4") }, + ]} + /> + {(layout == 1 || layout == 4) && ( + setAttributes({ alignment: val })} + alignmentType="content" + disableJustify + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + + + {layout != 4 && ( + + this.handlePanelOpenings(openPanelSetting !== "Media" ? "Media" : "") + } + > + + setAttributes({ mediaType: val, recreateStyles: !recreateStyles }) + } + /> + {mediaType && ( + + {mediaType == "icon" && ( + + setAttributes({ iconName: val })} + disableToggle + /> + setAttributes({ iconSize: value })} + options={[ + { label: "S", value: "36px", title: "Small" }, + { label: "M", value: "64px", title: "Medium" }, + { label: "L", value: "128px", title: "Large" }, + { icon: "fas fa-cog", value: "custom", title: "Custom" }, + ]} + /> + {iconSize == "custom" && ( + setAttributes({ iconSizeCustom: val })} + min={12} + max={300} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + + )} + + {mediaType == "image" && ( + + setAttributes({ imageType: value })} + /> + {imageType === "local" ? ( + + setAttributes({ image: val })} + /> + setAttributes({ image2x: val })} + /> + + ) : ( + + setAttributes({ externalImageUrl: newUrl }) + } + /> + )} + setAttributes({ imgAlt: val })} + /> + + + setAttributes({ + imageSize: value, + recreateStyles: !recreateStyles, + }) + } + options={[ + { label: __("Auto"), value: "auto", title: __("Auto") }, + { label: __("S"), value: "100px", title: __("Small") }, + { label: __("M"), value: "300px", title: __("Medium") }, + { label: __("L"), value: "500px", title: __("Large") }, + { + icon: "fas fa-cog", + value: "custom", + title: __("Custom"), + }, + ]} + /> + {imageSize == "custom" && ( + + setAttributes({ imageWidth: val })} + min={0} + max={2000} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => + this.setState({ device: value }) + } + /> + + )} + + setAttributes({ + imageHeight: value, + recreateStyles: !recreateStyles, + }) + } + options={[ + { label: __("Auto"), value: "auto", title: __("Auto") }, + { + label: __("Custom"), + value: "custom", + title: __("Custom"), + }, + ]} + /> + {imageHeight == "custom" && ( + + + setAttributes({ imageCustomHeight: val }) + } + min={10} + max={1920} + responsive + unit={["px", "em", "%"]} + device={device} + onDeviceChange={(value) => + this.setState({ device: value }) + } + /> + + )} + + )} + + {mediaType == "number" && ( + + setAttributes({ number: parseInt(val) })} + /> + setAttributes({ numberTypography: value })} + disableLineHeight + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + )} + + {mediaType != "image" && ( + + setAttributes({ useMediaBg: val })} + /> + {useMediaBg == 1 && ( + + setAttributes({ mediaBackgroundSize: val }) + } + min={0} + max={200} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + + + {mediaType == "icon" && ( + + setAttributes({ iconColor: val }) + } + /> + )} + {mediaType == "number" && ( + + setAttributes({ numberColor: value }) + } + /> + )} + {useMediaBg == 1 && ( + + + setAttributes({ mediaBg: val }) + } + /> + + setAttributes({ mediaBorder: val }) + } + min={0} + max={10} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => + this.setState({ device: value }) + } + /> + + setAttributes({ mediaShadow: value }) + } + /> + + )} + + + {mediaType == "icon" && ( + + setAttributes({ iconHoverColor: val }) + } + /> + )} + {mediaType == "number" && ( + + setAttributes({ numberColorHover: value }) + } + /> + )} + {useMediaBg == 1 && ( + + + setAttributes({ mediaBgHover: val }) + } + /> + + setAttributes({ + mediaBorderColorHover: value, + }) + } + /> + + setAttributes({ mediaShadowHover: value }) + } + /> + + )} + + + + )} + + setAttributes({ mediaBorderRadius: val })} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ mediaSpacing: val })} + min={0} + max={200} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + )} + + )} + + this.handlePanelOpenings(openPanelSetting !== "Title" ? "Title" : "")} + > + setAttributes({ titleLevel: value })} + /> + setAttributes({ titleTypography: value })} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + Spacing + + } + value={titleSpacing} + onChange={(val) => setAttributes({ titleSpacing: val })} + min={0} + max={200} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ titleColor: value })} + /> + + + setAttributes({ titleColorHover: value })} + /> + + + + setAttributes({ separatorStyle: val })} + /> + {separatorStyle && ( + + + + setAttributes({ separatorColor: val })} + /> + + + setAttributes({ separatorColorHover: val })} + /> + + + {separatorStyle != "pin" && separatorStyle != "pin_filled" && ( + setAttributes({ separatorStroke: val })} + min={1} + max={separators[separatorStyle].stroke} + /> + )} + setAttributes({ separatorWidth: val })} + min={20} + max={separators[separatorStyle].width} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ separatorSpacing: val })} + min={0} + max={100} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ separatorPosition: val })} + /> + + )} + + + + this.handlePanelOpenings(openPanelSetting !== "Sub Title" ? "Sub Title" : "") + } + > + setAttributes({ subTitle: val })} + /> + {subTitle == 1 && ( + + setAttributes({ subTitleLevel: value })} + /> + setAttributes({ subTitleTypography: val })} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ subTitleColor: val })} + /> + + + setAttributes({ subTitleColorHover: val })} + /> + + + setAttributes({ subTitleSpacing: value })} + unit={["px", "em", "%"]} + min={0} + max={100} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + )} + + + + this.handlePanelOpenings(openPanelSetting !== "Content" ? "Content" : "") + } + > + setAttributes({ enableContent: val })} + /> + {enableContent && ( + + setAttributes({ contentTypography: value })} + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ contentColor: value })} + /> + + + setAttributes({ contentColorHover: value })} + /> + + + setAttributes({ contentPadding: val })} + min={0} + max={200} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + {enableButton && ( + setAttributes({ contentSpacing: value })} + unit={["px", "em", "%"]} + min={0} + max={100} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + )} + + )} + + + + + + setAttributes({ bgColor: val })} + /> + setAttributes({ bgPadding: val })} + min={0} + max={200} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ bgBorder: val })} + min={0} + max={10} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + setAttributes({ bgShadow: value })} + /> + setAttributes({ bgBorderRadius: value })} + min={0} + max={100} + unit={["px", "em", "%"]} + responsive + device={device} + onDeviceChange={(value) => this.setState({ device: value })} + /> + + + setAttributes({ bgColorHover: val })} + /> + setAttributes({ bgShadowHover: value })} + /> + setAttributes({ bgBorderColorHover: value })} + /> + + + + {buttonSettings( + this.props.attributes, + device, + (key, value) => { + setAttributes({ [key]: value }); + }, + (key, value) => { + this.setState({ [key]: value }); + } + )} + + + {animationSettings(uniqueId, animation, setAttributes)} + {interactionSettings(uniqueId, interaction, setAttributes)} + + + + + + + + + + + {globalSettingsPanel( + enablePosition, + selectPosition, + positionXaxis, + positionYaxis, + globalZindex, + hideTablet, + hideMobile, + globalCss, + setAttributes + )} + +
    +
    handleContextMenu(event, this.qubelyContextMenu.current)} + > + {layout != 4 && mediaType && ( +
    this.handlePanelOpenings("Media")} + > + {mediaType == "icon" && iconName && ( + + )} + {mediaType == "image" && ( + + {imageType === "local" && image.url != undefined ? ( + {imgAlt + ) : imageType === "external" && externalImageUrl.url != undefined ? ( + {imgAlt + ) : ( +
    + +
    + )} +
    + )} + {mediaType == "number" && number && ( + {number} + )} +
    + )} + +
    +
    +
    + {separatorStyle && + (separatorPosition == "left" || + separatorPosition == "top" || + separatorPosition == "leftright") ? ( +
    + {renderSeparators} +
    + ) : ( + "" + )} +
    this.handlePanelOpenings("Title")}> + setAttributes({ title: value })} + value={title} + /> +
    + {separatorStyle != "" && + (separatorPosition == "right" || + separatorPosition == "bottom" || + separatorPosition == "leftright") ? ( +
    + {renderSeparators} +
    + ) : ( + "" + )} +
    + + {subTitle == 1 && ( +
    this.handlePanelOpenings("Sub Title")} + > + setAttributes({ subTitleContent: value })} + value={subTitleContent} + /> +
    + )} +
    + + {enableContent && ( +
    this.handlePanelOpenings("Content")} + > + setAttributes({ content: value })} + value={content} + /> +
    + )} + {enableButton && ( + setAttributes({ buttonText: value })} + /> + )} +
    +
    + +
    +
    +
    +
    + ); + } } -export default withCSSGenerator()(Edit); \ No newline at end of file +export default withCSSGenerator()(Edit); diff --git a/assets/reactjs/src/blocks/infobox/Save.js b/assets/reactjs/src/blocks/infobox/Save.js index c2457751..7fb35f9b 100644 --- a/assets/reactjs/src/blocks/infobox/Save.js +++ b/assets/reactjs/src/blocks/infobox/Save.js @@ -1,8 +1,10 @@ const { Fragment, Component } = wp.element; -const { RichText } = wp.blockEditor -import svg from '../heading/separators'; -const { QubelyButtonSave } = wp.qubelyComponents -const { HelperFunction: { animationAttr, IsInteraction } } = wp.qubelyComponents; +const { RichText } = wp.blockEditor; +import svg from "../heading/separators"; +const { QubelyButtonSave } = wp.qubelyComponents; +const { + HelperFunction: { animationAttr, IsInteraction }, +} = wp.qubelyComponents; class Save extends Component { render() { @@ -36,85 +38,136 @@ class Save extends Component { buttonIconName, buttonIconPosition, useMediaBg, - interaction - } = this.props.attributes + interaction, + } = this.props.attributes; const separators = { - solid: { type: 'css', separator: 'solid', width: 300, stroke: 10 }, - double: { type: 'css', separator: 'double', width: 300, stroke: 10 }, - dotted: { type: 'css', separator: 'dotted', width: 300, stroke: 10 }, - dashed: { type: 'css', separator: 'dashed', width: 300, stroke: 10 }, - pin: { type: 'svg', separator: 'pin', svg: svg['pin'], width: 100, stroke: 0 }, - pin_filled: { type: 'svg', separator: 'pin_filled', svg: svg['pin_filled'], width: 100, stroke: 0 }, - zigzag: { type: 'svg', separator: 'zigzag', svg: svg['zigzag'], style: 'fill', width: 88, stroke: 5 }, - zigzag_large: { type: 'svg', separator: 'zigzag_large', svg: svg['zigzag_large'], style: 'fill', width: 161, stroke: 5 }, - } + solid: { type: "css", separator: "solid", width: 300, stroke: 10 }, + double: { type: "css", separator: "double", width: 300, stroke: 10 }, + dotted: { type: "css", separator: "dotted", width: 300, stroke: 10 }, + dashed: { type: "css", separator: "dashed", width: 300, stroke: 10 }, + pin: { type: "svg", separator: "pin", svg: svg["pin"], width: 100, stroke: 0 }, + pin_filled: { type: "svg", separator: "pin_filled", svg: svg["pin_filled"], width: 100, stroke: 0 }, + zigzag: { type: "svg", separator: "zigzag", svg: svg["zigzag"], style: "fill", width: 88, stroke: 5 }, + zigzag_large: { + type: "svg", + separator: "zigzag_large", + svg: svg["zigzag_large"], + style: "fill", + width: 161, + stroke: 5, + }, + }; - const renderSeparators = - {separatorStyle && - - {separators[separatorStyle].type == 'css' && - - } - {separators[separatorStyle].type == 'svg' && - {separators[separatorStyle].svg} - } - - } - + const renderSeparators = ( + + {separatorStyle && ( + + {separators[separatorStyle].type == "css" && ( + + )} + {separators[separatorStyle].type == "svg" && ( + + {separators[separatorStyle].svg} + + )} + + )} + + ); - const titleTagName = 'h' + titleLevel; - const subTitleTagName = 'h' + subTitleLevel; - const interactionClass = IsInteraction(interaction) ? 'qubley-block-interaction' : ''; + const titleTagName = "h" + titleLevel; + const subTitleTagName = "h" + subTitleLevel; + const interactionClass = IsInteraction(interaction) ? "qubley-block-interaction" : ""; return (
    - {(layout != 4 && mediaType) && -
    - {(mediaType == 'icon' && iconName) && - - } - {(mediaType == 'image') && + {layout != 4 && mediaType && ( +
    + {mediaType == "icon" && iconName && } + {mediaType == "image" && ( - { - (imageType === 'local' && image.url != undefined) ? - {imgAlt - : - (imageType === 'external' && externalImageUrl.url != undefined) ? - {imgAlt - : -
    - } + {imageType === "local" && image.url != undefined ? ( + {imgAlt + ) : imageType === "external" && externalImageUrl.url != undefined ? ( + {imgAlt + ) : ( +
    + +
    + )}
    - } - {(mediaType == 'number' && number) && + )} + {mediaType == "number" && number && ( {number} - } + )}
    - } + )}
    -
    +
    - {separatorStyle && (separatorPosition == 'left' || separatorPosition == 'top' || separatorPosition == 'leftright') ?
    {renderSeparators}
    : ''} - - {separatorStyle != '' && (separatorPosition == 'right' || separatorPosition == 'bottom' || separatorPosition == 'leftright') ?
    {renderSeparators}
    : ''} + {separatorStyle && + (separatorPosition == "left" || + separatorPosition == "top" || + separatorPosition == "leftright") ? ( +
    {renderSeparators}
    + ) : ( + "" + )} + + {separatorStyle != "" && + (separatorPosition == "right" || + separatorPosition == "bottom" || + separatorPosition == "leftright") ? ( +
    {renderSeparators}
    + ) : ( + "" + )}
    - {subTitle == 1 && + {subTitle == 1 && (
    - +
    - } + )}
    - { - enableContent && + {enableContent && (
    - +
    - } - {enableButton && + )} + {enableButton && ( - } + )}
    - ) + ); } } -export default Save \ No newline at end of file +export default Save; diff --git a/assets/reactjs/src/blocks/infobox/attributes.js b/assets/reactjs/src/blocks/infobox/attributes.js index 4cff3f94..0a035066 100644 --- a/assets/reactjs/src/blocks/infobox/attributes.js +++ b/assets/reactjs/src/blocks/infobox/attributes.js @@ -1,568 +1,653 @@ const { - gloalSettings: { - globalAttributes - }, - QubelyButton: { - buttonAttributes - } + gloalSettings: { globalAttributes }, + QubelyButton: { buttonAttributes }, } = wp.qubelyComponents; const attributes = { - uniqueId: { type: 'string', default: '' }, - // Global - ...globalAttributes, - ...buttonAttributes, - recreateStyles: { - type: 'boolean', - default: true - }, - layout: { type: 'number', default: 1 }, - alignment: { - type: 'object', default: { md: 'left' }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-block-info-box {text-align: {{alignment}};}' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 4 } - ], - selector: '{{QUBELY}} .qubely-block-info-box {text-align: {{alignment}};}' - } - ] - }, - spacer: { type: 'object', default: { spaceTop: { md: '10', unit: 'px' }, spaceBottom: { md: '10', unit: 'px' } }, style: [{ selector: '{{QUBELY}}' }] }, - mediaType: { type: 'string', default: 'icon' }, - enableButton: { type: 'boolean', default: false }, - buttonToggleOption: { type: 'boolean', default: true }, + uniqueId: { type: "string", default: "" }, + // Global + ...globalAttributes, + ...buttonAttributes, + recreateStyles: { + type: "boolean", + default: true, + }, + layout: { type: "number", default: 1 }, + alignment: { + type: "object", + default: { md: "left" }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: 1 }], + selector: "{{QUBELY}} .qubely-block-info-box {text-align: {{alignment}};}", + }, + { + condition: [{ key: "layout", relation: "==", value: 4 }], + selector: "{{QUBELY}} .qubely-block-info-box {text-align: {{alignment}};}", + }, + ], + }, + spacer: { + type: "object", + default: { spaceTop: { md: "10", unit: "px" }, spaceBottom: { md: "10", unit: "px" } }, + style: [{ selector: "{{QUBELY}}" }], + }, + mediaType: { type: "string", default: "icon" }, + enableButton: { type: "boolean", default: false }, + buttonToggleOption: { type: "boolean", default: true }, - // Icon - iconName: { type: 'string', default: 'fas fa-rocket' }, - iconSize: { - type: 'string', default: '36px', - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'mediaType', relation: '==', value: 'icon' }, - { key: 'iconSize', relation: '!=', value: 'custom' } - ], - selector: '{{QUBELY}} .qubely-info-box-media {font-size: {{iconSize}};}' - } - ] - }, - iconSizeCustom: { - type: 'object', default: { md: 64, unit: 'px' }, - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'mediaType', relation: '==', value: 'icon' }, - { key: 'iconSize', relation: '==', value: 'custom' } - ], - selector: '{{QUBELY}} .qubely-info-box-media {font-size: {{iconSizeCustom}};}' - } - ] - }, - iconColor: { - type: 'string', default: 'var(--qubely-color-1)', - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'mediaType', relation: '==', value: 'icon' } - ], - selector: '{{QUBELY}} .qubely-info-box-media i {color: {{iconColor}};}' - } - ] - }, - iconHoverColor: { - type: 'string', default: 'var(--qubely-color-2)', - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'mediaType', relation: '==', value: 'icon' } - ], - selector: '{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-media i {color: {{iconHoverColor}};}' - } - ] - }, + // Icon + iconName: { type: "string", default: "fas fa-rocket" }, + iconSize: { + type: "string", + default: "36px", + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "mediaType", relation: "==", value: "icon" }, + { key: "iconSize", relation: "!=", value: "custom" }, + ], + selector: "{{QUBELY}} .qubely-info-box-media {font-size: {{iconSize}};}", + }, + ], + }, + iconSizeCustom: { + type: "object", + default: { md: 64, unit: "px" }, + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "mediaType", relation: "==", value: "icon" }, + { key: "iconSize", relation: "==", value: "custom" }, + ], + selector: "{{QUBELY}} .qubely-info-box-media {font-size: {{iconSizeCustom}};}", + }, + ], + }, + iconColor: { + type: "string", + default: "var(--qubely-color-1)", + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "mediaType", relation: "==", value: "icon" }, + ], + selector: "{{QUBELY}} .qubely-info-box-media i {color: {{iconColor}};}", + }, + ], + }, + iconHoverColor: { + type: "string", + default: "var(--qubely-color-2)", + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "mediaType", relation: "==", value: "icon" }, + ], + selector: + "{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-media i {color: {{iconHoverColor}};}", + }, + ], + }, - // Image - image: { type: 'object', default: {} }, - image2x: { type: 'object', default: {} }, - imgAlt: { type: 'string', default: '' }, - imageType: { - type: 'string', - default: 'local' - }, - externalImageUrl: { - type: 'object', - default: {} - }, + // Image + image: { type: "object", default: {} }, + image2x: { type: "object", default: {} }, + imgAlt: { type: "string", default: "" }, + imageType: { + type: "string", + default: "local", + }, + externalImageUrl: { + type: "object", + default: {}, + }, - imageSize: { - type: 'string', - default: 'custom', - style: [{ - condition: [ - { key: 'imageSize', relation: '!=', value: 'auto' }, - { key: 'imageSize', relation: '!=', value: 'custom' }, - ], - selector: '{{QUBELY}} .qubely-info-box-media {width: {{imageSize}};} {{QUBELY}} .qubely-info-box-media img {width: 100%;}' - }] - }, - imageWidth: { - type: 'object', - default: { - md: "600", - unit: "px" - }, - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'imageSize', relation: '==', value: 'custom' }, - { key: 'mediaType', relation: '==', value: 'image' }, - ], - selector: '{{QUBELY}} .qubely-info-box-media {width: {{imageWidth}};} {{QUBELY}} .qubely-info-box-media img {width: 100%;}' - } - ] - }, + imageSize: { + type: "string", + default: "custom", + style: [ + { + condition: [ + { key: "imageSize", relation: "!=", value: "auto" }, + { key: "imageSize", relation: "!=", value: "custom" }, + ], + selector: + "{{QUBELY}} .qubely-info-box-media {width: {{imageSize}};} {{QUBELY}} .qubely-info-box-media img {width: 100%;}", + }, + ], + }, + imageWidth: { + type: "object", + default: { + md: "600", + unit: "px", + }, + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "imageSize", relation: "==", value: "custom" }, + { key: "mediaType", relation: "==", value: "image" }, + ], + selector: + "{{QUBELY}} .qubely-info-box-media {width: {{imageWidth}};} {{QUBELY}} .qubely-info-box-media img {width: 100%;}", + }, + ], + }, - imageHeight: { - type: 'string', - default: 'auto', - style: [{ - condition: [ - { key: 'imageHeight', relation: '==', value: 'auto' }, - ], - selector: '{{QUBELY}} .qubely-info-box-media .qubely-info-box-image:not(.qubely-image-placeholder) {height: auto;}' - }] - }, + imageHeight: { + type: "string", + default: "auto", + style: [ + { + condition: [{ key: "imageHeight", relation: "==", value: "auto" }], + selector: + "{{QUBELY}} .qubely-info-box-media .qubely-info-box-image:not(.qubely-image-placeholder) {height: auto;}", + }, + ], + }, - imageCustomHeight: { - type: 'object', - default: { - md: 300, - unit: 'px' - }, - style: [{ - condition: [ - { key: 'imageHeight', relation: '==', value: 'custom' }, - ], - selector: '{{QUBELY}} .qubely-info-box-media .qubely-info-box-image:not(.qubely-image-placeholder) {height: {{imageCustomHeight}} !important;}' - }] - }, + imageCustomHeight: { + type: "object", + default: { + md: 300, + unit: "px", + }, + style: [ + { + condition: [{ key: "imageHeight", relation: "==", value: "custom" }], + selector: + "{{QUBELY}} .qubely-info-box-media .qubely-info-box-image:not(.qubely-image-placeholder) {height: {{imageCustomHeight}} !important;}", + }, + ], + }, - // Number - number: { type: 'number', default: 1 }, - numberColor: { - type: 'string', default: '', - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'mediaType', relation: '==', value: 'number' } - ], - selector: '{{QUBELY}} .qubely-info-box-number {color: {{numberColor}};}' - } - ] - }, - numberColorHover: { - type: 'string', default: '', - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'mediaType', relation: '==', value: 'number' } - ], - selector: '{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-number {color: {{numberColorHover}};}' - } - ] - }, - numberTypography: { - type: 'object', - default: { - openTypography: 1, - size: { - md: 48, - unit: 'px' - } - }, - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'mediaType', relation: '==', value: 'number' } - ], - selector: '{{QUBELY}} .qubely-info-box-media' - } - ] - }, + // Number + number: { type: "number", default: 1 }, + numberColor: { + type: "string", + default: "", + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "mediaType", relation: "==", value: "number" }, + ], + selector: "{{QUBELY}} .qubely-info-box-number {color: {{numberColor}};}", + }, + ], + }, + numberColorHover: { + type: "string", + default: "", + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "mediaType", relation: "==", value: "number" }, + ], + selector: + "{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-number {color: {{numberColorHover}};}", + }, + ], + }, + numberTypography: { + type: "object", + default: { + openTypography: 1, + size: { + md: 48, + unit: "px", + }, + }, + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "mediaType", relation: "==", value: "number" }, + ], + selector: "{{QUBELY}} .qubely-info-box-media", + }, + ], + }, - // Media background - useMediaBg: { type: 'boolean', default: 1 }, - mediaBg: { - type: 'object', - default: { - openColor: 1, - type: 'color', - color: '#D6EBFF' - }, - style: [ - { - condition: [ - { key: 'mediaType', relation: '!=', value: 'image' }, - // { key: 'layout', relation: '!=', value: 4 }, - { key: 'useMediaBg', relation: '==', value: true } - ], - selector: '{{QUBELY}} .qubely-info-box-media.qubely-media-has-bg' - } - ] - }, - mediaBgHover: { - type: 'object', default: {}, - style: [ - { - condition: [ - { key: 'mediaType', relation: '!=', value: 'image' }, - // { key: 'layout', relation: '!=', value: 4 }, - { key: 'useMediaBg', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-media' - } - ] - }, - mediaBackgroundSize: { - type: 'object', default: { md: '20', unit: 'px' }, - style: [ - { - condition: [ - { key: 'mediaType', relation: '!=', value: 'image' }, - // { key: 'layout', relation: '!=', value: 4 }, - { key: 'useMediaBg', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-info-box-media { padding: {{mediaBackgroundSize}};}' - } - ] - }, - mediaBorderRadius: { - type: 'object', - default: { - openBorderRadius: 1, - radiusType: 'global', - global: { md: 5 }, - unit: 'px', + // Media background + useMediaBg: { type: "boolean", default: 1 }, + mediaBg: { + type: "object", + default: { + openColor: 1, + type: "color", + color: "#D6EBFF", + }, + style: [ + { + condition: [ + { key: "mediaType", relation: "!=", value: "image" }, + // { key: 'layout', relation: '!=', value: 4 }, + { key: "useMediaBg", relation: "==", value: true }, + ], + selector: "{{QUBELY}} .qubely-info-box-media.qubely-media-has-bg", + }, + ], + }, + mediaBgHover: { + type: "object", + default: {}, + style: [ + { + condition: [ + { key: "mediaType", relation: "!=", value: "image" }, + // { key: 'layout', relation: '!=', value: 4 }, + { key: "useMediaBg", relation: "==", value: 1 }, + ], + selector: "{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-media", + }, + ], + }, + mediaBackgroundSize: { + type: "object", + default: { md: "20", unit: "px" }, + style: [ + { + condition: [ + { key: "mediaType", relation: "!=", value: "image" }, + // { key: 'layout', relation: '!=', value: 4 }, + { key: "useMediaBg", relation: "==", value: 1 }, + ], + selector: "{{QUBELY}} .qubely-info-box-media { padding: {{mediaBackgroundSize}};}", + }, + ], + }, + mediaBorderRadius: { + type: "object", + default: { + openBorderRadius: 1, + radiusType: "global", + global: { md: 5 }, + unit: "px", + }, + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "useMediaBg", relation: "==", value: 1 }, + ], + selector: "{{QUBELY}} .qubely-info-box-media, {{QUBELY}} .qubely-info-box-media img", + }, + ], + }, - }, - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'useMediaBg', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-info-box-media, {{QUBELY}} .qubely-info-box-media img' - } - ] - }, + // Media Border + mediaBorder: { + type: "number", + default: 0, + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "useMediaBg", relation: "==", value: 1 }, + ], + selector: "{{QUBELY}} .qubely-info-box-media", + }, + ], + }, + mediaBorderColorHover: { + type: "string", + default: "#e5e5e5", + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "useMediaBg", relation: "==", value: 1 }, + ], + selector: + "{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-media { border-color: {{mediaBorderColorHover}};}", + }, + ], + }, - // Media Border - mediaBorder: { - type: 'number', default: 0, - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'useMediaBg', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-info-box-media' - } - ] - }, - mediaBorderColorHover: { - type: 'string', default: '#e5e5e5', - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'useMediaBg', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-media { border-color: {{mediaBorderColorHover}};}' - } - ] - }, + // Media Shadow + mediaShadow: { + type: "object", + default: {}, + style: [ + { + condition: [{ key: "layout", relation: "!=", value: 4 }], + selector: "{{QUBELY}} .qubely-info-box-media", + }, + ], + }, + mediaShadowHover: { + type: "object", + default: {}, + style: [ + { + condition: [ + { key: "layout", relation: "!=", value: 4 }, + { key: "useMediaShadow", relation: "==", value: 1 }, + ], + selector: "{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-media", + }, + ], + }, - // Media Shadow - mediaShadow: { - type: 'object', default: {}, - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - ], - selector: '{{QUBELY}} .qubely-info-box-media' - } - ] - }, - mediaShadowHover: { - type: 'object', default: {}, - style: [ - { - condition: [ - { key: 'layout', relation: '!=', value: 4 }, - { key: 'useMediaShadow', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-media' - } - ] - }, + // Media Spacing + mediaSpacing: { + type: "object", + default: { md: 20, unit: "px" }, + style: [ + { + condition: [{ key: "layout", relation: "==", value: 1 }], + selector: "{{QUBELY}} .qubely-info-box-media {margin-bottom: {{mediaSpacing}};}", + }, + { + condition: [{ key: "layout", relation: "==", value: 2 }], + selector: "{{QUBELY}} .qubely-info-box-media {margin-right: {{mediaSpacing}};}", + }, + { + condition: [{ key: "layout", relation: "==", value: 3 }], + selector: "{{QUBELY}} .qubely-info-box-media {margin-left: {{mediaSpacing}};}", + }, + ], + }, - // Media Spacing - mediaSpacing: { - type: 'object', default: { md: 20, unit: 'px' }, - style: [ - { - condition: [ - { key: 'layout', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-info-box-media {margin-bottom: {{mediaSpacing}};}' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 2 } - ], - selector: '{{QUBELY}} .qubely-info-box-media {margin-right: {{mediaSpacing}};}' - }, - { - condition: [ - { key: 'layout', relation: '==', value: 3 } - ], - selector: '{{QUBELY}} .qubely-info-box-media {margin-left: {{mediaSpacing}};}' - }, - ] - }, + // Title + title: { + type: "string", + source: "html", + selector: ".qubely-info-box-title", + default: "This is an infobox", + }, + titleLevel: { type: "number", default: 2 }, + titleTypography: { + type: "object", + default: { openTypography: 1, size: { md: 24, unit: "px" } }, + style: [{ selector: "{{QUBELY}} .qubely-info-box-title" }], + }, + titleColor: { + type: "string", + default: "", + style: [{ selector: "{{QUBELY}} .qubely-info-box-title {color: {{titleColor}};}" }], + }, + titleColorHover: { + type: "string", + default: "", + style: [ + { + selector: + "{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-title {color: {{titleColorHover}};}", + }, + ], + }, + titleSpacing: { + type: "object", + default: { md: 10, unit: "px" }, + style: [{ selector: "{{QUBELY}} .qubely-info-box-title-inner {margin-bottom: {{titleSpacing}};}" }], + }, - // Title - title: { - type: 'string', - source: 'html', - selector: '.qubely-info-box-title', - default: 'This is an infobox' - }, - titleLevel: { type: 'number', default: 2 }, - titleTypography: { type: 'object', default: { openTypography: 1, size: { md: 24, unit: 'px' } }, style: [{ selector: '{{QUBELY}} .qubely-info-box-title' }] }, - titleColor: { type: 'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-info-box-title {color: {{titleColor}};}' }] }, - titleColorHover: { type: 'string', default: '', style: [{ selector: '{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-title {color: {{titleColorHover}};}' }] }, - titleSpacing: { type: 'object', default: { md: 10, unit: 'px' }, style: [{ selector: '{{QUBELY}} .qubely-info-box-title-inner {margin-bottom: {{titleSpacing}};}' }] }, + subTitle: { type: "boolean", default: 0 }, + subTitleLevel: { type: "number", default: 3 }, + subTitleContent: { + type: "string", + source: "html", + selector: ".qubely-info-box-sub-title", + default: "Sub Title", + }, + subTitleTypography: { + type: "object", + default: { openTypography: 1, size: { md: 16, unit: "px" } }, + style: [{ selector: "{{QUBELY}} .qubely-block-info-box .qubely-info-box-sub-title" }], + }, + subTitleColor: { + type: "string", + default: "#333", + style: [ + { + condition: [{ key: "subTitle", relation: "==", value: 1 }], + selector: "{{QUBELY}} .qubely-block-info-box .qubely-info-box-sub-title {color: {{subTitleColor}};}", + }, + ], + }, + subTitleColorHover: { + type: "string", + default: "", + style: [ + { + condition: [{ key: "subTitle", relation: "==", value: 1 }], + selector: + "{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-sub-title {color: {{subTitleColorHover}};}", + }, + ], + }, + subTitleSpacing: { + type: "object", + default: { md: 15, unit: "px" }, + style: [ + { + condition: [{ key: "subTitle", relation: "==", value: 1 }], + selector: + "{{QUBELY}} .qubely-block-info-box .qubely-info-box-sub-title {margin-bottom: {{subTitleSpacing}};}", + }, + ], + }, - subTitle: { type: 'boolean', default: 0 }, - subTitleLevel: { type: 'number', default: 3 }, - subTitleContent: { - type: 'string', - source: 'html', - selector: '.qubely-info-box-sub-title', - default: 'Sub Title' - }, - subTitleTypography: { type: 'object', default: { openTypography: 1, size: { md: 16, unit: 'px' } }, style: [{ selector: '{{QUBELY}} .qubely-block-info-box .qubely-info-box-sub-title' }] }, - subTitleColor: { - type: 'string', default: '#333', - style: [ - { - condition: [ - { key: 'subTitle', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-block-info-box .qubely-info-box-sub-title {color: {{subTitleColor}};}' - }, - ] - }, - subTitleColorHover: { - type: 'string', default: '', - style: [ - { - condition: [ - { key: 'subTitle', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-sub-title {color: {{subTitleColorHover}};}' - }, - ] - }, - subTitleSpacing: { - type: 'object', default: { md: 15, unit: 'px' }, - style: [ - { - condition: [ - { key: 'subTitle', relation: '==', value: 1 } - ], - selector: '{{QUBELY}} .qubely-block-info-box .qubely-info-box-sub-title {margin-bottom: {{subTitleSpacing}};}' - }, - ] - }, + // Title separator + separatorStyle: { + type: "string", + default: "", + style: [ + { + condition: [{ key: "separatorStyle", relation: "!=", value: "" }], + selector: + "{{QUBELY}} .qubely-block-info-box .qubely-separator-type-css {border-top-style: {{separatorStyle}};}", + }, + ], + }, + separatorPosition: { type: "string", default: "top" }, + separatorColor: { + type: "string", + default: "#5D7FEB", + style: [ + { + condition: [{ key: "separatorStyle", relation: "!=", value: "" }], + selector: + "{{QUBELY}} .qubely-block-info-box .qubely-separator-type-svg svg .qubely-separator-stroke {stroke: {{separatorColor}};} {{QUBELY}} .qubely-block-info-box svg .qubely-separator-fill {fill: {{separatorColor}};} {{QUBELY}} .qubely-block-info-box .qubely-separator-type-css {border-top-color: {{separatorColor}};}", + }, + ], + }, + separatorColorHover: { + type: "string", + default: "", + style: [ + { + condition: [{ key: "separatorStyle", relation: "!=", value: "" }], + selector: + "{{QUBELY}} .qubely-block-info-box:hover .qubely-separator-type-svg svg .qubely-separator-stroke {stroke: {{separatorColorHover}};} {{QUBELY}} .qubely-block-info-box:hover svg .qubely-separator-fill {fill: {{separatorColorHover}};} {{QUBELY}} .qubely-block-info-box:hover .qubely-separator-type-css {border-top-color: {{separatorColorHover}};}", + }, + ], + }, + separatorStroke: { + type: "number", + default: 3, + style: [ + { + condition: [{ key: "separatorStyle", relation: "!=", value: "" }], + selector: + "{{QUBELY}} .qubely-block-info-box .qubely-separator-type-svg svg .qubely-separator-stroke {stroke-width: {{separatorStroke}}px;} {{QUBELY}} .qubely-block-info-box .qubely-separator-type-css {border-top-width: {{separatorStroke}}px;}", + }, + ], + }, + separatorWidth: { + type: "object", + default: { md: 60 }, + style: [ + { + condition: [{ key: "separatorStyle", relation: "!=", value: "" }], + selector: + "{{QUBELY}} .qubely-block-info-box .qubely-separator-type-css {width: {{separatorWidth}}px;} {{QUBELY}} .qubely-block-info-box .qubely-separator-type-svg svg {width: {{separatorWidth}}px;}", + }, + ], + }, + separatorSpacing: { + type: "object", + default: { md: 10 }, + style: [ + { + condition: [ + { key: "separatorStyle", relation: "!=", value: "" }, + { key: "separatorPosition", relation: "==", value: "left" }, + ], + selector: "{{QUBELY}} .qubely-separator {margin-right: {{separatorSpacing}}px;}", + }, + { + condition: [ + { key: "separatorStyle", relation: "!=", value: "" }, + { key: "separatorPosition", relation: "==", value: "right" }, + ], + selector: "{{QUBELY}} .qubely-separator {margin-left: {{separatorSpacing}}px;}", + }, + { + condition: [ + { key: "separatorStyle", relation: "!=", value: "" }, + { key: "separatorPosition", relation: "==", value: "leftright" }, + ], + selector: + "{{QUBELY}} .qubely-separator-before {margin-right: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-after {margin-left: {{separatorSpacing}}px;}", + }, + { + condition: [ + { key: "separatorStyle", relation: "!=", value: "" }, + { key: "separatorPosition", relation: "==", value: "top" }, + ], + selector: "{{QUBELY}} .qubely-separator {margin-bottom: {{separatorSpacing}}px;}", + }, + { + condition: [ + { key: "separatorStyle", relation: "!=", value: "" }, + { key: "separatorPosition", relation: "==", value: "bottom" }, + ], + selector: "{{QUBELY}} .qubely-separator {margin-top: {{separatorSpacing}}px;}", + }, + ], + }, - // Title separator - separatorStyle: { - type: 'string', default: '', - style: [ - { - condition: [ - { key: 'separatorStyle', relation: '!=', value: '' } - ], - selector: '{{QUBELY}} .qubely-block-info-box .qubely-separator-type-css {border-top-style: {{separatorStyle}};}' - }, - ] - }, - separatorPosition: { type: 'string', default: 'top' }, - separatorColor: { - type: 'string', default: '#5D7FEB', - style: [ - { - condition: [ - { key: 'separatorStyle', relation: '!=', value: '' } - ], - selector: '{{QUBELY}} .qubely-block-info-box .qubely-separator-type-svg svg .qubely-separator-stroke {stroke: {{separatorColor}};} {{QUBELY}} .qubely-block-info-box svg .qubely-separator-fill {fill: {{separatorColor}};} {{QUBELY}} .qubely-block-info-box .qubely-separator-type-css {border-top-color: {{separatorColor}};}' - }, - ] - }, - separatorColorHover: { - type: 'string', default: '', - style: [ - { - condition: [ - { key: 'separatorStyle', relation: '!=', value: '' } - ], - selector: '{{QUBELY}} .qubely-block-info-box:hover .qubely-separator-type-svg svg .qubely-separator-stroke {stroke: {{separatorColorHover}};} {{QUBELY}} .qubely-block-info-box:hover svg .qubely-separator-fill {fill: {{separatorColorHover}};} {{QUBELY}} .qubely-block-info-box:hover .qubely-separator-type-css {border-top-color: {{separatorColorHover}};}' - }, - ] - }, - separatorStroke: { - type: 'number', default: 3, - style: [ - { - condition: [ - { key: 'separatorStyle', relation: '!=', value: '' } - ], - selector: '{{QUBELY}} .qubely-block-info-box .qubely-separator-type-svg svg .qubely-separator-stroke {stroke-width: {{separatorStroke}}px;} {{QUBELY}} .qubely-block-info-box .qubely-separator-type-css {border-top-width: {{separatorStroke}}px;}' - }, - ] - }, - separatorWidth: { - type: 'object', default: { md: 60 }, - style: [ - { - condition: [ - { key: 'separatorStyle', relation: '!=', value: '' } - ], - selector: '{{QUBELY}} .qubely-block-info-box .qubely-separator-type-css {width: {{separatorWidth}}px;} {{QUBELY}} .qubely-block-info-box .qubely-separator-type-svg svg {width: {{separatorWidth}}px;}' - }, - ] - }, - separatorSpacing: { - type: 'object', default: { md: 10 }, - style: [ - { - condition: [ - { key: 'separatorStyle', relation: '!=', value: '' }, - { key: 'separatorPosition', relation: '==', value: 'left' }, - ], - selector: '{{QUBELY}} .qubely-separator {margin-right: {{separatorSpacing}}px;}' - }, - { - condition: [ - { key: 'separatorStyle', relation: '!=', value: '' }, - { key: 'separatorPosition', relation: '==', value: 'right' }, - ], - selector: '{{QUBELY}} .qubely-separator {margin-left: {{separatorSpacing}}px;}' - }, - { - condition: [ - { key: 'separatorStyle', relation: '!=', value: '' }, - { key: 'separatorPosition', relation: '==', value: 'leftright' }, - ], - selector: '{{QUBELY}} .qubely-separator-before {margin-right: {{separatorSpacing}}px;} {{QUBELY}} .qubely-separator-after {margin-left: {{separatorSpacing}}px;}' - }, - { - condition: [ - { key: 'separatorStyle', relation: '!=', value: '' }, - { key: 'separatorPosition', relation: '==', value: 'top' }, - ], - selector: '{{QUBELY}} .qubely-separator {margin-bottom: {{separatorSpacing}}px;}' - }, - { - condition: [ - { key: 'separatorStyle', relation: '!=', value: '' }, - { key: 'separatorPosition', relation: '==', value: 'bottom' }, - ], - selector: '{{QUBELY}} .qubely-separator {margin-top: {{separatorSpacing}}px;}' - }, - ] - }, + //Content + enableContent: { type: "boolean", default: true }, + content: { + type: "string", + source: "html", + selector: ".qubely-info-box-text", + default: + "Qubely blocks are added to the Gutenberg editor as soon as you install the plugin. You can start using it as any other Gutenberg block.", + }, + contentTypography: { + type: "object", + default: { openTypography: 1, size: { md: 16, unit: "px" } }, + style: [ + { + condition: [{ key: "enableContent", relation: "==", value: true }], + selector: "{{QUBELY}} .qubely-info-box-text", + }, + ], + }, + contentColor: { + type: "string", + default: "", + style: [ + { + condition: [{ key: "enableContent", relation: "==", value: true }], + selector: "{{QUBELY}} .qubely-info-box-text {color: {{contentColor}};}", + }, + ], + }, + contentColorHover: { + type: "string", + default: "", + style: [ + { + condition: [{ key: "enableContent", relation: "==", value: true }], + selector: + "{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-text {color: {{contentColorHover}};}", + }, + ], + }, + contentPadding: { + type: "object", + default: {}, + style: [ + { + condition: [{ key: "enableContent", relation: "==", value: true }], + selector: "{{QUBELY}} .qubely-info-box-body", + }, + ], + }, + contentSpacing: { + type: "object", + default: { md: 10, unit: "px" }, + style: [ + { + condition: [ + { key: "enableButton", relation: "==", value: true }, + { key: "enableContent", relation: "==", value: true }, + ], + selector: "{{QUBELY}} .qubely-info-box-body .qubely-info-box-text {margin-bottom: {{contentSpacing}};}", + }, + { + condition: [ + { key: "enableButton", relation: "==", value: false }, + { key: "enableContent", relation: "==", value: true }, + ], + selector: "{{QUBELY}} .qubely-info-box-body .qubely-info-box-text {margin-bottom: 0;}", + }, + ], + }, - //Content - enableContent: { type: 'boolean', default: true }, - content: { - type: 'string', - source: 'html', - selector: '.qubely-info-box-text', - default: 'Qubely blocks are added to the Gutenberg editor as soon as you install the plugin. You can start using it as any other Gutenberg block.' - }, - contentTypography: { type: 'object', default: { openTypography: 1, size: { md: 16, unit: 'px' } }, style: [{ condition: [{ key: 'enableContent', relation: '==', value: true }], selector: '{{QUBELY}} .qubely-info-box-text' }] }, - contentColor: { type: 'string', default: '', style: [{ condition: [{ key: 'enableContent', relation: '==', value: true }], selector: '{{QUBELY}} .qubely-info-box-text {color: {{contentColor}};}' }] }, - contentColorHover: { type: 'string', default: '', style: [{ condition: [{ key: 'enableContent', relation: '==', value: true }], selector: '{{QUBELY}} .qubely-block-info-box:hover .qubely-info-box-text {color: {{contentColorHover}};}' }] }, - contentPadding: { type: 'object', default: {}, style: [{ condition: [{ key: 'enableContent', relation: '==', value: true }], selector: '{{QUBELY}} .qubely-info-box-body' }] }, - contentSpacing: { - type: 'object', default: { md: 10, unit: 'px' }, - style: [ - { - condition: [{ key: 'enableButton', relation: '==', value: true }, { key: 'enableContent', relation: '==', value: true }], - selector: '{{QUBELY}} .qubely-info-box-body .qubely-info-box-text {margin-bottom: {{contentSpacing}};}' - }, - { - condition: [ - { key: 'enableButton', relation: '==', value: false }, - { key: 'enableContent', relation: '==', value: true } - ], - selector: '{{QUBELY}} .qubely-info-box-body .qubely-info-box-text {margin-bottom: 0;}' - }, - ] - }, + // Body + bgColor: { type: "object", default: {}, style: [{ selector: "{{QUBELY}} .qubely-block-info-box" }] }, + bgColorHover: { type: "object", default: {}, style: [{ selector: "{{QUBELY}} .qubely-block-info-box:hover" }] }, + bgPadding: { + type: "object", + default: { + paddingType: "global", + }, + style: [ + { + selector: "{{QUBELY}} .qubely-block-info-box", + }, + ], + }, + bgBorderRadius: { + type: "object", + default: { + openBorderRadius: 1, + radiusType: "global", + }, + style: [ + { + selector: "{{QUBELY}} .qubely-block-info-box", + }, + ], + }, + bgBorder: { type: "object", default: {}, style: [{ selector: "{{QUBELY}} .qubely-block-info-box" }] }, + bgBorderColorHover: { + type: "string", + default: "#e5e5e5", + style: [{ selector: "{{QUBELY}} .qubely-block-info-box:hover { border-color: {{bgBorderColorHover}};}" }], + }, + bgShadow: { type: "object", default: { color: "" }, style: [{ selector: "{{QUBELY}} .qubely-block-info-box" }] }, + bgShadowHover: { + type: "object", + default: { color: "" }, + style: [{ selector: "{{QUBELY}} .qubely-block-info-box:hover" }], + }, - // Body - bgColor: { type: 'object', default: {}, style: [{ selector: '{{QUBELY}} .qubely-block-info-box' }] }, - bgColorHover: { type: 'object', default: {}, style: [{ selector: '{{QUBELY}} .qubely-block-info-box:hover' }] }, - bgPadding: { - type: 'object', - default: { - paddingType: 'global' - }, - style: [ - { - selector: '{{QUBELY}} .qubely-block-info-box' - } - ] - }, - bgBorderRadius: { - type: 'object', - default: { - openBorderRadius: 1, - radiusType: 'global', + sourceOfCopiedStyle: { type: "boolean", default: false }, +}; - }, - style: [ - { - selector: '{{QUBELY}} .qubely-block-info-box' - }, - ] - }, - bgBorder: { type: 'object', default: {}, style: [{ selector: '{{QUBELY}} .qubely-block-info-box' }] }, - bgBorderColorHover: { type: 'string', default: '#e5e5e5', style: [{ selector: '{{QUBELY}} .qubely-block-info-box:hover { border-color: {{bgBorderColorHover}};}' }] }, - bgShadow: { type: 'object', default: { color: '' }, style: [{ selector: '{{QUBELY}} .qubely-block-info-box' }] }, - bgShadowHover: { type: 'object', default: { color: '' }, style: [{ selector: '{{QUBELY}} .qubely-block-info-box:hover' }] }, - - sourceOfCopiedStyle: { type: 'boolean', default: false } -} - -export default attributes; \ No newline at end of file +export default attributes; diff --git a/assets/reactjs/src/blocks/infobox/index.js b/assets/reactjs/src/blocks/infobox/index.js index 418b85db..067a8ba6 100644 --- a/assets/reactjs/src/blocks/infobox/index.js +++ b/assets/reactjs/src/blocks/infobox/index.js @@ -1,31 +1,23 @@ -import './style.scss'; -import Edit from './Edit' -import Save from './Save'; -import attributes from './attributes'; +import "./style.scss"; +import Edit from "./Edit"; +import Save from "./Save"; +import attributes from "./attributes"; const { __ } = wp.i18n; const { registerBlockType } = wp.blocks; -registerBlockType('qubely/infobox', { - title: __('Info Box', 'qubely'), - description: 'Be creatively informative with Qubely Info Box.', - icon: {__('Info, - category: 'qubely', - supports: { - align: [ - 'center', - 'wide', - 'full' - ], - }, - keywords: [ - __('service', 'qubely'), - __('feature', 'qubely'), - __('info', 'qubely') - ], - example: { - attributes: {}, - }, - attributes, - edit: Edit, - save: Save +registerBlockType("qubely/infobox", { + title: __("Info Box", "qubely"), + description: "Be creatively informative with Qubely Info Box.", + icon: {__("Info, + category: "qubely", + supports: { + align: ["center", "wide", "full"], + }, + keywords: [__("service", "qubely"), __("feature", "qubely"), __("info", "qubely")], + example: { + attributes: {}, + }, + attributes, + edit: Edit, + save: Save, }); diff --git a/assets/reactjs/src/blocks/infobox/style.scss b/assets/reactjs/src/blocks/infobox/style.scss index 55e3bcc7..63507cd5 100644 --- a/assets/reactjs/src/blocks/infobox/style.scss +++ b/assets/reactjs/src/blocks/infobox/style.scss @@ -1,119 +1,119 @@ .qubely-block-info-box { - transition: border-color 400ms, background-color 400ms, box-shadow 400ms; - h1, - h2, - h3, - h4, - h5, - h6 { - padding: 0; - margin: 0; - line-height: 1; - position: relative; - &::before, - &::after { - display: none !important; - } + transition: border-color 400ms, background-color 400ms, box-shadow 400ms; + h1, + h2, + h3, + h4, + h5, + h6 { + padding: 0; + margin: 0; + line-height: 1; + position: relative; + &::before, + &::after { + display: none !important; + } - .qubely-text-has-bgcolor { - padding-left: 10px; - padding-right: 10px; - } - } + .qubely-text-has-bgcolor { + padding-left: 10px; + padding-right: 10px; + } + } - .qubely-info-box-media { - display: inline-block; - line-height: 1; - text-align: center; - overflow: hidden; - i, - span, - img { - font-style: normal; - position: relative; - display: inline-block; - transition: 400ms; - object-fit: cover; - } + .qubely-info-box-media { + display: inline-block; + text-align: center; + overflow: hidden; + i, + span, + img { + font-style: normal; + position: relative; + display: inline-block; + transition: color 400ms, background-color 400ms, border-color 400ms, border-width 400ms; + object-fit: cover; + } - img { - max-width: 100%; - height: auto; - } + img { + max-width: 100%; + height: auto; + } - &.qubely-media-has-bg { - i, - .qubely-info-box-number { - min-width: 1em; - height: 1em; - white-space: nowrap; - &:before { - position: absolute; - left: 50%; - transform: translateX(-50%); - } - } - } - } + &.qubely-media-has-bg { + display: inline-flex; + i, + .qubely-info-box-number { + min-width: 1em; + height: 1em; + white-space: nowrap; + &:before { + position: absolute; + left: 50%; + transform: translateX(-50%); + } + } + } + } - .qubely-info-box-title { - margin: 0 !important; - } + .qubely-info-box-title { + margin: 0 !important; + } - .qubely-info-box-media, - .qubely-info-box-title, - .qubely-info-box-text { - transition: color 400ms, border-color 400ms, background-color 400ms, box-shadow 400ms; - } + .qubely-info-box-media, + .qubely-info-box-title, + .qubely-info-box-text { + transition: color 400ms, border-color 400ms, background-color 400ms, box-shadow 400ms; + } - &.qubely-info-box-layout-2, - &.qubely-info-box-layout-3 { - display: -ms-flexbox; - display: flex; - -ms-flex-align: start; - align-items: flex-start; + &.qubely-info-box-layout-2, + &.qubely-info-box-layout-3 { + display: -ms-flexbox; + display: flex; + -ms-flex-align: start; + align-items: flex-start; - .qubely-info-box-body { - -ms-flex: 1; - flex: 1; - } - } + .qubely-info-box-body { + -ms-flex: 1; + flex: 1; + } + } - &.qubely-info-box-layout-3 { - flex-direction: row-reverse; - .qubely-info-box-body { - text-align: right; - } - } + &.qubely-info-box-layout-3 { + flex-direction: row-reverse; + .qubely-info-box-body { + text-align: right; + } + } - .qubely-separator { - font-size: 0; - .qubely-separator-type-css, - .qubely-separator-type-svg { - display: inline-block; - } - } + .qubely-separator { + font-size: 0; + .qubely-separator-type-css, + .qubely-separator-type-svg { + display: inline-block; + } + } - .qubely-separator-position-left, - .qubely-separator-position-right, - .qubely-separator-position-leftright { - .qubely-info-box-title-inner { - display: inline-flex; - align-items: center; + .qubely-separator-position-left, + .qubely-separator-position-right, + .qubely-separator-position-leftright { + .qubely-info-box-title-inner { + display: inline-flex; + align-items: center; - .qubely-info-box-title, - .qubely-separator { - display: inline-flex; - } - } - } + .qubely-info-box-title, + .qubely-separator { + display: inline-flex; + } + } + } } .qubely-info-box-image.qubely-image-placeholder { - display: flex; - &:not(.size-custom) { - width: 100%; - } - &.size-auto { - width: 210px; - } + display: flex; + &:not(.size-custom) { + width: 100%; + } + &.size-auto { + width: 210px; + } } diff --git a/assets/reactjs/src/blocks/map/Edit.js b/assets/reactjs/src/blocks/map/Edit.js index 48ef4bb6..8c0ec356 100644 --- a/assets/reactjs/src/blocks/map/Edit.js +++ b/assets/reactjs/src/blocks/map/Edit.js @@ -1,377 +1,456 @@ const { __ } = wp.i18n; -const { InspectorControls, BlockControls } = wp.blockEditor +const { InspectorControls, BlockControls } = wp.blockEditor; const { Component, Fragment } = wp.element; const { PanelBody, ToggleControl, TextControl, RangeControl, Toolbar, Button } = wp.components; -const { Media, Separator, gloalSettings: { globalSettingsPanel, animationSettings }, Inline: { InlineToolbar }, withCSSGenerator, InspectorTabs, InspectorTab } = wp.qubelyComponents -import mapStyles from './mapStyles' +const { + Media, + Separator, + gloalSettings: { globalSettingsPanel, animationSettings }, + Inline: { InlineToolbar }, + withCSSGenerator, + InspectorTabs, + InspectorTab, +} = wp.qubelyComponents; +import mapStyles from "./mapStyles"; class Edit extends Component { - - constructor(props) { - super(props); - this.initMap = this.initMap.bind(this); - this.initSearchBox = this.initSearchBox.bind(this); - this.initMapLibrary = this.initMapLibrary.bind(this); - this.setSettings = this.setSettings.bind(this); - this.getStyles = this.getStyles.bind(this); - this._saveGlobally = this._saveGlobally.bind(this); - this.state = { spacer: true, saved_globally: false} - } - - componentDidMount() { - const { setAttributes, clientId, attributes: { uniqueId, apiKey } } = this.props; - const _client = clientId.substr(0, 6); - - if (!uniqueId) { - setAttributes({ uniqueId: _client }); - } else if (uniqueId && uniqueId !== _client) { - setAttributes({ uniqueId: _client }); - } - - const mapIframe = this.refs.qubelyGoogleMapIframe; - if (typeof mapIframe !== 'undefined') { - mapIframe.addEventListener('click', (e) => { - e.preventDefault(); - }); - } - - if(qubely_admin.qubely_gmap_api_key) { - setAttributes({apiKey: qubely_admin.qubely_gmap_api_key}); - this.initMapLibrary(qubely_admin.qubely_gmap_api_key); - } else if(apiKey) { - this.initMapLibrary(apiKey); - } else { - this.initMapLibrary(''); - } - - } - - async _saveGlobally(apiKey) { - if(!apiKey) return; - - try { - await wp.apiFetch({ - path: 'qubely/v1/add_qubely_options', - method: 'POST', - data: {key: 'qubely_gmap_api_key', value: apiKey} - }); - this.setState({saved_globally: true}); - } catch (e) { - // debug - console.log(e); - } - } - - initMapLibrary(apiKey) { - const { initMap, initSearchBox, loadScriptAsync } = this; - this.props.setAttributes({ apiKey: apiKey }); - if (apiKey) { - const apiURL = `https://maps.googleapis.com/maps/api/js?key=${apiKey}&libraries=places&callback=initMap`; - window.initMap = initMap; - if (typeof google === 'object' && typeof google.maps === 'object') { - initMap(); - initSearchBox(); - } else { - loadScriptAsync(apiURL).then(() => { - initMap(); - initSearchBox(); - }); - } - } - } - - loadScriptAsync(src) { - return new Promise((resolve, reject) => { - const tag = document.createElement('script'); - tag.id = "qubely-gmap" - tag.src = src; - tag.async = true; - tag.onload = () => { - resolve(); - }; - const firstScriptTag = document.getElementsByTagName('script')[0]; - firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); - }); - } - - initSearchBox() { - const { setSettings, props: { attributes, setAttributes } } = this; - let { mapAddress } = attributes; - // Create the search box and link it to the UI element. - const input = this.refs.mapAddress; - const autocomplete = new google.maps.places.Autocomplete(input); - autocomplete.setFields(['place_id', 'geometry', 'formatted_address']); - autocomplete.addListener('place_changed', () => { - var place = autocomplete.getPlace(); - if (!place.geometry) { - return; - } - mapAddress = place.formatted_address; - setAttributes({ placeID: place.place_id }); - setSettings('mapAddress', mapAddress); - input.value = mapAddress; - }); - input.value = mapAddress; - } - - initMap() { - const { getStyles, props: { attributes, setAttributes } } = this; - const { placeID, zoom, mapStyle, showZoomButtons, showMapTypeButtons, showStreetViewButton, showFullscreenButton, optionDraggable, showMarker, iconPointer } = attributes; - const mapCanvas = this.refs.qubelyGoogleMap; - const mapOptions = { - center: { lat: 11.5024338, lng: 17.7578122 }, - zoom: 1, - zoomControl: showZoomButtons, - mapTypeControl: showMapTypeButtons, - streetViewControl: showStreetViewButton, - fullscreenControl: showFullscreenButton, - draggable: optionDraggable, - styles: mapStyle ? getStyles(mapStyle) : [], - } - const map = new google.maps.Map(mapCanvas, mapOptions); - - if (placeID) { - var request = { - placeId: placeID, - fields: ['place_id', 'geometry', 'name', 'formatted_address', 'adr_address', 'website'] - }; - - const service = new google.maps.places.PlacesService(map); - service.getDetails(request, (place, status) => { - if (status === google.maps.places.PlacesServiceStatus.OK) { - - if (place.geometry.viewport) { - map.fitBounds(place.geometry.viewport); - } else { - setAttributes({ zoom: 16 }); - map.setCenter(place.geometry.location); - map.setZoom(zoom); - } - - let markerOption = { map: map }; - if (iconPointer) markerOption.icon = iconPointer; - const marker = new google.maps.Marker(markerOption); - // Set the position of the marker using the place ID and location. - marker.setPlace({ - placeId: place.place_id, - location: place.geometry.location - }); - marker.setVisible(showMarker); - - const contentString = '
    ' + place.name + '
    ' + - place.adr_address + '
    ' + - '
    '; - - const infowindow = new google.maps.InfoWindow({ - content: contentString - }); - marker.addListener('click', function () { - infowindow.open(map, marker); - }); - } - }); - } - } - - setSettings(type, val) { - const { attributes: { apiKey }, setAttributes } = this.props; - setAttributes({ [type]: val }); - if (apiKey) setTimeout(() => this.initMap(), 300); - } - - getStyles(string) { - let result = []; - try { - result = JSON.parse(string); - } catch (e) { - return []; - } - return result; - } - - render() { - const { - setAttributes, - attributes: { - uniqueId, - className, - zoom, - height, - apiKey, - mapAddress, - selectedStyle, - showZoomButtons, - showMapTypeButtons, - showStreetViewButton, - showFullscreenButton, - optionDraggable, - showMarker, - iconPointer, - - //animation - animation, - //global - enablePosition, - selectPosition, - positionXaxis, - positionYaxis, - globalZindex, - hideTablet, - hideMobile, - globalCss } - } = this.props; - - const setting_url = qubely_admin.admin_url + 'admin.php?page=qubely-settings'; - - return ( - - - - - - { - (qubely_admin.qubely_gmap_api_key || this.state.saved_globally ) ? ( -
    {__('Google map API key successfully added')}, {__('Edit API key here')}
    - ) : ( - apiKey ? ( -
    - this.initMapLibrary(val)} /> - -
    - ) : ( -
    {__('Some features requires Google map API key')}, {__('Add API key here')}
    - ) - ) - } - - this.setSettings('zoom', val)} /> - this.setSettings('height', val)} /> -
    - - {!apiKey && - {__('Need Google API key extend feature.')} - } -
    - -
    - {mapStyles.map((option, index) => { - return ( -
    - { - this.setSettings('selectedStyle', option.value); - this.setSettings('mapStyle', JSON.stringify(option.json)); - }} - src={option.image} - title={__(option.label)} - alt={__('Map Style')} - /> -

    {__(option.label)}

    -
    - ); - })} -
    -
    - - - this.setSettings('showZoomButtons', val)} /> - this.setSettings('showMapTypeButtons', val)} /> - this.setSettings('showStreetViewButton', val)} /> - this.setSettings('showFullscreenButton', val)} /> - this.setSettings('optionDraggable', val)} /> - this.setSettings('showMarker', val)} /> - {showMarker && - - - this.setSettings('iconPointer', val.url)} /> - - } - -
    -
    - - {animationSettings(uniqueId, animation, setAttributes)} - -
    -
    - - - - - - - - {globalSettingsPanel(enablePosition, selectPosition, positionXaxis, positionYaxis, globalZindex, hideTablet, hideMobile, globalCss, setAttributes)} - -
    -
    - -
    -
    - {!apiKey && -
    - this.props.setAttributes({ mapAddress: val })} - /> -