@mekari/pixel3-popover 0.0.4 → 0.0.6-dev.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.
Files changed (38) hide show
  1. package/dist/{chunk-SMKHJPNG.mjs → chunk-52BTWLDY.mjs} +2 -2
  2. package/dist/{chunk-KRK533DP.mjs → chunk-5LOKC2YN.mjs} +1 -1
  3. package/dist/{chunk-3VISLXE6.mjs → chunk-ACYTEMPK.mjs} +5 -8
  4. package/dist/chunk-HXE2PLZA.mjs +33 -0
  5. package/dist/{chunk-EOUKE4WB.mjs → chunk-MPDM4USP.mjs} +25 -13
  6. package/dist/{chunk-E2N74NQW.mjs → chunk-VN53X7QU.mjs} +1 -1
  7. package/dist/{chunk-OBEDLACV.mjs → chunk-WBFSONWB.mjs} +2 -2
  8. package/dist/{chunk-6AOSFLZR.mjs → chunk-YFYQ7S3B.mjs} +2 -2
  9. package/dist/content.js +9 -12
  10. package/dist/content.mjs +3 -3
  11. package/dist/index.d.mts +0 -1
  12. package/dist/index.d.ts +0 -1
  13. package/dist/index.js +63 -12182
  14. package/dist/index.mjs +10 -10
  15. package/dist/list-item.js +18 -12560
  16. package/dist/list-item.mjs +3 -8
  17. package/dist/list.mjs +2 -2
  18. package/dist/metafile-cjs.json +1 -1
  19. package/dist/metafile-esm.json +1 -1
  20. package/dist/modules/popover.hooks.d.mts +1 -0
  21. package/dist/modules/popover.hooks.d.ts +1 -0
  22. package/dist/modules/popover.hooks.js +25 -13
  23. package/dist/modules/popover.hooks.mjs +1 -1
  24. package/dist/modules/popover.props.d.mts +10 -16
  25. package/dist/modules/popover.props.d.ts +10 -16
  26. package/dist/modules/popover.props.js +5 -8
  27. package/dist/modules/popover.props.mjs +1 -1
  28. package/dist/popover.d.mts +17 -23
  29. package/dist/popover.d.ts +17 -23
  30. package/dist/popover.js +12 -15
  31. package/dist/popover.mjs +3 -3
  32. package/dist/singleton-popover.d.mts +17 -24
  33. package/dist/singleton-popover.d.ts +17 -24
  34. package/dist/singleton-popover.js +6 -9
  35. package/dist/singleton-popover.mjs +3 -3
  36. package/dist/trigger.mjs +2 -2
  37. package/package.json +5 -4
  38. package/dist/chunk-G54Z6NKL.mjs +0 -12176
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  popoverProps
3
- } from "./chunk-3VISLXE6.mjs";
3
+ } from "./chunk-ACYTEMPK.mjs";
4
4
  import {
5
5
  usePopover
6
- } from "./chunk-EOUKE4WB.mjs";
6
+ } from "./chunk-MPDM4USP.mjs";
7
7
  import {
8
8
  PopoverProvider
9
9
  } from "./chunk-2ZUCITXI.mjs";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  usePopoverList
3
- } from "./chunk-EOUKE4WB.mjs";
3
+ } from "./chunk-MPDM4USP.mjs";
4
4
 
5
5
  // src/list.tsx
6
6
  import { createVNode as _createVNode } from "vue";
@@ -14,7 +14,7 @@ var popoverProps = {
14
14
  triggerId: {
15
15
  type: String
16
16
  },
17
- defaultIsOpen: {
17
+ isDefaultOpen: {
18
18
  type: Boolean
19
19
  },
20
20
  isManual: {
@@ -23,21 +23,18 @@ var popoverProps = {
23
23
  isOpen: {
24
24
  type: Boolean
25
25
  },
26
- returnFocusOnClose: {
26
+ isFocusOnClose: {
27
27
  type: Boolean
28
28
  },
29
- initialFocusRef: {
30
- type: Boolean
31
- },
32
- closeOnBlur: {
29
+ isCloseOnBlur: {
33
30
  type: Boolean,
34
31
  default: true
35
32
  },
36
- closeOnEscape: {
33
+ isCloseOnEscape: {
37
34
  type: Boolean,
38
35
  default: true
39
36
  },
40
- closeOnSelect: {
37
+ isCloseOnSelect: {
41
38
  type: Boolean,
42
39
  default: false
43
40
  },
@@ -0,0 +1,33 @@
1
+ import {
2
+ popoverListItemProps
3
+ } from "./chunk-ACYTEMPK.mjs";
4
+ import {
5
+ usePopoverListItem
6
+ } from "./chunk-MPDM4USP.mjs";
7
+
8
+ // src/list-item.tsx
9
+ import { createVNode as _createVNode } from "vue";
10
+ import { defineComponent } from "vue";
11
+ import { MpIcon } from "@mekari/pixel3-icon";
12
+ var MpPopoverListItem = defineComponent({
13
+ name: "MpPopoverListItem",
14
+ props: popoverListItemProps,
15
+ setup(props, {
16
+ slots
17
+ }) {
18
+ const {
19
+ rootAttrs,
20
+ contentAttrs
21
+ } = usePopoverListItem(props);
22
+ return () => {
23
+ return _createVNode("button", rootAttrs.value, [_createVNode("div", contentAttrs, [slots.default(), props.isArrow ? _createVNode(MpIcon, {
24
+ "name": "chevrons-right",
25
+ "size": "sm"
26
+ }, null) : null])]);
27
+ };
28
+ }
29
+ });
30
+
31
+ export {
32
+ MpPopoverListItem
33
+ };
@@ -12,7 +12,7 @@ import { useId, onClickOutside, onKeyStroke, unrefElement } from "@mekari/pixel3
12
12
  import { popoverContentRecipe, popoverListRecipe, popoverListItemRecipe } from "@mekari/pixel3-styled-system/recipes";
13
13
  import { flex } from "@mekari/pixel3-styled-system/patterns";
14
14
  function usePopover(props, emit) {
15
- const isOpen = ref(props.defaultIsOpen);
15
+ const isOpen = ref(props.isDefaultOpen);
16
16
  const triggerNode = ref(null);
17
17
  const contentNode = ref(null);
18
18
  const placement = ref(props.placement);
@@ -26,27 +26,27 @@ function usePopover(props, emit) {
26
26
  whileElementsMounted: autoUpdate
27
27
  });
28
28
  function onOpenPopover() {
29
+ if (props.isManual)
30
+ return;
31
+ isOpen.value = true;
29
32
  emit("open", {
30
33
  isOpen,
31
34
  triggerNode,
32
35
  contentNode,
33
36
  placement
34
37
  });
35
- if (props.isManual)
36
- return;
37
- isOpen.value = true;
38
38
  }
39
39
  __name(onOpenPopover, "onOpenPopover");
40
40
  function onClosePopover() {
41
+ if (props.isManual)
42
+ return;
43
+ isOpen.value = false;
41
44
  emit("close", {
42
45
  isOpen,
43
46
  triggerNode,
44
47
  contentNode,
45
48
  placement
46
49
  });
47
- if (props.isManual)
48
- return;
49
- isOpen.value = false;
50
50
  }
51
51
  __name(onClosePopover, "onClosePopover");
52
52
  function setHovering(value) {
@@ -80,7 +80,7 @@ function useSingletonPopover(props, emit) {
80
80
  const {
81
81
  triggerNode
82
82
  } = toRefs(props);
83
- const isOpen = ref(props.defaultIsOpen);
83
+ const isOpen = ref(props.isDefaultOpen);
84
84
  const contentNode = ref(null);
85
85
  const placement = ref(props.placement);
86
86
  const middleware = ref([offset(4), flip(), shift()]);
@@ -189,8 +189,8 @@ function usePopoverContent(props, emit) {
189
189
  } = usePopoverContext();
190
190
  const {
191
191
  id,
192
- closeOnBlur,
193
- closeOnEscape,
192
+ isCloseOnBlur,
193
+ isCloseOnEscape,
194
194
  trigger,
195
195
  isAdaptiveWidth,
196
196
  usePortal
@@ -199,14 +199,14 @@ function usePopoverContent(props, emit) {
199
199
  const getId = computed(() => (id == null ? void 0 : id.value) ? `popover-content-${id.value}` : `popover-content-${useId(4)}`);
200
200
  onClickOutside(restContentNode, (e) => {
201
201
  emit("blur", e);
202
- if (closeOnBlur.value) {
202
+ if (isCloseOnBlur.value) {
203
203
  onClosePopover();
204
204
  }
205
205
  });
206
206
  onKeyStroke("Escape", (e) => {
207
207
  if (isOpen.value) {
208
208
  emit("escape");
209
- if (closeOnEscape.value) {
209
+ if (isCloseOnEscape.value) {
210
210
  onClosePopover();
211
211
  e.preventDefault();
212
212
  }
@@ -271,6 +271,13 @@ function usePopoverList() {
271
271
  }
272
272
  __name(usePopoverList, "usePopoverList");
273
273
  function usePopoverListItem(props) {
274
+ const {
275
+ onClosePopover,
276
+ rootProps: popoverProps
277
+ } = usePopoverContext();
278
+ const {
279
+ isCloseOnSelect
280
+ } = popoverProps;
274
281
  const isHighligted = ref(false);
275
282
  const rootAttrs = computed(() => {
276
283
  return {
@@ -281,7 +288,12 @@ function usePopoverListItem(props) {
281
288
  "data-highlight": isHighligted.value || void 0,
282
289
  "data-active": props.isActive || void 0,
283
290
  onmouseenter: () => isHighligted.value = true,
284
- onmouseleave: () => isHighligted.value = false
291
+ onmouseleave: () => isHighligted.value = false,
292
+ onClick: () => {
293
+ if (isCloseOnSelect.value) {
294
+ onClosePopover();
295
+ }
296
+ }
285
297
  };
286
298
  });
287
299
  const contentAttrs = {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  usePopoverTrigger
3
- } from "./chunk-EOUKE4WB.mjs";
3
+ } from "./chunk-MPDM4USP.mjs";
4
4
 
5
5
  // src/trigger.tsx
6
6
  import { createVNode as _createVNode, Fragment as _Fragment } from "vue";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  popoverContentProps
3
- } from "./chunk-3VISLXE6.mjs";
3
+ } from "./chunk-ACYTEMPK.mjs";
4
4
  import {
5
5
  usePopoverContent
6
- } from "./chunk-EOUKE4WB.mjs";
6
+ } from "./chunk-MPDM4USP.mjs";
7
7
 
8
8
  // src/content.tsx
9
9
  import { createTextVNode as _createTextVNode, createVNode as _createVNode, mergeProps as _mergeProps, Fragment as _Fragment } from "vue";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  singletonPopoverProps
3
- } from "./chunk-3VISLXE6.mjs";
3
+ } from "./chunk-ACYTEMPK.mjs";
4
4
  import {
5
5
  useSingletonPopover
6
- } from "./chunk-EOUKE4WB.mjs";
6
+ } from "./chunk-MPDM4USP.mjs";
7
7
  import {
8
8
  PopoverProvider
9
9
  } from "./chunk-2ZUCITXI.mjs";
package/dist/content.js CHANGED
@@ -53,8 +53,8 @@ function usePopoverContent(props, emit) {
53
53
  } = usePopoverContext();
54
54
  const {
55
55
  id,
56
- closeOnBlur,
57
- closeOnEscape,
56
+ isCloseOnBlur,
57
+ isCloseOnEscape,
58
58
  trigger,
59
59
  isAdaptiveWidth,
60
60
  usePortal
@@ -63,14 +63,14 @@ function usePopoverContent(props, emit) {
63
63
  const getId = (0, import_vue.computed)(() => (id == null ? void 0 : id.value) ? `popover-content-${id.value}` : `popover-content-${(0, import_pixel3_utils2.useId)(4)}`);
64
64
  (0, import_pixel3_utils2.onClickOutside)(restContentNode, (e) => {
65
65
  emit("blur", e);
66
- if (closeOnBlur.value) {
66
+ if (isCloseOnBlur.value) {
67
67
  onClosePopover();
68
68
  }
69
69
  });
70
70
  (0, import_pixel3_utils2.onKeyStroke)("Escape", (e) => {
71
71
  if (isOpen.value) {
72
72
  emit("escape");
73
- if (closeOnEscape.value) {
73
+ if (isCloseOnEscape.value) {
74
74
  onClosePopover();
75
75
  e.preventDefault();
76
76
  }
@@ -141,7 +141,7 @@ var popoverProps = {
141
141
  triggerId: {
142
142
  type: String
143
143
  },
144
- defaultIsOpen: {
144
+ isDefaultOpen: {
145
145
  type: Boolean
146
146
  },
147
147
  isManual: {
@@ -150,21 +150,18 @@ var popoverProps = {
150
150
  isOpen: {
151
151
  type: Boolean
152
152
  },
153
- returnFocusOnClose: {
153
+ isFocusOnClose: {
154
154
  type: Boolean
155
155
  },
156
- initialFocusRef: {
157
- type: Boolean
158
- },
159
- closeOnBlur: {
156
+ isCloseOnBlur: {
160
157
  type: Boolean,
161
158
  default: true
162
159
  },
163
- closeOnEscape: {
160
+ isCloseOnEscape: {
164
161
  type: Boolean,
165
162
  default: true
166
163
  },
167
- closeOnSelect: {
164
+ isCloseOnSelect: {
168
165
  type: Boolean,
169
166
  default: false
170
167
  },
package/dist/content.mjs CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  MpPopoverContent
3
- } from "./chunk-OBEDLACV.mjs";
4
- import "./chunk-3VISLXE6.mjs";
5
- import "./chunk-EOUKE4WB.mjs";
3
+ } from "./chunk-WBFSONWB.mjs";
4
+ import "./chunk-ACYTEMPK.mjs";
5
+ import "./chunk-MPDM4USP.mjs";
6
6
  import "./chunk-2ZUCITXI.mjs";
7
7
  import "./chunk-QZ7VFGWC.mjs";
8
8
  export {
package/dist/index.d.mts CHANGED
@@ -9,4 +9,3 @@ import 'vue';
9
9
  import '@floating-ui/vue';
10
10
  import '@mekari/pixel3-utils';
11
11
  import 'vue/jsx-runtime';
12
- import '@floating-ui/dom';
package/dist/index.d.ts CHANGED
@@ -9,4 +9,3 @@ import 'vue';
9
9
  import '@floating-ui/vue';
10
10
  import '@mekari/pixel3-utils';
11
11
  import 'vue/jsx-runtime';
12
- import '@floating-ui/dom';