@xy-planning-network/trees 0.4.1 → 0.4.2

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/dist/trees.es.js CHANGED
@@ -17,7 +17,7 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- import { cloneVNode, h, inject, provide, watchEffect, defineComponent, ref, onUnmounted, Teleport, reactive, onUpdated, computed, onMounted, nextTick, watch, openBlock, createBlock, createVNode, unref, withCtx, Transition, createElementVNode, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, renderSlot, resolveDynamicComponent, normalizeProps, mergeProps, createTextVNode, useAttrs, withModifiers, TransitionGroup, withDirectives, vShow, getCurrentInstance, vModelText, resolveComponent, vModelCheckbox } from "vue";
20
+ import { cloneVNode, h, inject, provide, watchEffect, defineComponent, ref, onUnmounted, Teleport, reactive, onUpdated, computed, onMounted, nextTick, watch, openBlock, createBlock, createVNode, unref, withCtx, Transition, createElementVNode, createElementBlock, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, renderSlot, resolveDynamicComponent, normalizeProps, mergeProps, createTextVNode, useAttrs, withModifiers, TransitionGroup, withDirectives, vShow, normalizeStyle, getCurrentInstance, vModelText, resolveComponent, vModelCheckbox } from "vue";
21
21
  var axios$2 = { exports: {} };
22
22
  var bind$2 = function bind(fn, thisArg) {
23
23
  return function wrap() {
@@ -4170,9 +4170,9 @@ function render$5(_ctx, _cache) {
4170
4170
  })
4171
4171
  ]);
4172
4172
  }
4173
- const _hoisted_1$r = /* @__PURE__ */ createElementVNode("span", { class: "sr-only" }, "Open options", -1);
4173
+ const _hoisted_1$q = /* @__PURE__ */ createElementVNode("span", { class: "sr-only" }, "Open options", -1);
4174
4174
  const _hoisted_2$k = { class: "py-1" };
4175
- const _hoisted_3$g = ["textContent", "onClick"];
4175
+ const _hoisted_3$h = ["textContent", "onClick"];
4176
4176
  const _sfc_main$u = /* @__PURE__ */ defineComponent({
4177
4177
  props: {
4178
4178
  currentUser: null,
@@ -4214,7 +4214,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
4214
4214
  disabled: !hasActionItems.value
4215
4215
  }, {
4216
4216
  default: withCtx(() => [
4217
- _hoisted_1$r,
4217
+ _hoisted_1$q,
4218
4218
  createVNode(unref(render$6), {
4219
4219
  class: "w-5 h-5",
4220
4220
  "aria-hidden": "true"
@@ -4249,7 +4249,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
4249
4249
  ]),
4250
4250
  textContent: toDisplayString(item.label),
4251
4251
  onClick: ($event) => emitEvent(item.event)
4252
- }, null, 10, _hoisted_3$g)
4252
+ }, null, 10, _hoisted_3$h)
4253
4253
  ]),
4254
4254
  _: 2
4255
4255
  }, 1024)) : createCommentVNode("", true)
@@ -4268,9 +4268,9 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
4268
4268
  };
4269
4269
  }
4270
4270
  });
4271
- const _hoisted_1$q = { class: "px-4 py-5 sm:p-6 text-center" };
4271
+ const _hoisted_1$p = { class: "px-4 py-5 sm:p-6 text-center" };
4272
4272
  const _hoisted_2$j = ["textContent"];
4273
- const _hoisted_3$f = ["textContent"];
4273
+ const _hoisted_3$g = ["textContent"];
4274
4274
  const _sfc_main$t = /* @__PURE__ */ defineComponent({
4275
4275
  props: {
4276
4276
  cards: null
@@ -4285,7 +4285,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
4285
4285
  class: "bg-white overflow-hidden shadow rounded-lg",
4286
4286
  key: idx
4287
4287
  }, [
4288
- createElementVNode("div", _hoisted_1$q, [
4288
+ createElementVNode("div", _hoisted_1$p, [
4289
4289
  createElementVNode("dl", null, [
4290
4290
  createElementVNode("dd", {
4291
4291
  class: "mt-1 text-3xl leading-9 font-semibold text-xy-blue",
@@ -4294,7 +4294,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
4294
4294
  createElementVNode("dt", {
4295
4295
  class: "text-sm leading-5 font-medium text-gray-700 truncate",
4296
4296
  textContent: toDisplayString(card.secondary)
4297
- }, null, 8, _hoisted_3$f)
4297
+ }, null, 8, _hoisted_3$g)
4298
4298
  ])
4299
4299
  ])
4300
4300
  ]);
@@ -4303,12 +4303,12 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
4303
4303
  };
4304
4304
  }
4305
4305
  });
4306
- const _hoisted_1$p = { class: "flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0" };
4306
+ const _hoisted_1$o = { class: "flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0" };
4307
4307
  const _hoisted_2$i = /* @__PURE__ */ createElementVNode("span", {
4308
4308
  class: "hidden sm:inline-block sm:align-middle sm:h-screen",
4309
4309
  "aria-hidden": "true"
4310
4310
  }, "\u200B", -1);
4311
- const _hoisted_3$e = { class: "inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6" };
4311
+ const _hoisted_3$f = { class: "inline-block align-bottom bg-white rounded-lg px-4 pt-5 pb-4 text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-sm sm:w-full sm:p-6" };
4312
4312
  const _hoisted_4$b = { class: "mt-3 text-center sm:mt-5" };
4313
4313
  const _hoisted_5$9 = { class: "mt-2" };
4314
4314
  const _hoisted_6$9 = { class: "mt-5 sm:mt-6" };
@@ -4336,7 +4336,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
4336
4336
  open: __props.modelValue
4337
4337
  }, {
4338
4338
  default: withCtx(() => [
4339
- createElementVNode("div", _hoisted_1$p, [
4339
+ createElementVNode("div", _hoisted_1$o, [
4340
4340
  createVNode(unref(TransitionChild), {
4341
4341
  as: "template",
4342
4342
  enter: "ease-out duration-300",
@@ -4362,7 +4362,7 @@ const _sfc_main$s = /* @__PURE__ */ defineComponent({
4362
4362
  "leave-to": "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
4363
4363
  }, {
4364
4364
  default: withCtx(() => [
4365
- createElementVNode("div", _hoisted_3$e, [
4365
+ createElementVNode("div", _hoisted_3$f, [
4366
4366
  createElementVNode("div", null, [
4367
4367
  renderSlot(_ctx.$slots, "icon"),
4368
4368
  createElementVNode("div", _hoisted_4$b, [
@@ -6525,7 +6525,7 @@ const _sfc_main$q = /* @__PURE__ */ defineComponent({
6525
6525
  };
6526
6526
  }
6527
6527
  });
6528
- const _hoisted_1$o = ["aria-labelledby", "aria-describedby", "id", "placeholder", "type", "value"];
6528
+ const _hoisted_1$n = ["aria-labelledby", "aria-describedby", "id", "placeholder", "type", "value"];
6529
6529
  const _sfc_main$p = /* @__PURE__ */ defineComponent({
6530
6530
  props: {
6531
6531
  type: null,
@@ -6583,7 +6583,7 @@ const _sfc_main$p = /* @__PURE__ */ defineComponent({
6583
6583
  type: __props.type,
6584
6584
  value: __props.modelValue,
6585
6585
  onInput: _cache[0] || (_cache[0] = ($event) => emit("update:modelValue", $event.target.value))
6586
- }, _ctx.$attrs), null, 16, _hoisted_1$o),
6586
+ }, _ctx.$attrs), null, 16, _hoisted_1$n),
6587
6587
  createVNode(_sfc_main$q, {
6588
6588
  id: `${unref(uuid)}-help`,
6589
6589
  text: __props.help
@@ -6639,14 +6639,14 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
6639
6639
  };
6640
6640
  }
6641
6641
  });
6642
- const _hoisted_1$n = ["aria-labelledby", "aria-describedby", "id", "value"];
6642
+ const _hoisted_1$m = ["aria-labelledby", "aria-describedby", "id", "value"];
6643
6643
  const _hoisted_2$h = {
6644
6644
  key: 0,
6645
6645
  value: "",
6646
6646
  disabled: "",
6647
6647
  selected: ""
6648
6648
  };
6649
- const _hoisted_3$d = ["value", "textContent"];
6649
+ const _hoisted_3$e = ["value", "textContent"];
6650
6650
  const _sfc_main$n = /* @__PURE__ */ defineComponent({
6651
6651
  props: {
6652
6652
  design: { default: "standard" },
@@ -6691,9 +6691,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6691
6691
  value: option.value,
6692
6692
  textContent: toDisplayString(option.label),
6693
6693
  key: option.value
6694
- }, null, 8, _hoisted_3$d);
6694
+ }, null, 8, _hoisted_3$e);
6695
6695
  }), 128))
6696
- ], 16, _hoisted_1$n),
6696
+ ], 16, _hoisted_1$m),
6697
6697
  createVNode(_sfc_main$q, {
6698
6698
  id: `${unref(uuid)}-help`,
6699
6699
  text: __props.help
@@ -6702,9 +6702,9 @@ const _sfc_main$n = /* @__PURE__ */ defineComponent({
6702
6702
  };
6703
6703
  }
6704
6704
  });
6705
- const _hoisted_1$m = { class: "md:flex md:items-center md:justify-between bg-white mx-auto py-4 border-t border-gray-100" };
6705
+ const _hoisted_1$l = { class: "md:flex md:items-center md:justify-between bg-white mx-auto py-4 border-t border-gray-100" };
6706
6706
  const _hoisted_2$g = { class: "flex-1 min-w-0" };
6707
- const _hoisted_3$c = { class: "text-lg leading-6 font-semibold text-gray-900" };
6707
+ const _hoisted_3$d = { class: "text-lg leading-6 font-semibold text-gray-900" };
6708
6708
  const _hoisted_4$a = { class: "mt-4 flex md:mt-0 md:ml-4" };
6709
6709
  const _sfc_main$m = /* @__PURE__ */ defineComponent({
6710
6710
  props: {
@@ -6728,9 +6728,9 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6728
6728
  emits("date-range-changed", dateRange2);
6729
6729
  };
6730
6730
  return (_ctx, _cache) => {
6731
- return openBlock(), createElementBlock("div", _hoisted_1$m, [
6731
+ return openBlock(), createElementBlock("div", _hoisted_1$l, [
6732
6732
  createElementVNode("div", _hoisted_2$g, [
6733
- createElementVNode("h1", _hoisted_3$c, toDisplayString(__props.title), 1)
6733
+ createElementVNode("h1", _hoisted_3$d, toDisplayString(__props.title), 1)
6734
6734
  ]),
6735
6735
  createElementVNode("div", _hoisted_4$a, [
6736
6736
  createVNode(_sfc_main$n, {
@@ -6754,9 +6754,9 @@ const _sfc_main$m = /* @__PURE__ */ defineComponent({
6754
6754
  };
6755
6755
  }
6756
6756
  });
6757
- const _hoisted_1$l = { class: "px-4 flex items-center justify-between sm:px-0" };
6757
+ const _hoisted_1$k = { class: "px-4 flex items-center justify-between sm:px-0" };
6758
6758
  const _hoisted_2$f = { class: "w-0 flex-1 flex" };
6759
- const _hoisted_3$b = /* @__PURE__ */ createElementVNode("svg", {
6759
+ const _hoisted_3$c = /* @__PURE__ */ createElementVNode("svg", {
6760
6760
  class: "mr-3 h-5 w-5",
6761
6761
  fill: "currentColor",
6762
6762
  viewBox: "0 0 20 20"
@@ -6769,7 +6769,7 @@ const _hoisted_3$b = /* @__PURE__ */ createElementVNode("svg", {
6769
6769
  ], -1);
6770
6770
  const _hoisted_4$9 = /* @__PURE__ */ createTextVNode(" Previous ");
6771
6771
  const _hoisted_5$8 = [
6772
- _hoisted_3$b,
6772
+ _hoisted_3$c,
6773
6773
  _hoisted_4$9
6774
6774
  ];
6775
6775
  const _hoisted_6$8 = { class: "hidden md:flex" };
@@ -6798,44 +6798,41 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
6798
6798
  emits: ["update:modelValue"],
6799
6799
  setup(__props, { emit }) {
6800
6800
  const props = __props;
6801
- const pagination = ref(props.modelValue);
6802
- const updateModelValue2 = () => {
6803
- emit("update:modelValue", pagination.value);
6804
- };
6805
6801
  const changePage = (page) => {
6806
- pagination.value.page = page;
6807
- updateModelValue2();
6802
+ emit("update:modelValue", __spreadProps(__spreadValues({}, props.modelValue), {
6803
+ page
6804
+ }));
6808
6805
  };
6809
6806
  const pageShortcuts = computed(() => {
6810
6807
  const shortcuts = [];
6811
- if (pagination.value.totalPages <= 4) {
6812
- for (let i = 0; i < pagination.value.totalPages; i++) {
6808
+ if (props.modelValue.totalPages <= 4) {
6809
+ for (let i = 0; i < props.modelValue.totalPages; i++) {
6813
6810
  shortcuts.push(i + 1);
6814
6811
  }
6815
6812
  return shortcuts;
6816
6813
  }
6817
- const pagesLeft = pagination.value.totalPages - pagination.value.page;
6814
+ const pagesLeft = props.modelValue.totalPages - props.modelValue.page;
6818
6815
  if (pagesLeft >= 3) {
6819
6816
  for (let i = 0; i < 4; i++) {
6820
- shortcuts.push(pagination.value.page + i);
6817
+ shortcuts.push(props.modelValue.page + i);
6821
6818
  }
6822
6819
  return shortcuts;
6823
6820
  }
6824
6821
  for (let i = 0; i < 4; i++) {
6825
- shortcuts.unshift(pagination.value.totalPages - i);
6822
+ shortcuts.unshift(props.modelValue.totalPages - i);
6826
6823
  }
6827
6824
  return shortcuts;
6828
6825
  });
6829
6826
  return (_ctx, _cache) => {
6830
- return openBlock(), createElementBlock("div", _hoisted_1$l, [
6827
+ return openBlock(), createElementBlock("div", _hoisted_1$k, [
6831
6828
  createElementVNode("div", _hoisted_2$f, [
6832
6829
  createElementVNode("a", {
6833
6830
  href: "#",
6834
6831
  class: normalizeClass([
6835
6832
  "-mt-px border-t-2 border-transparent pt-4 pr-1 inline-flex items-center text-sm leading-5 font-medium focus:outline-none focus:text-gray-700 focus:border-gray-400",
6836
- pagination.value.page == 1 ? "text-gray-500 cursor-not-allowed pointer-events-none" : "text-gray-700 hover:text-gray-900 hover:border-gray-300"
6833
+ __props.modelValue.page == 1 ? "text-gray-500 cursor-not-allowed pointer-events-none" : "text-gray-700 hover:text-gray-900 hover:border-gray-300"
6837
6834
  ]),
6838
- onClick: _cache[0] || (_cache[0] = withModifiers(($event) => changePage(pagination.value.page - 1), ["prevent"]))
6835
+ onClick: _cache[0] || (_cache[0] = withModifiers(($event) => changePage(__props.modelValue.page - 1), ["prevent"]))
6839
6836
  }, _hoisted_5$8, 2)
6840
6837
  ]),
6841
6838
  createElementVNode("div", _hoisted_6$8, [
@@ -6844,7 +6841,7 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
6844
6841
  href: "#",
6845
6842
  class: normalizeClass([
6846
6843
  "-mt-px border-t-2 pt-4 px-4 inline-flex items-center text-sm leading-5 font-medium",
6847
- pagination.value.page === i ? "border-blue-500 text-blue-600 focus:outline-none focus:text-blue-800 focus:border-blue-700" : "border-transparent text-gray-700 hover:text-gray-900 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-400"
6844
+ __props.modelValue.page === i ? "border-blue-500 text-blue-600 focus:outline-none focus:text-blue-800 focus:border-blue-700" : "border-transparent text-gray-700 hover:text-gray-900 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-400"
6848
6845
  ]),
6849
6846
  key: i,
6850
6847
  textContent: toDisplayString(i),
@@ -6857,16 +6854,16 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
6857
6854
  href: "#",
6858
6855
  class: normalizeClass([
6859
6856
  "-mt-px border-t-2 border-transparent pt-4 pl-1 inline-flex items-center text-sm leading-5 font-medium focus:outline-none focus:text-gray-700 focus:border-gray-400",
6860
- pagination.value.page >= pagination.value.totalPages ? "text-gray-500 cursor-not-allowed pointer-events-none" : "text-gray-700 hover:text-gray-900 hover:border-gray-300"
6857
+ __props.modelValue.page >= __props.modelValue.totalPages ? "text-gray-500 cursor-not-allowed pointer-events-none" : "text-gray-700 hover:text-gray-900 hover:border-gray-300"
6861
6858
  ]),
6862
- onClick: _cache[1] || (_cache[1] = withModifiers(($event) => changePage(pagination.value.page + 1), ["prevent"]))
6859
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => changePage(__props.modelValue.page + 1), ["prevent"]))
6863
6860
  }, _hoisted_11$5, 2)
6864
6861
  ])
6865
6862
  ]);
6866
6863
  };
6867
6864
  }
6868
6865
  });
6869
- const _hoisted_1$k = {
6866
+ const _hoisted_1$j = {
6870
6867
  key: 0,
6871
6868
  class: "shadow overflow-hidden sm:rounded-md border"
6872
6869
  };
@@ -6932,7 +6929,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
6932
6929
  onSortDirChanged: _cache[0] || (_cache[0] = ($event) => sortDir.value = $event),
6933
6930
  onDateRangeChanged: _cache[1] || (_cache[1] = ($event) => dateRange.value = $event)
6934
6931
  }, null, 8, ["date-range", "sort-dir", "title"]),
6935
- hasContent.value ? (openBlock(), createElementBlock("div", _hoisted_1$k, [
6932
+ hasContent.value ? (openBlock(), createElementBlock("div", _hoisted_1$j, [
6936
6933
  createElementVNode("ul", null, [
6937
6934
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, idx) => {
6938
6935
  return openBlock(), createElementBlock("li", {
@@ -6956,7 +6953,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
6956
6953
  };
6957
6954
  }
6958
6955
  });
6959
- const _hoisted_1$j = ["href"];
6956
+ const _hoisted_1$i = ["href"];
6960
6957
  const _sfc_main$j = /* @__PURE__ */ defineComponent({
6961
6958
  props: {
6962
6959
  propsData: null,
@@ -6968,13 +6965,13 @@ const _sfc_main$j = /* @__PURE__ */ defineComponent({
6968
6965
  href: __props.propsData[__props.attribute]
6969
6966
  }, [
6970
6967
  createVNode(unref(render$5), { class: "h-6 w-6 group-hover:text-gray-500 transition" })
6971
- ], 8, _hoisted_1$j);
6968
+ ], 8, _hoisted_1$i);
6972
6969
  };
6973
6970
  }
6974
6971
  });
6975
- const _hoisted_1$i = { class: "fixed inset-0 flex flex-col items-end justify-end px-4 py-6 pointer-events-none sm:p-6 z-40" };
6972
+ const _hoisted_1$h = { class: "fixed inset-0 flex flex-col items-end justify-end px-4 py-6 pointer-events-none sm:p-6 z-40" };
6976
6973
  const _hoisted_2$e = { class: "rounded-lg ring-1 ring-black ring-opacity-5 overflow-hidden" };
6977
- const _hoisted_3$a = { class: "p-4" };
6974
+ const _hoisted_3$b = { class: "p-4" };
6978
6975
  const _hoisted_4$8 = { class: "flex items-center" };
6979
6976
  const _hoisted_5$7 = { class: "w-0 flex-1 flex justify-between" };
6980
6977
  const _hoisted_6$7 = ["innerHTML"];
@@ -7049,7 +7046,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7049
7046
  }
7050
7047
  });
7051
7048
  return (_ctx, _cache) => {
7052
- return openBlock(), createElementBlock("div", _hoisted_1$i, [
7049
+ return openBlock(), createElementBlock("div", _hoisted_1$h, [
7053
7050
  createVNode(TransitionGroup, {
7054
7051
  tag: "div",
7055
7052
  class: "max-w-sm w-full",
@@ -7067,7 +7064,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
7067
7064
  class: normalizeClass(["bg-white shadow-lg rounded-lg pointer-events-auto border-t-4 transform", [{ "mt-2": idx > 0 }, getFlashClass(flash)]])
7068
7065
  }, [
7069
7066
  createElementVNode("div", _hoisted_2$e, [
7070
- createElementVNode("div", _hoisted_3$a, [
7067
+ createElementVNode("div", _hoisted_3$b, [
7071
7068
  createElementVNode("div", _hoisted_4$8, [
7072
7069
  createElementVNode("div", _hoisted_5$7, [
7073
7070
  createElementVNode("p", {
@@ -7173,12 +7170,12 @@ function render(_ctx, _cache) {
7173
7170
  })
7174
7171
  ]);
7175
7172
  }
7176
- const _hoisted_1$h = { class: "flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0" };
7173
+ const _hoisted_1$g = { class: "flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0" };
7177
7174
  const _hoisted_2$d = /* @__PURE__ */ createElementVNode("span", {
7178
7175
  class: "hidden sm:inline-block sm:align-middle sm:h-screen",
7179
7176
  "aria-hidden": "true"
7180
7177
  }, "\u200B", -1);
7181
- const _hoisted_3$9 = { class: "inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl w-full" };
7178
+ const _hoisted_3$a = { class: "inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl w-full" };
7182
7179
  const _hoisted_4$7 = { class: "block absolute top-0 right-0 pt-4 pr-4" };
7183
7180
  const _hoisted_5$6 = /* @__PURE__ */ createElementVNode("span", { class: "sr-only" }, "Close", -1);
7184
7181
  const _hoisted_6$6 = { class: "bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4" };
@@ -7219,7 +7216,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7219
7216
  open: __props.modelValue
7220
7217
  }, {
7221
7218
  default: withCtx(() => [
7222
- createElementVNode("div", _hoisted_1$h, [
7219
+ createElementVNode("div", _hoisted_1$g, [
7223
7220
  createVNode(unref(TransitionChild), {
7224
7221
  as: "template",
7225
7222
  enter: "ease-out duration-300",
@@ -7245,7 +7242,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7245
7242
  "leave-to": "opacity-0 translate-y-4 sm:translate-y-0 sm:scale-95"
7246
7243
  }, {
7247
7244
  default: withCtx(() => [
7248
- createElementVNode("div", _hoisted_3$9, [
7245
+ createElementVNode("div", _hoisted_3$a, [
7249
7246
  createElementVNode("div", _hoisted_4$7, [
7250
7247
  createElementVNode("button", {
7251
7248
  type: "button",
@@ -7301,7 +7298,7 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
7301
7298
  };
7302
7299
  }
7303
7300
  });
7304
- const _hoisted_1$g = {
7301
+ const _hoisted_1$f = {
7305
7302
  key: 0,
7306
7303
  class: "fixed top-0 left-0 flex items-center justify-center w-full h-full cursor-not-allowed z-50 bg-gray-50 bg-opacity-50"
7307
7304
  };
@@ -7425,7 +7422,7 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7425
7422
  });
7426
7423
  });
7427
7424
  return (_ctx, _cache) => {
7428
- return loading.value ? (openBlock(), createElementBlock("div", _hoisted_1$g, [
7425
+ return loading.value ? (openBlock(), createElementBlock("div", _hoisted_1$f, [
7429
7426
  createElementVNode("div", null, [
7430
7427
  _hoisted_2$c,
7431
7428
  withDirectives(createElementVNode("div", null, [
@@ -7455,9 +7452,9 @@ const _sfc_main$g = /* @__PURE__ */ defineComponent({
7455
7452
  };
7456
7453
  }
7457
7454
  });
7458
- const _hoisted_1$f = { class: "h-screen flex overflow-hidden bg-gray-100" };
7455
+ const _hoisted_1$e = { class: "h-screen flex overflow-hidden bg-gray-100" };
7459
7456
  const _hoisted_2$b = { class: "relative flex-1 flex flex-col max-w-xs w-full pt-5 pb-4 bg-white" };
7460
- const _hoisted_3$8 = { class: "absolute top-0 right-0 -mr-12 pt-2" };
7457
+ const _hoisted_3$9 = { class: "absolute top-0 right-0 -mr-12 pt-2" };
7461
7458
  const _hoisted_4$6 = /* @__PURE__ */ createElementVNode("span", { class: "sr-only" }, "Close sidebar", -1);
7462
7459
  const _hoisted_5$5 = { class: "flex-shrink-0 flex justify-center px-4" };
7463
7460
  const _hoisted_6$5 = ["src"];
@@ -7502,7 +7499,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7502
7499
  };
7503
7500
  return (_ctx, _cache) => {
7504
7501
  return openBlock(), createElementBlock(Fragment, null, [
7505
- createElementVNode("div", _hoisted_1$f, [
7502
+ createElementVNode("div", _hoisted_1$e, [
7506
7503
  createVNode(unref(TransitionRoot), {
7507
7504
  as: "template",
7508
7505
  show: sidebarOpen.value
@@ -7551,7 +7548,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7551
7548
  "leave-to": "opacity-0"
7552
7549
  }, {
7553
7550
  default: withCtx(() => [
7554
- createElementVNode("div", _hoisted_3$8, [
7551
+ createElementVNode("div", _hoisted_3$9, [
7555
7552
  createElementVNode("button", {
7556
7553
  class: "ml-1 flex items-center justify-center h-10 w-10 rounded-full focus:outline-none focus:ring-2 focus:ring-inset focus:ring-white",
7557
7554
  onClick: _cache[0] || (_cache[0] = ($event) => sidebarOpen.value = false)
@@ -7733,45 +7730,83 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
7733
7730
  };
7734
7731
  }
7735
7732
  });
7736
- const _hoisted_1$e = { class: "flex" };
7733
+ function throttle(func, timeout = 100) {
7734
+ let inThrottle;
7735
+ return (...args) => {
7736
+ if (!inThrottle) {
7737
+ func.apply(args);
7738
+ inThrottle = true;
7739
+ setTimeout(() => inThrottle = false, timeout);
7740
+ }
7741
+ };
7742
+ }
7737
7743
  const _sfc_main$e = /* @__PURE__ */ defineComponent({
7738
7744
  props: {
7739
- position: { default: "top-center" }
7745
+ as: { default: "div" },
7746
+ position: { default: "auto" }
7740
7747
  },
7741
7748
  setup(__props) {
7742
7749
  const props = __props;
7743
- const positionClasses = computed(() => {
7750
+ const getViewportDimensions = () => {
7751
+ return {
7752
+ vw: document.documentElement.clientWidth,
7753
+ vh: document.documentElement.clientHeight
7754
+ };
7755
+ };
7756
+ const trigger = ref();
7757
+ const wrapper = ref();
7758
+ const viewport = ref(getViewportDimensions());
7759
+ const classes = computed(() => {
7760
+ const classes2 = {
7761
+ wrapper: "",
7762
+ content: ""
7763
+ };
7764
+ if (props.position === "none") {
7765
+ return classes2;
7766
+ }
7767
+ classes2.wrapper = "h-0 flex w-screen";
7768
+ classes2.content = "absolute";
7769
+ if (props.position !== "auto") {
7770
+ classes2.wrapper += ` ${staticPosition.value.wrapper}`;
7771
+ classes2.content += ` ${staticPosition.value.content}`;
7772
+ }
7773
+ return classes2;
7774
+ });
7775
+ const staticPosition = computed(() => {
7744
7776
  let wrapperClasses = "";
7745
7777
  let contentClasses = "";
7746
7778
  switch (props.position) {
7747
7779
  case "top-left":
7748
- wrapperClasses = "top-0 left-0 -translate-y-full -translate-x-full justify-end";
7780
+ wrapperClasses = "top-0 right-0 -translate-y-full justify-end";
7781
+ contentClasses = "bottom-full";
7749
7782
  break;
7750
7783
  case "top-center":
7751
7784
  wrapperClasses = "top-0 -translate-y-full -translate-x-full left-1/2 justify-end";
7752
- contentClasses = "translate-x-1/2";
7785
+ contentClasses = "bottom-full translate-x-1/2";
7753
7786
  break;
7754
7787
  case "top-right":
7755
- wrapperClasses = "top-0 -translate-y-full right-0 justify-end";
7756
- contentClasses = "translate-x-full";
7788
+ wrapperClasses = "top-0 -translate-y-full left-0 -translate-x-full justify-end";
7789
+ contentClasses = "bottom-full translate-x-full";
7757
7790
  break;
7758
7791
  case "bottom-left":
7759
- wrapperClasses = "top-full left-0 -translate-x-full justify-end";
7792
+ wrapperClasses = "top-full right-0 justify-end";
7793
+ contentClasses = "top-full";
7760
7794
  break;
7761
7795
  case "bottom-center":
7762
7796
  wrapperClasses = "top-full -translate-x-full left-1/2 justify-end";
7763
- contentClasses = "translate-x-1/2";
7797
+ contentClasses = "top-full translate-x-1/2";
7764
7798
  break;
7765
7799
  case "bottom-right":
7766
- wrapperClasses = "top-full right-0 justify-end";
7767
- contentClasses = "translate-x-full";
7800
+ wrapperClasses = "top-full left-0 -translate-x-full justify-end";
7801
+ contentClasses = "top-full translate-x-full";
7768
7802
  break;
7769
7803
  case "left":
7770
7804
  wrapperClasses = "top-1/2 left-0 -translate-y-1/2 -translate-x-full justify-end";
7805
+ contentClasses = "-translate-y-1/2";
7771
7806
  break;
7772
7807
  case "right":
7773
7808
  wrapperClasses = "top-1/2 -translate-y-1/2 right-0 justify-end";
7774
- contentClasses = "translate-x-full";
7809
+ contentClasses = "translate-x-full -translate-y-1/2";
7775
7810
  break;
7776
7811
  }
7777
7812
  return {
@@ -7779,52 +7814,118 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
7779
7814
  content: contentClasses
7780
7815
  };
7781
7816
  });
7817
+ const autoPosition = computed(() => {
7818
+ var _a, _b;
7819
+ if (!((_a = wrapper == null ? void 0 : wrapper.value) == null ? void 0 : _a.el) || !((_b = trigger == null ? void 0 : trigger.value) == null ? void 0 : _b.el)) {
7820
+ return {};
7821
+ }
7822
+ const { vw, vh } = viewport.value;
7823
+ const offset = 10;
7824
+ const anchorRect = trigger.value.el.getBoundingClientRect();
7825
+ const contentRect = wrapper.value.el.firstChild.getBoundingClientRect();
7826
+ const distToBottom = vh - anchorRect.bottom;
7827
+ const positionAbove = anchorRect.top > distToBottom;
7828
+ const distToRight = vw - anchorRect.left;
7829
+ const flowLeft = anchorRect.left > distToRight;
7830
+ let xPos = 0;
7831
+ if (flowLeft) {
7832
+ if (contentRect.width > anchorRect.right) {
7833
+ xPos = anchorRect.right - contentRect.width + (contentRect.width - anchorRect.right);
7834
+ } else {
7835
+ xPos = anchorRect.right - contentRect.width;
7836
+ }
7837
+ if (vw > contentRect.width + offset) {
7838
+ xPos = xPos + offset;
7839
+ }
7840
+ } else {
7841
+ if (contentRect.width > distToRight) {
7842
+ xPos = anchorRect.left - (contentRect.width - distToRight);
7843
+ } else {
7844
+ xPos = anchorRect.left;
7845
+ }
7846
+ if (vw > contentRect.width + offset) {
7847
+ xPos = xPos - offset;
7848
+ }
7849
+ }
7850
+ return {
7851
+ wrapper: {
7852
+ top: positionAbove ? "auto" : `100%`,
7853
+ bottom: positionAbove ? "100%" : `auto`,
7854
+ transform: `translate(${anchorRect.left * -1}px, 0)`,
7855
+ width: `${vw}px`
7856
+ },
7857
+ content: {
7858
+ top: positionAbove ? "auto" : `100%`,
7859
+ bottom: positionAbove ? "100%" : `auto`,
7860
+ transform: `translate(${xPos}px, 0)`
7861
+ }
7862
+ };
7863
+ });
7864
+ if (props.position === "auto") {
7865
+ const throttledSetPositions = throttle(() => {
7866
+ viewport.value = getViewportDimensions();
7867
+ });
7868
+ onMounted(() => {
7869
+ window.addEventListener("resize", throttledSetPositions);
7870
+ window.addEventListener("scroll", throttledSetPositions);
7871
+ });
7872
+ onUnmounted(() => {
7873
+ window.removeEventListener("resize", throttledSetPositions);
7874
+ window.removeEventListener("scroll", throttledSetPositions);
7875
+ });
7876
+ }
7782
7877
  return (_ctx, _cache) => {
7783
- return openBlock(), createElementBlock("div", _hoisted_1$e, [
7784
- createVNode(unref(Popover), { class: "relative leading-none" }, {
7785
- default: withCtx(({ open, close: close2 }) => [
7786
- createVNode(unref(PopoverButton), null, {
7787
- default: withCtx(() => [
7788
- renderSlot(_ctx.$slots, "button", {
7789
- open,
7790
- close: close2
7791
- })
7792
- ]),
7793
- _: 2
7794
- }, 1024),
7795
- createVNode(Transition, {
7796
- "enter-active-class": "transition-opacity transition-faster ease-out-quad",
7797
- "leave-active-class": "transition-opacity transition-faster ease-in-quad",
7798
- "enter-from-class": "opacity-0",
7799
- "enter-to-class": "opacity-100",
7800
- "leave-from-class": "opacity-100",
7801
- "leave-to-class": "opacity-0"
7802
- }, {
7803
- default: withCtx(() => [
7804
- createVNode(unref(PopoverPanel), null, {
7805
- default: withCtx(() => [
7806
- createElementVNode("div", {
7807
- class: normalizeClass(["absolute z-10 transform w-screen flex", unref(positionClasses).wrapper])
7808
- }, [
7809
- createElementVNode("div", {
7810
- class: normalizeClass(unref(positionClasses).content)
7811
- }, [
7812
- renderSlot(_ctx.$slots, "default", {
7813
- open,
7814
- close: close2
7815
- })
7816
- ], 2)
7817
- ], 2)
7818
- ]),
7819
- _: 2
7820
- }, 1024)
7821
- ]),
7822
- _: 2
7823
- }, 1024)
7824
- ]),
7825
- _: 3
7826
- })
7827
- ]);
7878
+ return openBlock(), createBlock(unref(Popover), {
7879
+ class: "relative",
7880
+ as: __props.as
7881
+ }, {
7882
+ default: withCtx(({ open, close: close2 }) => [
7883
+ createVNode(unref(PopoverButton), {
7884
+ ref_key: "trigger",
7885
+ ref: trigger
7886
+ }, {
7887
+ default: withCtx(() => [
7888
+ renderSlot(_ctx.$slots, "button", {
7889
+ open,
7890
+ close: close2
7891
+ })
7892
+ ]),
7893
+ _: 2
7894
+ }, 1536),
7895
+ createVNode(Transition, {
7896
+ "enter-active-class": "transition-opacity transition-faster ease-out-quad",
7897
+ "leave-active-class": "transition-opacity transition-fastest ease-in-quad",
7898
+ "enter-from-class": "opacity-0",
7899
+ "enter-to-class": "opacity-100",
7900
+ "leave-from-class": "opacity-100",
7901
+ "leave-to-class": "opacity-0"
7902
+ }, {
7903
+ default: withCtx(() => [
7904
+ createVNode(unref(PopoverPanel), {
7905
+ ref_key: "wrapper",
7906
+ ref: wrapper,
7907
+ class: normalizeClass(["absolute z-10", unref(classes).wrapper]),
7908
+ style: normalizeStyle(__props.position === "auto" ? unref(autoPosition).wrapper : {})
7909
+ }, {
7910
+ default: withCtx(() => [
7911
+ createElementVNode("div", {
7912
+ class: normalizeClass(unref(classes).content),
7913
+ style: normalizeStyle(__props.position === "auto" ? unref(autoPosition).content : {})
7914
+ }, [
7915
+ renderSlot(_ctx.$slots, "default", {
7916
+ open,
7917
+ close: close2
7918
+ })
7919
+ ], 6)
7920
+ ]),
7921
+ _: 2
7922
+ }, 1032, ["class", "style"])
7923
+ ]),
7924
+ _: 2
7925
+ }, 1024)
7926
+ ]),
7927
+ _: 3
7928
+ }, 8, ["as"]);
7828
7929
  };
7829
7930
  }
7830
7931
  });
@@ -7836,7 +7937,7 @@ var _export_sfc = (sfc, props) => {
7836
7937
  return target;
7837
7938
  };
7838
7939
  const _sfc_main$d = {};
7839
- const _hoisted_1$d = { class: "max-w-xs bg-white rounded-md p-2 border border-gray-100 shadow-md" };
7940
+ const _hoisted_1$d = { class: "w-full max-w-xs bg-white rounded-md p-2 border border-gray-100 shadow-md" };
7840
7941
  function _sfc_render(_ctx, _cache) {
7841
7942
  return openBlock(), createElementBlock("div", _hoisted_1$d, [
7842
7943
  renderSlot(_ctx.$slots, "default")
@@ -7845,7 +7946,7 @@ function _sfc_render(_ctx, _cache) {
7845
7946
  var PopoverContent = /* @__PURE__ */ _export_sfc(_sfc_main$d, [["render", _sfc_render]]);
7846
7947
  const _hoisted_1$c = { class: "absolute inset-0 overflow-hidden" };
7847
7948
  const _hoisted_2$a = { class: "fixed inset-y-0 right-0 pl-10 max-w-full flex" };
7848
- const _hoisted_3$7 = { class: "w-screen max-w-md" };
7949
+ const _hoisted_3$8 = { class: "w-screen max-w-md" };
7849
7950
  const _hoisted_4$5 = { class: "h-full flex flex-col bg-white shadow-xl overflow-y-scroll" };
7850
7951
  const _hoisted_5$4 = { class: "py-6 px-4 bg-blue-700 sm:px-6" };
7851
7952
  const _hoisted_6$4 = { class: "flex items-center justify-between" };
@@ -7896,7 +7997,7 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
7896
7997
  "leave-to": "translate-x-full"
7897
7998
  }, {
7898
7999
  default: withCtx(() => [
7899
- createElementVNode("div", _hoisted_3$7, [
8000
+ createElementVNode("div", _hoisted_3$8, [
7900
8001
  createElementVNode("div", _hoisted_4$5, [
7901
8002
  createElementVNode("div", _hoisted_5$4, [
7902
8003
  createElementVNode("div", _hoisted_6$4, [
@@ -7945,31 +8046,33 @@ const _sfc_main$c = /* @__PURE__ */ defineComponent({
7945
8046
  };
7946
8047
  }
7947
8048
  });
7948
- const _hoisted_1$b = { class: "relative" };
7949
- const _hoisted_2$9 = /* @__PURE__ */ createElementVNode("div", { class: "p-4 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2" }, null, -1);
8049
+ const _hoisted_1$b = { class: "leading-none w-4 h-4" };
8050
+ const _hoisted_2$9 = /* @__PURE__ */ createElementVNode("div", { class: "p-5 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2" }, null, -1);
8051
+ const _hoisted_3$7 = { class: "w-full max-w-xs bg-white rounded-md px-3 py-2 border border-gray-100 drop-shadow-md text-xs text-gray-900 leading-snug font-medium" };
7950
8052
  const _sfc_main$b = /* @__PURE__ */ defineComponent({
7951
8053
  props: {
7952
- position: { default: "top-center" }
8054
+ as: { default: "span" },
8055
+ position: { default: "auto" }
7953
8056
  },
7954
8057
  setup(__props) {
7955
8058
  return (_ctx, _cache) => {
7956
- return openBlock(), createBlock(_sfc_main$e, { position: __props.position }, {
8059
+ return openBlock(), createBlock(_sfc_main$e, {
8060
+ position: __props.position,
8061
+ as: __props.as
8062
+ }, {
7957
8063
  button: withCtx(() => [
7958
8064
  createElementVNode("div", _hoisted_1$b, [
7959
- _hoisted_2$9,
7960
- createVNode(unref(render$4), { class: "w-4 h-4" })
8065
+ createVNode(unref(render$4)),
8066
+ _hoisted_2$9
7961
8067
  ])
7962
8068
  ]),
7963
8069
  default: withCtx(() => [
7964
- createVNode(PopoverContent, { class: "text-xs leading-tight font-medium" }, {
7965
- default: withCtx(() => [
7966
- renderSlot(_ctx.$slots, "default")
7967
- ]),
7968
- _: 3
7969
- })
8070
+ createElementVNode("div", _hoisted_3$7, [
8071
+ renderSlot(_ctx.$slots, "default")
8072
+ ])
7970
8073
  ]),
7971
8074
  _: 3
7972
- }, 8, ["position"]);
8075
+ }, 8, ["position", "as"]);
7973
8076
  };
7974
8077
  }
7975
8078
  });