@policystudio/policy-studio-ui-vue 1.2.0-access.78 → 1.2.0-access.79

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@policystudio/policy-studio-ui-vue",
3
- "version": "1.2.0-access.78",
3
+ "version": "1.2.0-access.79",
4
4
  "description": "Policy Studio UI",
5
5
  "author": "Policy Studio Team",
6
6
  "scripts": {
@@ -54,7 +54,7 @@
54
54
  <script setup>
55
55
  import { getParentVueComponentByName } from '../../util/GeneralFunctions.js'
56
56
  import { useCollapseAnimation } from '../../../dist/composables/useCollapseAnimation.js'
57
- import { ref, computed, getCurrentInstance } from 'vue'
57
+ import { ref, computed, getCurrentInstance, onBeforeUnmount } from 'vue'
58
58
 
59
59
  const { beforeEnter, enter, afterEnter, beforeLeave, leave } = useCollapseAnimation()
60
60
 
@@ -154,11 +154,40 @@ const toggle = () => {
154
154
  _toggle()
155
155
  }
156
156
 
157
- const onHeaderFocusIn = (e) => emit('header-focusin', e)
157
+ let focusOutTimer = null
158
+ let suppressFocusIn = false
159
+
160
+ onBeforeUnmount(() => {
161
+ clearTimeout(focusOutTimer)
162
+ })
163
+
164
+ const onHeaderFocusIn = (e) => {
165
+ if (suppressFocusIn) return
166
+ if (e.relatedTarget && e.currentTarget.contains(e.relatedTarget)) return
167
+ if (focusOutTimer) {
168
+ clearTimeout(focusOutTimer)
169
+ focusOutTimer = null
170
+ return
171
+ }
172
+ emit('header-focusin', e)
173
+ }
158
174
 
159
175
  const onHeaderFocusOut = (e) => {
160
176
  if (!e.currentTarget.contains(e.relatedTarget)) {
161
- emit('header-focusout', e)
177
+ const wrapper = e.currentTarget
178
+ clearTimeout(focusOutTimer)
179
+ focusOutTimer = setTimeout(() => {
180
+ focusOutTimer = null
181
+ const activeEl = document.activeElement
182
+ if (!wrapper.contains(activeEl)) {
183
+ suppressFocusIn = true
184
+ emit('header-focusout', e)
185
+ if (activeEl && document.activeElement !== activeEl && activeEl.isConnected) {
186
+ activeEl.focus()
187
+ }
188
+ suppressFocusIn = false
189
+ }
190
+ }, 0)
162
191
  }
163
192
  }
164
193
 
@@ -4,7 +4,7 @@
4
4
  :class="[getComponentClass, { disabled: disabled }]"
5
5
  @click="change()"
6
6
  @keydown.enter.stop="change()"
7
- tabindex="0"
7
+ :tabindex="tabindex"
8
8
  >
9
9
  <span
10
10
  class="psui-el-switch-button"
@@ -47,6 +47,10 @@ const props = defineProps({
47
47
  default: 'big',
48
48
  validator: (value) => ['small', 'big'].includes(value),
49
49
  },
50
+ tabindex: {
51
+ type: [Number, String],
52
+ default: 0,
53
+ },
50
54
  })
51
55
 
52
56
  const getToggleClass = computed(() => {
@@ -2,7 +2,7 @@
2
2
  <div
3
3
  class="psui-general-icon"
4
4
  :style="{ display: display }"
5
- tabindex="0"
5
+ :tabindex="tabindex"
6
6
  v-bind="$attrs"
7
7
  @click="emit('click', $event)"
8
8
  @keydown="emit('keydown',$event)"
@@ -132,6 +132,10 @@ const props = defineProps({
132
132
  type: String,
133
133
  default: null,
134
134
  },
135
+ tabindex: {
136
+ type: [Number, String],
137
+ default: 0,
138
+ },
135
139
  })
136
140
 
137
141
  const finishedImageLoad = ref(false)