diff --git a/cypress/integration/highlight--popup.ts b/cypress/integration/highlight--popup.ts index 7786e51..2ce25db 100644 --- a/cypress/integration/highlight--popup.ts +++ b/cypress/integration/highlight--popup.ts @@ -16,9 +16,10 @@ describe('highlight - Popup', () => { if (!elements.popup) return; elements.popup.innerHTML = ` - -
Click Me!
- `; +
+ +
Click Me!
+
`; }, }, popper: { placement: 'right' }, diff --git a/cypress/templates/index.scss b/cypress/templates/index.scss index 84702c8..21a2a4a 100644 --- a/cypress/templates/index.scss +++ b/cypress/templates/index.scss @@ -19,7 +19,10 @@ body { border: 1px solid darken(aliceblue, 10%); } -[uig-highlight-box][uig-show] { +// Disabled highlight & popup animation for tests. + +[uig-highlight-box][uig-show], +[uig-popup-wrapper] { animation-delay: 0s !important; animation-duration: 0s !important; } diff --git a/package-lock.json b/package-lock.json index ada2f61..e002334 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@ranndev/ui-guide", - "version": "0.1.5", + "version": "0.1.6", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 908cfcd..3db8bdc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ranndev/ui-guide", - "version": "0.1.5", + "version": "0.1.6", "description": "A programmatic way of making highlight guide", "main": "./dist/js/cjs/index.js", "module": "./dist/js/esm/ui-guide.js", diff --git a/themes/default.scss b/themes/default.scss index f3966f3..97a0300 100644 --- a/themes/default.scss +++ b/themes/default.scss @@ -9,7 +9,7 @@ $box-border-size: 3px !default; box-sizing: content-box !important; border: $box-border-size solid darken($theme-color, 5%); border-radius: 0.25rem; - box-shadow: 0 0 0 999rem rgba($theme-color, 0.1), + box-shadow: 0 0 0 999rem darken(rgba($theme-color, 0.15), 10%), 0 0 0.25rem rgba($theme-color, 0.3); opacity: 0; will-change: padding, margin, opacity; @@ -33,6 +33,78 @@ $box-border-size: 3px !default; } } +[uig-popup-wrapper] { + position: relative; + display: flex; + max-width: 450px; + opacity: 0; + will-change: opacity, transform; + + [uig-popup][uig-show][x-placement='top'] & { + animation: slide-top 0.2s 0.3s ease-out forwards; + + @keyframes slide-top { + from { + transform: translateY(30px); + opacity: 0; + } + + to { + transform: translateY(0); + opacity: 1; + } + } + } + + [uig-popup][uig-show][x-placement='right'] & { + animation: slide-right 0.2s 0.3s ease-out forwards; + + @keyframes slide-right { + from { + transform: translateX(-30px); + opacity: 0; + } + + to { + transform: translateX(0); + opacity: 1; + } + } + } + + [uig-popup][uig-show][x-placement='bottom'] & { + animation: slide-bottom 0.2s 0.3s ease-out forwards; + + @keyframes slide-bottom { + from { + transform: translateY(-30px); + opacity: 0; + } + + to { + transform: translateY(0); + opacity: 1; + } + } + } + + [uig-popup][uig-show][x-placement='left'] & { + animation: slide-left 0.2s 0.3s ease-out forwards; + + @keyframes slide-left { + from { + transform: translateX(30px); + opacity: 0; + } + + to { + transform: translateX(0); + opacity: 1; + } + } + } +} + span[x-arrow] { position: absolute; z-index: 2;