@teammodlr/ui-kit 3.0.0-beta.22 → 3.0.0-beta.23

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": "@teammodlr/ui-kit",
3
- "version": "3.0.0-beta.22",
3
+ "version": "3.0.0-beta.23",
4
4
  "description": "",
5
5
  "main": "lib/index.cjs.js",
6
6
  "module": "lib/index.es.js",
@@ -17,11 +17,11 @@
17
17
  :disable-outside-pointer-events="modal"
18
18
  @open-auto-focus="handleOpenAutoFocus"
19
19
  @escape-key-down="handleEscapeKeyDown"
20
- @pointer-down-outside="handleOutsideEvent"
21
- @focus-outside="handleOutsideEvent"
22
- @interact-outside="handleOutsideEvent"
20
+ @pointer-down-outside.prevent
21
+ @focus-outside="handleFocusOutside"
22
+ @interact-outside.prevent
23
23
  >
24
- <FocusScope :trapped="activeFocusTrap" :loop="activeFocusTrap">
24
+ <FocusScope :trapped="focusTrap" :loop="focusTrap">
25
25
  <slot v-if="$slots.container" name="container" :close="close"></slot>
26
26
  <template v-else>
27
27
  <div :class="style.content">
@@ -136,8 +136,6 @@ export default defineComponent({
136
136
  const zIndex = ref(props.zIndex ?? nextZIndex());
137
137
  provide(ZINDEX, zIndex);
138
138
  const hasOpened = ref(false);
139
- const focusTrapOverride = ref<boolean | null>(null);
140
- const activeFocusTrap = computed(() => focusTrapOverride.value ?? props.focusTrap);
141
139
 
142
140
  const isDragging = ref<boolean>(false);
143
141
 
@@ -247,10 +245,8 @@ export default defineComponent({
247
245
  zIndex.value = nextZIndex();
248
246
  }
249
247
 
250
- function handleOutsideEvent(event: Event) {
251
- if (activeFocusTrap.value) {
252
- event.preventDefault();
253
- }
248
+ function handleFocusOutside(event: Event) {
249
+ event.preventDefault();
254
250
  }
255
251
 
256
252
  function handleOpenAutoFocus(event: Event) {
@@ -351,21 +347,8 @@ export default defineComponent({
351
347
  { immediate: true }
352
348
  );
353
349
 
354
- function setFocusTrap(value: boolean) {
355
- focusTrapOverride.value = value;
356
- const el = dialogElement.value;
357
- if (el) {
358
- if (value) {
359
- el.removeAttribute('inert');
360
- } else {
361
- el.setAttribute('inert', '');
362
- }
363
- }
364
- }
365
-
366
350
  expose({
367
351
  close,
368
- setFocusTrap,
369
352
  });
370
353
 
371
354
  return {
@@ -389,9 +372,8 @@ export default defineComponent({
389
372
  onEnter,
390
373
  handleOpenChange,
391
374
  handleOpenAutoFocus,
392
- handleOutsideEvent,
393
- isOpen: computed(() => props.open),
394
- activeFocusTrap,
375
+ handleFocusOutside,
376
+ isOpen: computed(() => props.open)
395
377
  };
396
378
  },
397
379
  });
@@ -39,10 +39,6 @@ export default defineComponent({
39
39
  };
40
40
  }
41
41
 
42
- function setFocusTrap(key: string, enabled: boolean) {
43
- dialogRefs.value[key]?.setFocusTrap(enabled);
44
- }
45
-
46
42
  function create(key: string, options: DialogOptions = {}): DialogReactive {
47
43
  if (dialogMap[key]) {
48
44
  // Merge new options into existing reactive options
@@ -76,7 +72,6 @@ export default defineComponent({
76
72
  handleClose(key);
77
73
  }
78
74
  },
79
- setFocusTrap: (enabled: boolean) => setFocusTrap(key, enabled),
80
75
  };
81
76
 
82
77
  dialogMap[key] = dialog;
@@ -127,8 +122,7 @@ export default defineComponent({
127
122
  remove,
128
123
  hasOpenDialog: () => hasOpenDialog.value,
129
124
  openDialogCount: () => openDialogCount.value,
130
- openDialogKeys: () => openDialogKeys.value,
131
- setFocusTrap,
125
+ openDialogKeys: () => openDialogKeys.value
132
126
  };
133
127
 
134
128
  provide('m-dialog', api);
@@ -19,7 +19,6 @@ export interface DialogReactive {
19
19
  options: DialogOptions;
20
20
  open: () => void;
21
21
  close: () => void;
22
- setFocusTrap: (enabled: boolean) => void;
23
22
  }
24
23
 
25
24
  export interface DialogApiInjection {
@@ -28,5 +27,4 @@ export interface DialogApiInjection {
28
27
  hasOpenDialog: () => boolean;
29
28
  openDialogCount: () => number;
30
29
  openDialogKeys: () => string[];
31
- setFocusTrap: (key: string, enabled: boolean) => void;
32
30
  }