v-calendar-3 1.1.0 → 1.2.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.
package/README.md CHANGED
@@ -4,7 +4,7 @@ A maintained Vue 3 calendar and date picker with TypeScript declarations,
4
4
  timezone support, keyboard navigation, touch interaction, and responsive theme
5
5
  handling.
6
6
 
7
- Current version: `1.1.0`
7
+ Current version: `1.2.0`
8
8
 
9
9
  ## Features
10
10
 
@@ -17,6 +17,7 @@ Current version: `1.1.0`
17
17
  - Keyboard navigation, Escape handling, Pointer Events, and touch support
18
18
  - SSR-safe browser access and iframe-aware theme/popover handling
19
19
  - ESM, Node ESM, CommonJS, IIFE, CSS, and TypeScript declaration builds
20
+ - Vue component metadata for PhpStorm and other JetBrains IDEs
20
21
 
21
22
  ## Requirements
22
23
 
@@ -75,6 +76,10 @@ const selectedDate = ref<Date | null>(new Date());
75
76
  ```
76
77
 
77
78
  The component prefix defaults to `V` and can be changed during plugin setup.
79
+ The package publishes global component types for the default `VCalendar`,
80
+ `VDatePicker`, `VPopover`, and `VPopoverRow` names. Custom prefixes are runtime
81
+ configuration and must be declared in the consuming application's
82
+ `GlobalComponents` interface if template autocomplete is required.
78
83
 
79
84
  ```ts
80
85
  app.use(VCalendar, {
@@ -127,6 +132,13 @@ app.use(setupCalendar, {
127
132
  });
128
133
  ```
129
134
 
135
+ The package ships both Vue TypeScript declarations and JetBrains Web Types.
136
+ PhpStorm can therefore complete component props and navigate from imported
137
+ `Calendar` and `DatePicker` tags to their declarations without application-side
138
+ shims. After changing between local `file:` package versions, let the package
139
+ manager refresh the link and ask PhpStorm to reload the project indexes if it
140
+ still shows cached generic Vue metadata.
141
+
130
142
  ## Date picker modes
131
143
 
132
144
  The default model is a JavaScript `Date`. Use the `range` modifier for date
@@ -175,6 +187,19 @@ visibility.
175
187
  For a range picker, `inputValue` and `inputEvents` contain separate `start` and
176
188
  `end` properties.
177
189
 
190
+ If an ancestor clips overflow, teleport the popover to the trigger's document
191
+ body. This also works when the date picker is mounted inside an iframe.
192
+
193
+ ```vue
194
+ <VDatePicker
195
+ v-model="date"
196
+ :popover="{
197
+ visibility: 'hover-focus',
198
+ teleport: true,
199
+ }"
200
+ />
201
+ ```
202
+
178
203
  ## Bounds and disabled dates
179
204
 
180
205
  `min-date`, `max-date`, `disabled-dates`, and attribute dates accept native
package/dist/cjs/index.js CHANGED
@@ -7929,8 +7929,7 @@ function useSlot(slotKey) {
7929
7929
  }
7930
7930
  //#endregion
7931
7931
  //#region src/use/calendar.ts
7932
- var propsDef$1 = {
7933
- ...propsDef$2,
7932
+ var calendarPropsDef = {
7934
7933
  view: {
7935
7934
  type: String,
7936
7935
  default: "monthly",
@@ -7976,6 +7975,10 @@ var propsDef$1 = {
7976
7975
  trimWeeks: Boolean,
7977
7976
  disablePageSwipe: Boolean
7978
7977
  };
7978
+ var propsDef$1 = {
7979
+ ...propsDef$2,
7980
+ ...calendarPropsDef
7981
+ };
7979
7982
  var emitsDef = [
7980
7983
  "dayclick",
7981
7984
  "daymouseenter",
@@ -8477,7 +8480,12 @@ var Popover_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
8477
8480
  isHovered: false,
8478
8481
  isFocused: false,
8479
8482
  autoHide: false,
8480
- force: false
8483
+ force: false,
8484
+ teleport: false
8485
+ });
8486
+ const teleportTarget = (0, vue.computed)(() => {
8487
+ if (!state.teleport) return null;
8488
+ return resolveEl(state.target)?.ownerDocument?.body ?? null;
8481
8489
  });
8482
8490
  function updateDirection(placement) {
8483
8491
  if (placement) state.direction = placement.split("-")[0];
@@ -8697,6 +8705,7 @@ var Popover_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
8697
8705
  return {
8698
8706
  ...(0, vue.toRefs)(state),
8699
8707
  popoverRef,
8708
+ teleportTarget,
8700
8709
  alignment,
8701
8710
  hide,
8702
8711
  setupPopper,
@@ -8722,7 +8731,10 @@ var _plugin_vue_export_helper_default = (sfc, props) => {
8722
8731
  //#endregion
8723
8732
  //#region src/components/Popover/Popover.vue
8724
8733
  function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
8725
- return (0, vue.openBlock)(), (0, vue.createElementBlock)("div", {
8734
+ return (0, vue.openBlock)(), (0, vue.createBlock)(vue.Teleport, {
8735
+ to: _ctx.teleportTarget,
8736
+ disabled: _ctx.teleportTarget == null
8737
+ }, [(0, vue.createElementVNode)("div", {
8726
8738
  class: (0, vue.normalizeClass)(["vc-popover-content-wrapper", { "is-interactive": _ctx.isInteractive }]),
8727
8739
  ref: "popoverRef",
8728
8740
  onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
@@ -8759,7 +8771,7 @@ function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
8759
8771
  "onAfterEnter",
8760
8772
  "onBeforeLeave",
8761
8773
  "onAfterLeave"
8762
- ])], 34);
8774
+ ])], 34)], 8, ["to", "disabled"]);
8763
8775
  }
8764
8776
  var Popover_default = /*#__PURE__*/ _plugin_vue_export_helper_default(Popover_vue_vue_type_script_lang_default, [["render", _sfc_render$7]]);
8765
8777
  //#endregion
@@ -9700,6 +9712,7 @@ var Calendar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(Calendar_
9700
9712
  var contextKey = Symbol("__vc_date_picker_context__");
9701
9713
  var propsDef = {
9702
9714
  ...propsDef$2,
9715
+ ...calendarPropsDef,
9703
9716
  mode: {
9704
9717
  type: String,
9705
9718
  default: "date"
@@ -10681,6 +10694,7 @@ var DatePickerPopover_default = /* @__PURE__ */ (0, vue.defineComponent)({
10681
10694
  });
10682
10695
  //#endregion
10683
10696
  //#region src/components/DatePicker/DatePicker.vue?vue&type=script&lang.ts
10697
+ var forwardedCalendarPropNames = Object.keys(calendarPropsDef).filter((name) => name !== "attributes");
10684
10698
  var DatePicker_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
10685
10699
  inheritAttrs: false,
10686
10700
  emits,
@@ -10692,8 +10706,10 @@ var DatePicker_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
10692
10706
  setup(props, ctx) {
10693
10707
  const datePicker = createDatePicker(props, ctx);
10694
10708
  const slotCtx = (0, vue.reactive)(omit(datePicker, "calendarRef", "popoverRef"));
10709
+ const forwardedCalendarProps = (0, vue.computed)(() => Object.fromEntries(forwardedCalendarPropNames.map((name) => [name, props[name]])));
10695
10710
  return {
10696
10711
  ...datePicker,
10712
+ forwardedCalendarProps,
10697
10713
  slotCtx
10698
10714
  };
10699
10715
  }
@@ -10703,7 +10719,13 @@ var DatePicker_vue_vue_type_script_lang_default = (0, vue.defineComponent)({
10703
10719
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
10704
10720
  const _component_DatePickerPopover = (0, vue.resolveComponent)("DatePickerPopover");
10705
10721
  const _component_DatePickerBase = (0, vue.resolveComponent)("DatePickerBase");
10706
- return _ctx.$slots.default ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [(0, vue.renderSlot)(_ctx.$slots, "default", (0, vue.normalizeProps)((0, vue.guardReactiveProps)(_ctx.slotCtx))), (0, vue.createVNode)(_component_DatePickerPopover, (0, vue.normalizeProps)((0, vue.guardReactiveProps)(_ctx.$attrs)), null, 16)], 64)) : ((0, vue.openBlock)(), (0, vue.createBlock)(_component_DatePickerBase, (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, _ctx.$attrs)), null, 16));
10722
+ return _ctx.$slots.default ? ((0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, { key: 0 }, [(0, vue.renderSlot)(_ctx.$slots, "default", (0, vue.normalizeProps)((0, vue.guardReactiveProps)(_ctx.slotCtx))), (0, vue.createVNode)(_component_DatePickerPopover, (0, vue.normalizeProps)((0, vue.guardReactiveProps)({
10723
+ ..._ctx.forwardedCalendarProps,
10724
+ ..._ctx.$attrs
10725
+ })), null, 16)], 64)) : ((0, vue.openBlock)(), (0, vue.createBlock)(_component_DatePickerBase, (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 1 }, {
10726
+ ..._ctx.forwardedCalendarProps,
10727
+ ..._ctx.$attrs
10728
+ })), null, 16));
10707
10729
  }
10708
10730
  var DatePicker_default = /*#__PURE__*/ _plugin_vue_export_helper_default(DatePicker_vue_vue_type_script_lang_default, [["render", _sfc_render]]);
10709
10731
  //#endregion