srcdev-nuxt-components 0.0.31 → 0.0.33

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.
@@ -1,24 +1,18 @@
1
1
  <template>
2
2
  <ClientOnly>
3
- <button @click.prevent="showPopover()" :popovertarget class="popover-trigger" :class="[elementClasses]">
3
+ <button :popovertarget popovertargetaction="toggle" class="popover-trigger" :class="[elementClasses]">
4
4
  <slot name="trigger"></slot>
5
5
  </button>
6
6
 
7
- <dialog :open class="dialog-popover" popover :id="popovertarget" :class="[elementClasses]">
8
- <focus-trap v-model:active="open" :clickOutsideDeactivates="true" @deactivate="closePopover()">
9
- <div>
10
- <button @click.prevent="closePopover()">x</button>
11
- <slot name="popoverCotent"></slot>
12
- </div>
13
- </focus-trap>
7
+ <dialog popover role="tooltip" :id="popovertarget" :class="[elementClasses]">
8
+ <button :popovertarget popovertargetaction="hide">x</button>
9
+ <slot name="popoverCotent"></slot>
14
10
  </dialog>
15
11
  </ClientOnly>
16
12
  </template>
17
13
 
18
14
  <script setup lang="ts">
19
- import { FocusTrap } from 'focus-trap-vue';
20
-
21
- const { popovertarget, styleClassPassthrough } = defineProps({
15
+ const props = defineProps({
22
16
  popovertarget: {
23
17
  type: String,
24
18
  required: true,
@@ -31,32 +25,20 @@ const { popovertarget, styleClassPassthrough } = defineProps({
31
25
 
32
26
  const anchorName = `--anchor-${useId()}`;
33
27
 
34
- const { elementClasses } = useStyleClassPassthrough(styleClassPassthrough);
35
-
36
- const open = ref<boolean>(false);
37
-
38
- const showPopover = () => {
39
- console.log('showPopover()');
40
- open.value = true;
41
- };
42
-
43
- const closePopover = () => {
44
- console.log('closePopover()');
45
- open.value = false;
46
- };
28
+ const { elementClasses } = useStyleClassPassthrough(props.styleClassPassthrough);
47
29
  </script>
48
30
 
49
- <style lang="css">
50
- @position-try --left {
31
+ <style scoped lang="css">
32
+ @position-try --right {
51
33
  inset: auto;
52
- top: anchor(bottom);
53
- right: anchor(right);
34
+ top: anchor(top);
35
+ left: anchor(right);
54
36
  }
55
37
 
56
- @position-try --top {
38
+ @position-try --left {
57
39
  inset: auto;
58
- bottom: anchor(top);
59
- right: anchor(right);
40
+ top: anchor(top);
41
+ right: anchor(left);
60
42
  }
61
43
 
62
44
  /* @layer popover-setup { */
@@ -64,12 +46,7 @@ const closePopover = () => {
64
46
  anchor-name: v-bind(anchorName);
65
47
  }
66
48
 
67
- .dialog-popover {
68
- /* backdrop-filter: blur(5px);
69
- background-color: rgba(0, 0, 0, 0.5);
70
- border: 0;
71
- padding: 0; */
72
-
49
+ dialog {
73
50
  display: none;
74
51
  position: absolute;
75
52
  position-anchor: v-bind(anchorName);
@@ -81,8 +58,8 @@ const closePopover = () => {
81
58
  transition: opacity 200ms, display 200ms, overlay 200ms;
82
59
  transition-behavior: allow-discrete;
83
60
 
84
- position-try-fallbacks: --left;
85
- position-try-fallbacks: --top;
61
+ position-try-fallbacks: --left, --right;
62
+ /* position-try-fallbacks: --right; */
86
63
 
87
64
  &:popover-open {
88
65
  display: block;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "srcdev-nuxt-components",
3
3
  "type": "module",
4
- "version": "0.0.31",
4
+ "version": "0.0.33",
5
5
  "main": "nuxt.config.ts",
6
6
  "scripts": {
7
7
  "clean": "rm -rf .nuxt && rm -rf .output && rm -rf .playground/.nuxt && rm -rf .playground/.output",