@kiva/kv-components 4.2.2 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [4.3.0](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@4.2.2...@kiva/kv-components@4.3.0) (2024-12-10)
7
+
8
+
9
+ ### Features
10
+
11
+ * scroll user to original position when sheet is opening in mobile ([0c783fa](https://github.com/kiva/kv-ui-elements/commit/0c783fae5f61cb2958fb6220baa284c4287bedac))
12
+
13
+
14
+
15
+
16
+
6
17
  ## [4.2.2](https://github.com/kiva/kv-ui-elements/compare/@kiva/kv-components@4.2.1...@kiva/kv-components@4.2.2) (2024-12-09)
7
18
 
8
19
 
@@ -119,12 +119,18 @@ export default {
119
119
  const open = ref(false);
120
120
  const initialStyles = ref({});
121
121
  const modalStyles = ref({});
122
+ const userScrollPosition = ref(0);
122
123
 
123
124
  const closeSideSheet = () => {
124
125
  open.value = false;
125
126
  kvTrackFunction.value(trackEventCategory.value, 'click', 'side-sheet-closed');
126
127
 
127
- if (animationSourceElement.value) {
128
+ if (animationSourceElement.value && window.scrollTo) {
129
+ window.scrollTo({
130
+ top: userScrollPosition.value,
131
+ behavior: 'smooth',
132
+ });
133
+
128
134
  modalStyles.value = {
129
135
  ...initialStyles.value,
130
136
  transition: 'all 0.5s ease-in-out',
@@ -154,6 +160,8 @@ export default {
154
160
  const height = rect?.height ?? 0;
155
161
 
156
162
  if (top || left || width || height) {
163
+ userScrollPosition.value = window.scrollY ?? 0;
164
+
157
165
  initialStyles.value = {
158
166
  position: 'fixed',
159
167
  top: `${top}px`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiva/kv-components",
3
- "version": "4.2.2",
3
+ "version": "4.3.0",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -96,5 +96,5 @@
96
96
  "peerDependencies": {
97
97
  "vue": ">=3.0.0"
98
98
  },
99
- "gitHead": "85baa0abfafd6a73e7cb9857bc35861b5ccd24b8"
99
+ "gitHead": "59cde71cb180af5440ab3ac7792ae58ea12eb843"
100
100
  }
@@ -119,12 +119,18 @@ export default {
119
119
  const open = ref(false);
120
120
  const initialStyles = ref({});
121
121
  const modalStyles = ref({});
122
+ const userScrollPosition = ref(0);
122
123
 
123
124
  const closeSideSheet = () => {
124
125
  open.value = false;
125
126
  kvTrackFunction.value(trackEventCategory.value, 'click', 'side-sheet-closed');
126
127
 
127
- if (animationSourceElement.value) {
128
+ if (animationSourceElement.value && window.scrollTo) {
129
+ window.scrollTo({
130
+ top: userScrollPosition.value,
131
+ behavior: 'smooth',
132
+ });
133
+
128
134
  modalStyles.value = {
129
135
  ...initialStyles.value,
130
136
  transition: 'all 0.5s ease-in-out',
@@ -154,6 +160,8 @@ export default {
154
160
  const height = rect?.height ?? 0;
155
161
 
156
162
  if (top || left || width || height) {
163
+ userScrollPosition.value = window.scrollY ?? 0;
164
+
157
165
  initialStyles.value = {
158
166
  position: 'fixed',
159
167
  top: `${top}px`,