reka-ui 1.0.0-alpha.6 → 1.0.0-alpha.7

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 (41) hide show
  1. package/dist/Accordion/AccordionContent.cjs +1 -1
  2. package/dist/Accordion/AccordionContent.js +1 -1
  3. package/dist/Calendar/CalendarRoot.cjs +2 -1
  4. package/dist/Calendar/CalendarRoot.cjs.map +1 -1
  5. package/dist/Calendar/CalendarRoot.js +2 -1
  6. package/dist/Calendar/CalendarRoot.js.map +1 -1
  7. package/dist/Combobox/ComboboxItem.cjs +3 -0
  8. package/dist/Combobox/ComboboxItem.cjs.map +1 -1
  9. package/dist/Combobox/ComboboxItem.js +3 -1
  10. package/dist/Combobox/ComboboxItem.js.map +1 -1
  11. package/dist/Combobox/ComboboxRoot.cjs +1 -0
  12. package/dist/Combobox/ComboboxRoot.cjs.map +1 -1
  13. package/dist/Combobox/ComboboxRoot.js +1 -0
  14. package/dist/Combobox/ComboboxRoot.js.map +1 -1
  15. package/dist/DateRangePicker/DateRangePickerRoot.cjs +4 -1
  16. package/dist/DateRangePicker/DateRangePickerRoot.cjs.map +1 -1
  17. package/dist/DateRangePicker/DateRangePickerRoot.js +4 -1
  18. package/dist/DateRangePicker/DateRangePickerRoot.js.map +1 -1
  19. package/dist/Listbox/ListboxRoot.cjs +1 -1
  20. package/dist/Listbox/ListboxRoot.cjs.map +1 -1
  21. package/dist/Listbox/ListboxRoot.js +1 -1
  22. package/dist/Listbox/ListboxRoot.js.map +1 -1
  23. package/dist/NavigationMenu/NavigationMenuContent.cjs.map +1 -1
  24. package/dist/NavigationMenu/NavigationMenuContent.js.map +1 -1
  25. package/dist/NavigationMenu/NavigationMenuIndicator.cjs +13 -18
  26. package/dist/NavigationMenu/NavigationMenuIndicator.cjs.map +1 -1
  27. package/dist/NavigationMenu/NavigationMenuIndicator.js +13 -18
  28. package/dist/NavigationMenu/NavigationMenuIndicator.js.map +1 -1
  29. package/dist/RangeCalendar/RangeCalendarRoot.cjs +2 -1
  30. package/dist/RangeCalendar/RangeCalendarRoot.cjs.map +1 -1
  31. package/dist/RangeCalendar/RangeCalendarRoot.js +2 -1
  32. package/dist/RangeCalendar/RangeCalendarRoot.js.map +1 -1
  33. package/dist/Select/SelectValue.cjs +4 -1
  34. package/dist/Select/SelectValue.cjs.map +1 -1
  35. package/dist/Select/SelectValue.js +4 -1
  36. package/dist/Select/SelectValue.js.map +1 -1
  37. package/dist/index.cjs +13 -0
  38. package/dist/index.cjs.map +1 -1
  39. package/dist/index.d.ts +129 -1
  40. package/dist/index.js +13 -13
  41. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- require('@vueuse/core');
4
3
  const vue = require('vue');
4
+ require('@vueuse/core');
5
5
  const Accordion_AccordionItem = require('./AccordionItem.cjs');
6
6
  const shared_useForwardExpose = require('../shared/useForwardExpose.cjs');
7
7
  const Collapsible_CollapsibleContent = require('../Collapsible/CollapsibleContent.cjs');
@@ -1,5 +1,5 @@
1
- import '@vueuse/core';
2
1
  import { defineComponent, openBlock, createBlock, unref, withCtx, renderSlot } from 'vue';
2
+ import '@vueuse/core';
3
3
  import { i as injectAccordionItemContext } from './AccordionItem.js';
4
4
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
5
5
  import { _ as _sfc_main$1 } from '../Collapsible/CollapsibleContent.js';
@@ -223,7 +223,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
223
223
  weekDays: vue.unref(weekdays),
224
224
  weekStartsOn: vue.unref(weekStartsOn),
225
225
  locale: vue.unref(locale),
226
- fixedWeeks: vue.unref(fixedWeeks)
226
+ fixedWeeks: vue.unref(fixedWeeks),
227
+ modelValue: vue.unref(modelValue)
227
228
  }),
228
229
  vue.createElementVNode("div", _hoisted_1, [
229
230
  vue.createElementVNode("div", _hoisted_2, vue.toDisplayString(vue.unref(fullCalendarLabel)), 1)
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarRoot.cjs","sources":["../../src/Calendar/CalendarRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { type DateValue, isEqualDay, isSameDay } from '@internationalized/date'\n\nimport type { Ref } from 'vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport { type Formatter, createContext, useDirection, useLocale } from '@/shared'\n\nimport { useCalendar, useCalendarState } from './useCalendar'\nimport { getDefaultDate, handleCalendarInitialFocus } from '@/shared/date'\nimport type { Grid, Matcher, WeekDayFormat } from '@/date'\nimport type { Direction } from '@/shared/types'\n\ntype CalendarRootContext = {\n locale: Ref<string>\n modelValue: Ref<DateValue | DateValue[] | undefined>\n placeholder: Ref<DateValue>\n pagedNavigation: Ref<boolean>\n preventDeselect: Ref<boolean>\n weekStartsOn: Ref<0 | 1 | 2 | 3 | 4 | 5 | 6>\n weekdayFormat: Ref<WeekDayFormat>\n fixedWeeks: Ref<boolean>\n multiple: Ref<boolean>\n numberOfMonths: Ref<number>\n disabled: Ref<boolean>\n readonly: Ref<boolean>\n initialFocus: Ref<boolean>\n onDateChange: (date: DateValue) => void\n onPlaceholderChange: (date: DateValue) => void\n fullCalendarLabel: Ref<string>\n parentElement: Ref<HTMLElement | undefined>\n headingValue: Ref<string>\n isInvalid: Ref<boolean>\n isDateDisabled: Matcher\n isDateSelected: Matcher\n isDateUnavailable?: Matcher\n isOutsideVisibleView: (date: DateValue) => boolean\n prevPage: (prevPageFunc?: (date: DateValue) => DateValue) => void\n nextPage: (nextPageFunc?: (date: DateValue) => DateValue) => void\n isNextButtonDisabled: (nextPageFunc?: (date: DateValue) => DateValue) => boolean\n isPrevButtonDisabled: (prevPageFunc?: (date: DateValue) => DateValue) => boolean\n formatter: Formatter\n dir: Ref<Direction>\n}\n\ninterface BaseCalendarRootProps extends PrimitiveProps {\n /** The default value for the calendar */\n defaultValue?: DateValue\n /** The default placeholder date */\n defaultPlaceholder?: DateValue\n /** The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view */\n placeholder?: DateValue\n /** This property causes the previous and next buttons to navigate by the number of months displayed at once, rather than one month */\n pagedNavigation?: boolean\n /** Whether or not to prevent the user from deselecting a date without selecting another date first */\n preventDeselect?: boolean\n /** The day of the week to start the calendar on */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6\n /** The format to use for the weekday strings provided via the weekdays slot prop */\n weekdayFormat?: WeekDayFormat\n /** The accessible label for the calendar */\n calendarLabel?: string\n /** Whether or not to always display 6 weeks in the calendar */\n fixedWeeks?: boolean\n /** The maximum date that can be selected */\n maxValue?: DateValue\n /** The minimum date that can be selected */\n minValue?: DateValue\n /** The locale to use for formatting dates */\n locale?: string\n /** The number of months to display at once */\n numberOfMonths?: number\n /** Whether or not the calendar is disabled */\n disabled?: boolean\n /** Whether or not the calendar is readonly */\n readonly?: boolean\n /** If true, the calendar will focus the selected day, today, or the first day of the month depending on what is visible when the calendar is mounted */\n initialFocus?: boolean\n /** A function that returns whether or not a date is disabled */\n isDateDisabled?: Matcher\n /** A function that returns whether or not a date is unavailable */\n isDateUnavailable?: Matcher\n /** The reading direction of the calendar when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. */\n dir?: Direction\n /** A function that returns the next page of the calendar. It receives the current placeholder as an argument inside the component. */\n nextPage?: (placeholder: DateValue) => DateValue\n /** A function that returns the previous page of the calendar. It receives the current placeholder as an argument inside the component. */\n prevPage?: (placeholder: DateValue) => DateValue\n}\n\nexport interface MultipleCalendarRootProps extends BaseCalendarRootProps {\n /** The controlled checked state of the calendar. Can be bound as `v-model`. */\n modelValue?: DateValue[] | undefined\n /** Whether or not multiple dates can be selected */\n multiple: true\n}\n\nexport interface SingleCalendarRootProps extends BaseCalendarRootProps {\n /** The controlled checked state of the calendar. Can be bound as `v-model`. */\n modelValue?: DateValue | undefined\n /** Whether or not multiple dates can be selected */\n multiple?: false\n}\n\nexport type CalendarRootProps = MultipleCalendarRootProps | SingleCalendarRootProps\n\nexport type CalendarRootEmits = {\n /** Event handler called whenever the model value changes */\n 'update:modelValue': [date: DateValue | undefined]\n /** Event handler called whenever the placeholder value changes */\n 'update:placeholder': [date: DateValue]\n}\n\nexport const [injectCalendarRootContext, provideCalendarRootContext]\n = createContext<CalendarRootContext>('CalendarRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { onMounted, toRefs, watch } from 'vue'\nimport { Primitive, usePrimitiveElement } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\n\nconst props = withDefaults(defineProps<CalendarRootProps>(), {\n defaultValue: undefined,\n as: 'div',\n pagedNavigation: false,\n preventDeselect: false,\n weekStartsOn: 0,\n weekdayFormat: 'narrow',\n fixedWeeks: false,\n multiple: false,\n numberOfMonths: 1,\n disabled: false,\n readonly: false,\n initialFocus: false,\n placeholder: undefined,\n isDateDisabled: undefined,\n isDateUnavailable: undefined,\n})\nconst emits = defineEmits<CalendarRootEmits>()\ndefineSlots<{\n default: (props: {\n /** The current date of the placeholder */\n date: DateValue\n /** The grid of dates */\n grid: Grid<DateValue>[]\n /** The days of the week */\n weekDays: string[]\n /** The start of the week */\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6\n /** The calendar locale */\n locale: string\n /** Whether or not to always display 6 weeks in the calendar */\n fixedWeeks: boolean\n }) => any\n}>()\n\nconst {\n disabled,\n readonly,\n initialFocus,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n multiple,\n minValue,\n maxValue,\n numberOfMonths,\n preventDeselect,\n isDateDisabled: propsIsDateDisabled,\n isDateUnavailable: propsIsDateUnavailable,\n calendarLabel,\n defaultValue,\n nextPage: propsNextPage,\n prevPage: propsPrevPage,\n dir: propDir,\n locale: propLocale,\n} = toRefs(props)\n\nconst { primitiveElement, currentElement: parentElement }\n = usePrimitiveElement()\nconst locale = useLocale(propLocale)\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: defaultValue.value,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<DateValue | DateValue[] | undefined>\n\nconst defaultDate = getDefaultDate({\n defaultPlaceholder: props.placeholder,\n defaultValue: modelValue.value,\n locale: props.locale,\n})\n\nconst placeholder = useVModel(props, 'placeholder', emits, {\n defaultValue: props.defaultPlaceholder ?? defaultDate.copy(),\n passive: (props.placeholder === undefined) as false,\n}) as Ref<DateValue>\n\nfunction onPlaceholderChange(value: DateValue) {\n placeholder.value = value.copy()\n}\n\nconst {\n fullCalendarLabel,\n headingValue,\n isDateDisabled,\n isDateUnavailable,\n isNextButtonDisabled,\n isPrevButtonDisabled,\n weekdays,\n isOutsideVisibleView,\n nextPage,\n prevPage,\n formatter,\n grid,\n} = useCalendar({\n locale,\n placeholder,\n weekStartsOn,\n fixedWeeks,\n numberOfMonths,\n minValue,\n maxValue,\n disabled,\n weekdayFormat,\n pagedNavigation,\n isDateDisabled: propsIsDateDisabled.value,\n isDateUnavailable: propsIsDateUnavailable.value,\n calendarLabel,\n nextPage: propsNextPage,\n prevPage: propsPrevPage,\n})\n\nconst {\n isInvalid,\n isDateSelected,\n} = useCalendarState({\n date: modelValue,\n isDateDisabled,\n isDateUnavailable,\n})\n\nwatch(modelValue, (_modelValue) => {\n if (Array.isArray(_modelValue) && _modelValue.length) {\n const lastValue = _modelValue[_modelValue.length - 1]\n if (lastValue && !isEqualDay(placeholder.value, lastValue))\n onPlaceholderChange(lastValue)\n }\n else if (!Array.isArray(_modelValue) && _modelValue && !isEqualDay(placeholder.value, _modelValue)) {\n onPlaceholderChange(_modelValue)\n }\n})\n\nfunction onDateChange(value: DateValue) {\n if (!multiple.value) {\n if (!modelValue.value) {\n modelValue.value = value.copy()\n return\n }\n\n if (!preventDeselect.value && isEqualDay(modelValue.value as DateValue, value)) {\n placeholder.value = value.copy()\n modelValue.value = undefined\n }\n else { modelValue.value = value.copy() }\n }\n else if (!modelValue.value) {\n modelValue.value = [value.copy()]\n }\n else if (Array.isArray(modelValue.value)) {\n const index = modelValue.value.findIndex(date => isSameDay(date, value))\n if (index === -1) {\n modelValue.value = [...modelValue.value, value]\n }\n else if (!preventDeselect.value) {\n const next = modelValue.value.filter(date => !isSameDay(date, value))\n if (!next.length) {\n placeholder.value = value.copy()\n modelValue.value = undefined\n return\n }\n modelValue.value = next.map(date => date.copy())\n }\n }\n}\n\nonMounted(() => {\n if (initialFocus.value)\n handleCalendarInitialFocus(parentElement.value)\n})\n\nprovideCalendarRootContext({\n isDateUnavailable,\n dir,\n isDateDisabled,\n locale,\n formatter,\n modelValue,\n placeholder,\n disabled,\n initialFocus,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n multiple,\n numberOfMonths,\n readonly,\n preventDeselect,\n fullCalendarLabel,\n headingValue,\n isInvalid,\n isDateSelected,\n isNextButtonDisabled,\n isPrevButtonDisabled,\n isOutsideVisibleView,\n nextPage,\n prevPage,\n parentElement,\n onPlaceholderChange,\n onDateChange,\n})\n</script>\n\n<template>\n <Primitive\n ref=\"primitiveElement\"\n :as=\"as\"\n :as-child=\"asChild\"\n role=\"application\"\n :aria-label=\"fullCalendarLabel\"\n :data-readonly=\"readonly ? '' : undefined\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-invalid=\"isInvalid ? '' : undefined\"\n :dir=\"dir\"\n >\n <slot\n :date=\"placeholder\"\n :grid=\"grid\"\n :week-days=\"weekdays\"\n :week-starts-on=\"weekStartsOn\"\n :locale=\"locale\"\n :fixed-weeks=\"fixedWeeks\"\n />\n <div\n style=\"border: 0px; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; white-space: nowrap; width: 1px;\"\n >\n <div\n role=\"heading\"\n aria-level=\"2\"\n >\n {{ fullCalendarLabel }}\n </div>\n </div>\n </Primitive>\n</template>\n"],"names":["createContext","toRefs","usePrimitiveElement","useLocale","useDirection","useVModel","getDefaultDate","useCalendar","useCalendarState","watch","isEqualDay","isSameDay","date","onMounted","handleCalendarIn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AAA;AAAA,MACA,YAAA;AAAA,MACA,SAAA;AAAA,MACA,cAAA;AAAA,MACA,oBAAA;AAAA,MACA,oBAAA;AAAA,MACA,oBAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,aAAA;AAAA,MACA,mBAAA;AAAA,MACA,YAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CalendarRoot.cjs","sources":["../../src/Calendar/CalendarRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { type DateValue, isEqualDay, isSameDay } from '@internationalized/date'\n\nimport type { Ref } from 'vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport { type Formatter, createContext, useDirection, useLocale } from '@/shared'\n\nimport { useCalendar, useCalendarState } from './useCalendar'\nimport { getDefaultDate, handleCalendarInitialFocus } from '@/shared/date'\nimport type { Grid, Matcher, WeekDayFormat } from '@/date'\nimport type { Direction } from '@/shared/types'\n\ntype CalendarRootContext = {\n locale: Ref<string>\n modelValue: Ref<DateValue | DateValue[] | undefined>\n placeholder: Ref<DateValue>\n pagedNavigation: Ref<boolean>\n preventDeselect: Ref<boolean>\n weekStartsOn: Ref<0 | 1 | 2 | 3 | 4 | 5 | 6>\n weekdayFormat: Ref<WeekDayFormat>\n fixedWeeks: Ref<boolean>\n multiple: Ref<boolean>\n numberOfMonths: Ref<number>\n disabled: Ref<boolean>\n readonly: Ref<boolean>\n initialFocus: Ref<boolean>\n onDateChange: (date: DateValue) => void\n onPlaceholderChange: (date: DateValue) => void\n fullCalendarLabel: Ref<string>\n parentElement: Ref<HTMLElement | undefined>\n headingValue: Ref<string>\n isInvalid: Ref<boolean>\n isDateDisabled: Matcher\n isDateSelected: Matcher\n isDateUnavailable?: Matcher\n isOutsideVisibleView: (date: DateValue) => boolean\n prevPage: (prevPageFunc?: (date: DateValue) => DateValue) => void\n nextPage: (nextPageFunc?: (date: DateValue) => DateValue) => void\n isNextButtonDisabled: (nextPageFunc?: (date: DateValue) => DateValue) => boolean\n isPrevButtonDisabled: (prevPageFunc?: (date: DateValue) => DateValue) => boolean\n formatter: Formatter\n dir: Ref<Direction>\n}\n\ninterface BaseCalendarRootProps extends PrimitiveProps {\n /** The default value for the calendar */\n defaultValue?: DateValue\n /** The default placeholder date */\n defaultPlaceholder?: DateValue\n /** The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view */\n placeholder?: DateValue\n /** This property causes the previous and next buttons to navigate by the number of months displayed at once, rather than one month */\n pagedNavigation?: boolean\n /** Whether or not to prevent the user from deselecting a date without selecting another date first */\n preventDeselect?: boolean\n /** The day of the week to start the calendar on */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6\n /** The format to use for the weekday strings provided via the weekdays slot prop */\n weekdayFormat?: WeekDayFormat\n /** The accessible label for the calendar */\n calendarLabel?: string\n /** Whether or not to always display 6 weeks in the calendar */\n fixedWeeks?: boolean\n /** The maximum date that can be selected */\n maxValue?: DateValue\n /** The minimum date that can be selected */\n minValue?: DateValue\n /** The locale to use for formatting dates */\n locale?: string\n /** The number of months to display at once */\n numberOfMonths?: number\n /** Whether or not the calendar is disabled */\n disabled?: boolean\n /** Whether or not the calendar is readonly */\n readonly?: boolean\n /** If true, the calendar will focus the selected day, today, or the first day of the month depending on what is visible when the calendar is mounted */\n initialFocus?: boolean\n /** A function that returns whether or not a date is disabled */\n isDateDisabled?: Matcher\n /** A function that returns whether or not a date is unavailable */\n isDateUnavailable?: Matcher\n /** The reading direction of the calendar when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. */\n dir?: Direction\n /** A function that returns the next page of the calendar. It receives the current placeholder as an argument inside the component. */\n nextPage?: (placeholder: DateValue) => DateValue\n /** A function that returns the previous page of the calendar. It receives the current placeholder as an argument inside the component. */\n prevPage?: (placeholder: DateValue) => DateValue\n}\n\nexport interface MultipleCalendarRootProps extends BaseCalendarRootProps {\n /** The controlled checked state of the calendar. Can be bound as `v-model`. */\n modelValue?: DateValue[] | undefined\n /** Whether or not multiple dates can be selected */\n multiple: true\n}\n\nexport interface SingleCalendarRootProps extends BaseCalendarRootProps {\n /** The controlled checked state of the calendar. Can be bound as `v-model`. */\n modelValue?: DateValue | undefined\n /** Whether or not multiple dates can be selected */\n multiple?: false\n}\n\nexport type CalendarRootProps = MultipleCalendarRootProps | SingleCalendarRootProps\n\nexport type CalendarRootEmits = {\n /** Event handler called whenever the model value changes */\n 'update:modelValue': [date: DateValue | undefined]\n /** Event handler called whenever the placeholder value changes */\n 'update:placeholder': [date: DateValue]\n}\n\nexport const [injectCalendarRootContext, provideCalendarRootContext]\n = createContext<CalendarRootContext>('CalendarRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { onMounted, toRefs, watch } from 'vue'\nimport { Primitive, usePrimitiveElement } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\n\nconst props = withDefaults(defineProps<CalendarRootProps>(), {\n defaultValue: undefined,\n as: 'div',\n pagedNavigation: false,\n preventDeselect: false,\n weekStartsOn: 0,\n weekdayFormat: 'narrow',\n fixedWeeks: false,\n multiple: false,\n numberOfMonths: 1,\n disabled: false,\n readonly: false,\n initialFocus: false,\n placeholder: undefined,\n isDateDisabled: undefined,\n isDateUnavailable: undefined,\n})\nconst emits = defineEmits<CalendarRootEmits>()\ndefineSlots<{\n default: (props: {\n /** The current date of the placeholder */\n date: DateValue\n /** The grid of dates */\n grid: Grid<DateValue>[]\n /** The days of the week */\n weekDays: string[]\n /** The start of the week */\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6\n /** The calendar locale */\n locale: string\n /** Whether or not to always display 6 weeks in the calendar */\n fixedWeeks: boolean\n }) => any\n}>()\n\nconst {\n disabled,\n readonly,\n initialFocus,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n multiple,\n minValue,\n maxValue,\n numberOfMonths,\n preventDeselect,\n isDateDisabled: propsIsDateDisabled,\n isDateUnavailable: propsIsDateUnavailable,\n calendarLabel,\n defaultValue,\n nextPage: propsNextPage,\n prevPage: propsPrevPage,\n dir: propDir,\n locale: propLocale,\n} = toRefs(props)\n\nconst { primitiveElement, currentElement: parentElement }\n = usePrimitiveElement()\nconst locale = useLocale(propLocale)\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: defaultValue.value,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<DateValue | DateValue[] | undefined>\n\nconst defaultDate = getDefaultDate({\n defaultPlaceholder: props.placeholder,\n defaultValue: modelValue.value,\n locale: props.locale,\n})\n\nconst placeholder = useVModel(props, 'placeholder', emits, {\n defaultValue: props.defaultPlaceholder ?? defaultDate.copy(),\n passive: (props.placeholder === undefined) as false,\n}) as Ref<DateValue>\n\nfunction onPlaceholderChange(value: DateValue) {\n placeholder.value = value.copy()\n}\n\nconst {\n fullCalendarLabel,\n headingValue,\n isDateDisabled,\n isDateUnavailable,\n isNextButtonDisabled,\n isPrevButtonDisabled,\n weekdays,\n isOutsideVisibleView,\n nextPage,\n prevPage,\n formatter,\n grid,\n} = useCalendar({\n locale,\n placeholder,\n weekStartsOn,\n fixedWeeks,\n numberOfMonths,\n minValue,\n maxValue,\n disabled,\n weekdayFormat,\n pagedNavigation,\n isDateDisabled: propsIsDateDisabled.value,\n isDateUnavailable: propsIsDateUnavailable.value,\n calendarLabel,\n nextPage: propsNextPage,\n prevPage: propsPrevPage,\n})\n\nconst {\n isInvalid,\n isDateSelected,\n} = useCalendarState({\n date: modelValue,\n isDateDisabled,\n isDateUnavailable,\n})\n\nwatch(modelValue, (_modelValue) => {\n if (Array.isArray(_modelValue) && _modelValue.length) {\n const lastValue = _modelValue[_modelValue.length - 1]\n if (lastValue && !isEqualDay(placeholder.value, lastValue))\n onPlaceholderChange(lastValue)\n }\n else if (!Array.isArray(_modelValue) && _modelValue && !isEqualDay(placeholder.value, _modelValue)) {\n onPlaceholderChange(_modelValue)\n }\n})\n\nfunction onDateChange(value: DateValue) {\n if (!multiple.value) {\n if (!modelValue.value) {\n modelValue.value = value.copy()\n return\n }\n\n if (!preventDeselect.value && isEqualDay(modelValue.value as DateValue, value)) {\n placeholder.value = value.copy()\n modelValue.value = undefined\n }\n else { modelValue.value = value.copy() }\n }\n else if (!modelValue.value) {\n modelValue.value = [value.copy()]\n }\n else if (Array.isArray(modelValue.value)) {\n const index = modelValue.value.findIndex(date => isSameDay(date, value))\n if (index === -1) {\n modelValue.value = [...modelValue.value, value]\n }\n else if (!preventDeselect.value) {\n const next = modelValue.value.filter(date => !isSameDay(date, value))\n if (!next.length) {\n placeholder.value = value.copy()\n modelValue.value = undefined\n return\n }\n modelValue.value = next.map(date => date.copy())\n }\n }\n}\n\nonMounted(() => {\n if (initialFocus.value)\n handleCalendarInitialFocus(parentElement.value)\n})\n\nprovideCalendarRootContext({\n isDateUnavailable,\n dir,\n isDateDisabled,\n locale,\n formatter,\n modelValue,\n placeholder,\n disabled,\n initialFocus,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n multiple,\n numberOfMonths,\n readonly,\n preventDeselect,\n fullCalendarLabel,\n headingValue,\n isInvalid,\n isDateSelected,\n isNextButtonDisabled,\n isPrevButtonDisabled,\n isOutsideVisibleView,\n nextPage,\n prevPage,\n parentElement,\n onPlaceholderChange,\n onDateChange,\n})\n</script>\n\n<template>\n <Primitive\n ref=\"primitiveElement\"\n :as=\"as\"\n :as-child=\"asChild\"\n role=\"application\"\n :aria-label=\"fullCalendarLabel\"\n :data-readonly=\"readonly ? '' : undefined\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-invalid=\"isInvalid ? '' : undefined\"\n :dir=\"dir\"\n >\n <slot\n :date=\"placeholder\"\n :grid=\"grid\"\n :week-days=\"weekdays\"\n :week-starts-on=\"weekStartsOn\"\n :locale=\"locale\"\n :fixed-weeks=\"fixedWeeks\"\n :model-value=\"modelValue\"\n />\n <div\n style=\"border: 0px; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; white-space: nowrap; width: 1px;\"\n >\n <div\n role=\"heading\"\n aria-level=\"2\"\n >\n {{ fullCalendarLabel }}\n </div>\n </div>\n </Primitive>\n</template>\n"],"names":["createContext","toRefs","usePrimitiveElement","useLocale","useDirection","useVModel","getDefaultDate","useCalendar","useCalendarState","watch","isEqualDay","isSameDay","date","onMounted","handleCalendarInitialFocus"],"mappings":";;;;;;;;;;;;;;;;;;;AAgHO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/DA,mCAAmC,cAAc,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQrD,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAiBd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAkBd,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,cAAA;AAAA,MACA,eAAA;AAAA,MACA,cAAgB,EAAA,mBAAA;AAAA,MAChB,iBAAmB,EAAA,sBAAA;AAAA,MACnB,aAAA;AAAA,MACA,YAAA;AAAA,MACA,QAAU,EAAA,aAAA;AAAA,MACV,QAAU,EAAA,aAAA;AAAA,MACV,GAAK,EAAA,OAAA;AAAA,MACL,MAAQ,EAAA,UAAA;AAAA,KACV,GAAIC,WAAO,KAAK,CAAA,CAAA;AAEhB,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAgB,EAAA,aAAA,KACtCC,iDAAoB,EAAA,CAAA;AACxB,IAAM,MAAA,MAAA,GAASC,2BAAU,UAAU,CAAA,CAAA;AACnC,IAAM,MAAA,GAAA,GAAMC,iCAAa,OAAO,CAAA,CAAA;AAEhC,I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;AAAA,MACzB,iBAAA;AAAA,MACA,GAAA;AAAA,MACA,cAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,QAAA;AAAA,MACA,cAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,iBAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAA;AAAA,MACA,cAAA;AAAA,MACA,oBAAA;AAAA,MACA,oBAAA;AAAA,MACA,oBAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,aAAA;AAAA,MACA,mBAAA;AAAA,MACA,YAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -221,7 +221,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
221
221
  weekDays: unref(weekdays),
222
222
  weekStartsOn: unref(weekStartsOn),
223
223
  locale: unref(locale),
224
- fixedWeeks: unref(fixedWeeks)
224
+ fixedWeeks: unref(fixedWeeks),
225
+ modelValue: unref(modelValue)
225
226
  }),
226
227
  createElementVNode("div", _hoisted_1, [
227
228
  createElementVNode("div", _hoisted_2, toDisplayString(unref(fullCalendarLabel)), 1)
@@ -1 +1 @@
1
- {"version":3,"file":"CalendarRoot.js","sources":["../../src/Calendar/CalendarRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { type DateValue, isEqualDay, isSameDay } from '@internationalized/date'\n\nimport type { Ref } from 'vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport { type Formatter, createContext, useDirection, useLocale } from '@/shared'\n\nimport { useCalendar, useCalendarState } from './useCalendar'\nimport { getDefaultDate, handleCalendarInitialFocus } from '@/shared/date'\nimport type { Grid, Matcher, WeekDayFormat } from '@/date'\nimport type { Direction } from '@/shared/types'\n\ntype CalendarRootContext = {\n locale: Ref<string>\n modelValue: Ref<DateValue | DateValue[] | undefined>\n placeholder: Ref<DateValue>\n pagedNavigation: Ref<boolean>\n preventDeselect: Ref<boolean>\n weekStartsOn: Ref<0 | 1 | 2 | 3 | 4 | 5 | 6>\n weekdayFormat: Ref<WeekDayFormat>\n fixedWeeks: Ref<boolean>\n multiple: Ref<boolean>\n numberOfMonths: Ref<number>\n disabled: Ref<boolean>\n readonly: Ref<boolean>\n initialFocus: Ref<boolean>\n onDateChange: (date: DateValue) => void\n onPlaceholderChange: (date: DateValue) => void\n fullCalendarLabel: Ref<string>\n parentElement: Ref<HTMLElement | undefined>\n headingValue: Ref<string>\n isInvalid: Ref<boolean>\n isDateDisabled: Matcher\n isDateSelected: Matcher\n isDateUnavailable?: Matcher\n isOutsideVisibleView: (date: DateValue) => boolean\n prevPage: (prevPageFunc?: (date: DateValue) => DateValue) => void\n nextPage: (nextPageFunc?: (date: DateValue) => DateValue) => void\n isNextButtonDisabled: (nextPageFunc?: (date: DateValue) => DateValue) => boolean\n isPrevButtonDisabled: (prevPageFunc?: (date: DateValue) => DateValue) => boolean\n formatter: Formatter\n dir: Ref<Direction>\n}\n\ninterface BaseCalendarRootProps extends PrimitiveProps {\n /** The default value for the calendar */\n defaultValue?: DateValue\n /** The default placeholder date */\n defaultPlaceholder?: DateValue\n /** The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view */\n placeholder?: DateValue\n /** This property causes the previous and next buttons to navigate by the number of months displayed at once, rather than one month */\n pagedNavigation?: boolean\n /** Whether or not to prevent the user from deselecting a date without selecting another date first */\n preventDeselect?: boolean\n /** The day of the week to start the calendar on */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6\n /** The format to use for the weekday strings provided via the weekdays slot prop */\n weekdayFormat?: WeekDayFormat\n /** The accessible label for the calendar */\n calendarLabel?: string\n /** Whether or not to always display 6 weeks in the calendar */\n fixedWeeks?: boolean\n /** The maximum date that can be selected */\n maxValue?: DateValue\n /** The minimum date that can be selected */\n minValue?: DateValue\n /** The locale to use for formatting dates */\n locale?: string\n /** The number of months to display at once */\n numberOfMonths?: number\n /** Whether or not the calendar is disabled */\n disabled?: boolean\n /** Whether or not the calendar is readonly */\n readonly?: boolean\n /** If true, the calendar will focus the selected day, today, or the first day of the month depending on what is visible when the calendar is mounted */\n initialFocus?: boolean\n /** A function that returns whether or not a date is disabled */\n isDateDisabled?: Matcher\n /** A function that returns whether or not a date is unavailable */\n isDateUnavailable?: Matcher\n /** The reading direction of the calendar when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. */\n dir?: Direction\n /** A function that returns the next page of the calendar. It receives the current placeholder as an argument inside the component. */\n nextPage?: (placeholder: DateValue) => DateValue\n /** A function that returns the previous page of the calendar. It receives the current placeholder as an argument inside the component. */\n prevPage?: (placeholder: DateValue) => DateValue\n}\n\nexport interface MultipleCalendarRootProps extends BaseCalendarRootProps {\n /** The controlled checked state of the calendar. Can be bound as `v-model`. */\n modelValue?: DateValue[] | undefined\n /** Whether or not multiple dates can be selected */\n multiple: true\n}\n\nexport interface SingleCalendarRootProps extends BaseCalendarRootProps {\n /** The controlled checked state of the calendar. Can be bound as `v-model`. */\n modelValue?: DateValue | undefined\n /** Whether or not multiple dates can be selected */\n multiple?: false\n}\n\nexport type CalendarRootProps = MultipleCalendarRootProps | SingleCalendarRootProps\n\nexport type CalendarRootEmits = {\n /** Event handler called whenever the model value changes */\n 'update:modelValue': [date: DateValue | undefined]\n /** Event handler called whenever the placeholder value changes */\n 'update:placeholder': [date: DateValue]\n}\n\nexport const [injectCalendarRootContext, provideCalendarRootContext]\n = createContext<CalendarRootContext>('CalendarRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { onMounted, toRefs, watch } from 'vue'\nimport { Primitive, usePrimitiveElement } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\n\nconst props = withDefaults(defineProps<CalendarRootProps>(), {\n defaultValue: undefined,\n as: 'div',\n pagedNavigation: false,\n preventDeselect: false,\n weekStartsOn: 0,\n weekdayFormat: 'narrow',\n fixedWeeks: false,\n multiple: false,\n numberOfMonths: 1,\n disabled: false,\n readonly: false,\n initialFocus: false,\n placeholder: undefined,\n isDateDisabled: undefined,\n isDateUnavailable: undefined,\n})\nconst emits = defineEmits<CalendarRootEmits>()\ndefineSlots<{\n default: (props: {\n /** The current date of the placeholder */\n date: DateValue\n /** The grid of dates */\n grid: Grid<DateValue>[]\n /** The days of the week */\n weekDays: string[]\n /** The start of the week */\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6\n /** The calendar locale */\n locale: string\n /** Whether or not to always display 6 weeks in the calendar */\n fixedWeeks: boolean\n }) => any\n}>()\n\nconst {\n disabled,\n readonly,\n initialFocus,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n multiple,\n minValue,\n maxValue,\n numberOfMonths,\n preventDeselect,\n isDateDisabled: propsIsDateDisabled,\n isDateUnavailable: propsIsDateUnavailable,\n calendarLabel,\n defaultValue,\n nextPage: propsNextPage,\n prevPage: propsPrevPage,\n dir: propDir,\n locale: propLocale,\n} = toRefs(props)\n\nconst { primitiveElement, currentElement: parentElement }\n = usePrimitiveElement()\nconst locale = useLocale(propLocale)\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: defaultValue.value,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<DateValue | DateValue[] | undefined>\n\nconst defaultDate = getDefaultDate({\n defaultPlaceholder: props.placeholder,\n defaultValue: modelValue.value,\n locale: props.locale,\n})\n\nconst placeholder = useVModel(props, 'placeholder', emits, {\n defaultValue: props.defaultPlaceholder ?? defaultDate.copy(),\n passive: (props.placeholder === undefined) as false,\n}) as Ref<DateValue>\n\nfunction onPlaceholderChange(value: DateValue) {\n placeholder.value = value.copy()\n}\n\nconst {\n fullCalendarLabel,\n headingValue,\n isDateDisabled,\n isDateUnavailable,\n isNextButtonDisabled,\n isPrevButtonDisabled,\n weekdays,\n isOutsideVisibleView,\n nextPage,\n prevPage,\n formatter,\n grid,\n} = useCalendar({\n locale,\n placeholder,\n weekStartsOn,\n fixedWeeks,\n numberOfMonths,\n minValue,\n maxValue,\n disabled,\n weekdayFormat,\n pagedNavigation,\n isDateDisabled: propsIsDateDisabled.value,\n isDateUnavailable: propsIsDateUnavailable.value,\n calendarLabel,\n nextPage: propsNextPage,\n prevPage: propsPrevPage,\n})\n\nconst {\n isInvalid,\n isDateSelected,\n} = useCalendarState({\n date: modelValue,\n isDateDisabled,\n isDateUnavailable,\n})\n\nwatch(modelValue, (_modelValue) => {\n if (Array.isArray(_modelValue) && _modelValue.length) {\n const lastValue = _modelValue[_modelValue.length - 1]\n if (lastValue && !isEqualDay(placeholder.value, lastValue))\n onPlaceholderChange(lastValue)\n }\n else if (!Array.isArray(_modelValue) && _modelValue && !isEqualDay(placeholder.value, _modelValue)) {\n onPlaceholderChange(_modelValue)\n }\n})\n\nfunction onDateChange(value: DateValue) {\n if (!multiple.value) {\n if (!modelValue.value) {\n modelValue.value = value.copy()\n return\n }\n\n if (!preventDeselect.value && isEqualDay(modelValue.value as DateValue, value)) {\n placeholder.value = value.copy()\n modelValue.value = undefined\n }\n else { modelValue.value = value.copy() }\n }\n else if (!modelValue.value) {\n modelValue.value = [value.copy()]\n }\n else if (Array.isArray(modelValue.value)) {\n const index = modelValue.value.findIndex(date => isSameDay(date, value))\n if (index === -1) {\n modelValue.value = [...modelValue.value, value]\n }\n else if (!preventDeselect.value) {\n const next = modelValue.value.filter(date => !isSameDay(date, value))\n if (!next.length) {\n placeholder.value = value.copy()\n modelValue.value = undefined\n return\n }\n modelValue.value = next.map(date => date.copy())\n }\n }\n}\n\nonMounted(() => {\n if (initialFocus.value)\n handleCalendarInitialFocus(parentElement.value)\n})\n\nprovideCalendarRootContext({\n isDateUnavailable,\n dir,\n isDateDisabled,\n locale,\n formatter,\n modelValue,\n placeholder,\n disabled,\n initialFocus,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n multiple,\n numberOfMonths,\n readonly,\n preventDeselect,\n fullCalendarLabel,\n headingValue,\n isInvalid,\n isDateSelected,\n isNextButtonDisabled,\n isPrevButtonDisabled,\n isOutsideVisibleView,\n nextPage,\n prevPage,\n parentElement,\n onPlaceholderChange,\n onDateChange,\n})\n</script>\n\n<template>\n <Primitive\n ref=\"primitiveElement\"\n :as=\"as\"\n :as-child=\"asChild\"\n role=\"application\"\n :aria-label=\"fullCalendarLabel\"\n :data-readonly=\"readonly ? '' : undefined\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-invalid=\"isInvalid ? '' : undefined\"\n :dir=\"dir\"\n >\n <slot\n :date=\"placeholder\"\n :grid=\"grid\"\n :week-days=\"weekdays\"\n :week-starts-on=\"weekStartsOn\"\n :locale=\"locale\"\n :fixed-weeks=\"fixedWeeks\"\n />\n <div\n style=\"border: 0px; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; white-space: nowrap; width: 1px;\"\n >\n <div\n role=\"heading\"\n aria-level=\"2\"\n >\n {{ fullCalendarLabel }}\n </div>\n </div>\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgHO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/D,cAAmC,cAAc,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQrD,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAiBd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAkBd,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,cAAA;AAAA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Q,EAAA;AAChB,YAAY,WAAA,CAAA,KAAA,GAAQ,MAAM,IAAK,EAAA,CAAA;AAC/B,YAAA,UAAA,CAAW,KAAQ,GAAA,KAAA,CAAA,CAAA;AACnB,YAAA,OAAA;AAAA,WACF;AACA,UAAA,UAAA,CAAW,QAAQ,IAAK,CAAA,GAAA,CAAI,CAAQ,IAAA,KAAA,IAAA,CAAK,MAAM,CAAA,CAAA;AAAA,SACjD;AAAA,OACF;AAAA,KACF;AAEA,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,YAAa,CAAA,KAAA;AACf,QAAA,0BAAA,CAA2B,cAAc,KAAK,CAAA,CAAA;AAAA,KACjD,CAAA,CAAA;AAED,IAA2B,0BAAA,CAAA;AAAA,MACzB,iBAAA;AAAA,MACA,GAAA;AAAA,MACA,cAAA;AAAA,MACA,MAAA;AAAA,MACA,SAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,QAAA;AAAA,MACA,cAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,iBAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAA;AAAA,MACA,cAAA;AAAA,MACA,oBAAA;AAAA,MACA,oBAAA;AAAA,MACA,oBAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,aAAA;AAAA,MACA,mBAAA;AAAA,MACA,YAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CalendarRoot.js","sources":["../../src/Calendar/CalendarRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { type DateValue, isEqualDay, isSameDay } from '@internationalized/date'\n\nimport type { Ref } from 'vue'\nimport type { PrimitiveProps } from '@/Primitive'\nimport { type Formatter, createContext, useDirection, useLocale } from '@/shared'\n\nimport { useCalendar, useCalendarState } from './useCalendar'\nimport { getDefaultDate, handleCalendarInitialFocus } from '@/shared/date'\nimport type { Grid, Matcher, WeekDayFormat } from '@/date'\nimport type { Direction } from '@/shared/types'\n\ntype CalendarRootContext = {\n locale: Ref<string>\n modelValue: Ref<DateValue | DateValue[] | undefined>\n placeholder: Ref<DateValue>\n pagedNavigation: Ref<boolean>\n preventDeselect: Ref<boolean>\n weekStartsOn: Ref<0 | 1 | 2 | 3 | 4 | 5 | 6>\n weekdayFormat: Ref<WeekDayFormat>\n fixedWeeks: Ref<boolean>\n multiple: Ref<boolean>\n numberOfMonths: Ref<number>\n disabled: Ref<boolean>\n readonly: Ref<boolean>\n initialFocus: Ref<boolean>\n onDateChange: (date: DateValue) => void\n onPlaceholderChange: (date: DateValue) => void\n fullCalendarLabel: Ref<string>\n parentElement: Ref<HTMLElement | undefined>\n headingValue: Ref<string>\n isInvalid: Ref<boolean>\n isDateDisabled: Matcher\n isDateSelected: Matcher\n isDateUnavailable?: Matcher\n isOutsideVisibleView: (date: DateValue) => boolean\n prevPage: (prevPageFunc?: (date: DateValue) => DateValue) => void\n nextPage: (nextPageFunc?: (date: DateValue) => DateValue) => void\n isNextButtonDisabled: (nextPageFunc?: (date: DateValue) => DateValue) => boolean\n isPrevButtonDisabled: (prevPageFunc?: (date: DateValue) => DateValue) => boolean\n formatter: Formatter\n dir: Ref<Direction>\n}\n\ninterface BaseCalendarRootProps extends PrimitiveProps {\n /** The default value for the calendar */\n defaultValue?: DateValue\n /** The default placeholder date */\n defaultPlaceholder?: DateValue\n /** The placeholder date, which is used to determine what month to display when no date is selected. This updates as the user navigates the calendar and can be used to programmatically control the calendar view */\n placeholder?: DateValue\n /** This property causes the previous and next buttons to navigate by the number of months displayed at once, rather than one month */\n pagedNavigation?: boolean\n /** Whether or not to prevent the user from deselecting a date without selecting another date first */\n preventDeselect?: boolean\n /** The day of the week to start the calendar on */\n weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6\n /** The format to use for the weekday strings provided via the weekdays slot prop */\n weekdayFormat?: WeekDayFormat\n /** The accessible label for the calendar */\n calendarLabel?: string\n /** Whether or not to always display 6 weeks in the calendar */\n fixedWeeks?: boolean\n /** The maximum date that can be selected */\n maxValue?: DateValue\n /** The minimum date that can be selected */\n minValue?: DateValue\n /** The locale to use for formatting dates */\n locale?: string\n /** The number of months to display at once */\n numberOfMonths?: number\n /** Whether or not the calendar is disabled */\n disabled?: boolean\n /** Whether or not the calendar is readonly */\n readonly?: boolean\n /** If true, the calendar will focus the selected day, today, or the first day of the month depending on what is visible when the calendar is mounted */\n initialFocus?: boolean\n /** A function that returns whether or not a date is disabled */\n isDateDisabled?: Matcher\n /** A function that returns whether or not a date is unavailable */\n isDateUnavailable?: Matcher\n /** The reading direction of the calendar when applicable. <br> If omitted, inherits globally from `ConfigProvider` or assumes LTR (left-to-right) reading mode. */\n dir?: Direction\n /** A function that returns the next page of the calendar. It receives the current placeholder as an argument inside the component. */\n nextPage?: (placeholder: DateValue) => DateValue\n /** A function that returns the previous page of the calendar. It receives the current placeholder as an argument inside the component. */\n prevPage?: (placeholder: DateValue) => DateValue\n}\n\nexport interface MultipleCalendarRootProps extends BaseCalendarRootProps {\n /** The controlled checked state of the calendar. Can be bound as `v-model`. */\n modelValue?: DateValue[] | undefined\n /** Whether or not multiple dates can be selected */\n multiple: true\n}\n\nexport interface SingleCalendarRootProps extends BaseCalendarRootProps {\n /** The controlled checked state of the calendar. Can be bound as `v-model`. */\n modelValue?: DateValue | undefined\n /** Whether or not multiple dates can be selected */\n multiple?: false\n}\n\nexport type CalendarRootProps = MultipleCalendarRootProps | SingleCalendarRootProps\n\nexport type CalendarRootEmits = {\n /** Event handler called whenever the model value changes */\n 'update:modelValue': [date: DateValue | undefined]\n /** Event handler called whenever the placeholder value changes */\n 'update:placeholder': [date: DateValue]\n}\n\nexport const [injectCalendarRootContext, provideCalendarRootContext]\n = createContext<CalendarRootContext>('CalendarRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { onMounted, toRefs, watch } from 'vue'\nimport { Primitive, usePrimitiveElement } from '@/Primitive'\nimport { useVModel } from '@vueuse/core'\n\nconst props = withDefaults(defineProps<CalendarRootProps>(), {\n defaultValue: undefined,\n as: 'div',\n pagedNavigation: false,\n preventDeselect: false,\n weekStartsOn: 0,\n weekdayFormat: 'narrow',\n fixedWeeks: false,\n multiple: false,\n numberOfMonths: 1,\n disabled: false,\n readonly: false,\n initialFocus: false,\n placeholder: undefined,\n isDateDisabled: undefined,\n isDateUnavailable: undefined,\n})\nconst emits = defineEmits<CalendarRootEmits>()\ndefineSlots<{\n default: (props: {\n /** The current date of the placeholder */\n date: DateValue\n /** The grid of dates */\n grid: Grid<DateValue>[]\n /** The days of the week */\n weekDays: string[]\n /** The start of the week */\n weekStartsOn: 0 | 1 | 2 | 3 | 4 | 5 | 6\n /** The calendar locale */\n locale: string\n /** Whether or not to always display 6 weeks in the calendar */\n fixedWeeks: boolean\n }) => any\n}>()\n\nconst {\n disabled,\n readonly,\n initialFocus,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n multiple,\n minValue,\n maxValue,\n numberOfMonths,\n preventDeselect,\n isDateDisabled: propsIsDateDisabled,\n isDateUnavailable: propsIsDateUnavailable,\n calendarLabel,\n defaultValue,\n nextPage: propsNextPage,\n prevPage: propsPrevPage,\n dir: propDir,\n locale: propLocale,\n} = toRefs(props)\n\nconst { primitiveElement, currentElement: parentElement }\n = usePrimitiveElement()\nconst locale = useLocale(propLocale)\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: defaultValue.value,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<DateValue | DateValue[] | undefined>\n\nconst defaultDate = getDefaultDate({\n defaultPlaceholder: props.placeholder,\n defaultValue: modelValue.value,\n locale: props.locale,\n})\n\nconst placeholder = useVModel(props, 'placeholder', emits, {\n defaultValue: props.defaultPlaceholder ?? defaultDate.copy(),\n passive: (props.placeholder === undefined) as false,\n}) as Ref<DateValue>\n\nfunction onPlaceholderChange(value: DateValue) {\n placeholder.value = value.copy()\n}\n\nconst {\n fullCalendarLabel,\n headingValue,\n isDateDisabled,\n isDateUnavailable,\n isNextButtonDisabled,\n isPrevButtonDisabled,\n weekdays,\n isOutsideVisibleView,\n nextPage,\n prevPage,\n formatter,\n grid,\n} = useCalendar({\n locale,\n placeholder,\n weekStartsOn,\n fixedWeeks,\n numberOfMonths,\n minValue,\n maxValue,\n disabled,\n weekdayFormat,\n pagedNavigation,\n isDateDisabled: propsIsDateDisabled.value,\n isDateUnavailable: propsIsDateUnavailable.value,\n calendarLabel,\n nextPage: propsNextPage,\n prevPage: propsPrevPage,\n})\n\nconst {\n isInvalid,\n isDateSelected,\n} = useCalendarState({\n date: modelValue,\n isDateDisabled,\n isDateUnavailable,\n})\n\nwatch(modelValue, (_modelValue) => {\n if (Array.isArray(_modelValue) && _modelValue.length) {\n const lastValue = _modelValue[_modelValue.length - 1]\n if (lastValue && !isEqualDay(placeholder.value, lastValue))\n onPlaceholderChange(lastValue)\n }\n else if (!Array.isArray(_modelValue) && _modelValue && !isEqualDay(placeholder.value, _modelValue)) {\n onPlaceholderChange(_modelValue)\n }\n})\n\nfunction onDateChange(value: DateValue) {\n if (!multiple.value) {\n if (!modelValue.value) {\n modelValue.value = value.copy()\n return\n }\n\n if (!preventDeselect.value && isEqualDay(modelValue.value as DateValue, value)) {\n placeholder.value = value.copy()\n modelValue.value = undefined\n }\n else { modelValue.value = value.copy() }\n }\n else if (!modelValue.value) {\n modelValue.value = [value.copy()]\n }\n else if (Array.isArray(modelValue.value)) {\n const index = modelValue.value.findIndex(date => isSameDay(date, value))\n if (index === -1) {\n modelValue.value = [...modelValue.value, value]\n }\n else if (!preventDeselect.value) {\n const next = modelValue.value.filter(date => !isSameDay(date, value))\n if (!next.length) {\n placeholder.value = value.copy()\n modelValue.value = undefined\n return\n }\n modelValue.value = next.map(date => date.copy())\n }\n }\n}\n\nonMounted(() => {\n if (initialFocus.value)\n handleCalendarInitialFocus(parentElement.value)\n})\n\nprovideCalendarRootContext({\n isDateUnavailable,\n dir,\n isDateDisabled,\n locale,\n formatter,\n modelValue,\n placeholder,\n disabled,\n initialFocus,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n multiple,\n numberOfMonths,\n readonly,\n preventDeselect,\n fullCalendarLabel,\n headingValue,\n isInvalid,\n isDateSelected,\n isNextButtonDisabled,\n isPrevButtonDisabled,\n isOutsideVisibleView,\n nextPage,\n prevPage,\n parentElement,\n onPlaceholderChange,\n onDateChange,\n})\n</script>\n\n<template>\n <Primitive\n ref=\"primitiveElement\"\n :as=\"as\"\n :as-child=\"asChild\"\n role=\"application\"\n :aria-label=\"fullCalendarLabel\"\n :data-readonly=\"readonly ? '' : undefined\"\n :data-disabled=\"disabled ? '' : undefined\"\n :data-invalid=\"isInvalid ? '' : undefined\"\n :dir=\"dir\"\n >\n <slot\n :date=\"placeholder\"\n :grid=\"grid\"\n :week-days=\"weekdays\"\n :week-starts-on=\"weekStartsOn\"\n :locale=\"locale\"\n :fixed-weeks=\"fixedWeeks\"\n :model-value=\"modelValue\"\n />\n <div\n style=\"border: 0px; clip: rect(0px, 0px, 0px, 0px); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0px; position: absolute; white-space: nowrap; width: 1px;\"\n >\n <div\n role=\"heading\"\n aria-level=\"2\"\n >\n {{ fullCalendarLabel }}\n </div>\n </div>\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAgHO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/D,cAAmC,cAAc,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQrD,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAiBd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAkBd,IAAM,MAAA;AAAA,MACJ,QAAA;AAAA,MACA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require('../shared/useId.cjs');
5
5
  const Primitive_usePrimitiveElement = require('../Primitive/usePrimitiveElement.cjs');
6
6
  const Listbox_ListboxItem = require('../Listbox/ListboxItem.cjs');
7
+ const shared_createContext = require('../shared/createContext.cjs');
7
8
  const Combobox_ComboboxRoot = require('./ComboboxRoot.cjs');
8
9
  const Combobox_ComboboxGroup = require('./ComboboxGroup.cjs');
9
10
 
11
+ const [injectComboboxItemContext, provideComboboxItemContext] = shared_createContext.createContext("ComboboxItem");
10
12
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
11
13
  __name: "ComboboxItem",
12
14
  props: {
@@ -82,4 +84,5 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
82
84
  });
83
85
 
84
86
  exports._sfc_main = _sfc_main;
87
+ exports.injectComboboxItemContext = injectComboboxItemContext;
85
88
  //# sourceMappingURL=ComboboxItem.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxItem.cjs","sources":["../../src/Combobox/ComboboxItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { type Ref, computed, onMounted, onUnmounted } from 'vue'\nimport type { ListboxItemEmits, ListboxItemProps } from '@/Listbox'\nimport { createContext, useId } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\nimport type { AcceptableValue } from '@/shared/types'\nimport { injectComboboxGroupContext } from './ComboboxGroup.vue'\nimport { usePrimitiveElement } from '@/Primitive'\n\ninterface ComboboxItemContext {\n isSelected: Ref<boolean>\n}\n\nexport const [injectComboboxItemContext, provideComboboxItemContext]\n = createContext<ComboboxItemContext>('ComboboxItem')\n\nexport type ComboboxItemEmits<T = AcceptableValue> = ListboxItemEmits<T>\nexport interface ComboboxItemProps<T = AcceptableValue> extends ListboxItemProps<T> {\n /**\n * A string representation of the item contents.\n *\n * If the children are not plain text, then the `textValue` prop must also be set to a plain text representation, which will be used for autocomplete in the ComboBox.\n */\n textValue?: string\n}\n</script>\n\n<script setup lang=\"ts\" generic=\"T extends AcceptableValue = AcceptableValue\">\nimport { ListboxItem } from '@/Listbox'\n\nconst props = defineProps<ComboboxItemProps<T>>()\nconst emits = defineEmits<ComboboxItemEmits<T>>()\n\nconst id = useId(undefined, 'reka-combobox-item')\nconst rootContext = injectComboboxRootContext()\nconst groupContext = injectComboboxGroupContext(null)\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nif (props.value === '') {\n throw new Error(\n 'A <ComboboxItem /> must have a value prop that is not an empty string. This is because the Combobox value can be set to an empty string to clear the selection and show the placeholder.',\n )\n}\n\nconst isRender = computed(() => {\n if (rootContext.isVirtual.value || rootContext.ignoreFilter.value || !rootContext.filterState.search) {\n return true\n }\n else {\n const filteredCurrentItem = rootContext.filterState.filtered.items.get(id)\n // If the filtered items is undefined means not in the all times map yet\n // Do the first render to add into the map\n if (filteredCurrentItem === undefined) {\n return true\n }\n\n // Check with filter\n return filteredCurrentItem > 0\n }\n})\n\nonMounted(() => {\n // textValue to perform filter\n rootContext.allItems.value.set(id, props.textValue || currentElement.value.textContent || currentElement.value.innerText)\n\n const groupId = groupContext?.id\n if (groupId) {\n if (!rootContext.allGroups.value.has(groupId)) {\n rootContext.allGroups.value.set(groupId, new Set([id]))\n }\n else {\n rootContext.allGroups.value.get(groupId)?.add(id)\n }\n }\n})\nonUnmounted(() => {\n rootContext.allItems.value.delete(id)\n})\n</script>\n\n<template>\n <ListboxItem\n v-if=\"isRender\"\n v-bind=\"props\"\n :id=\"id\"\n ref=\"primitiveElement\"\n @select=\"(event) => {\n emits('select', event as any)\n if (event.defaultPrevented)\n return\n\n if (!rootContext.multiple.value) {\n event.preventDefault()\n rootContext.onOpenChange(false)\n rootContext.modelValue.value = props.value\n }\n }\"\n >\n <slot>{{ value }}</slot>\n </ListboxItem>\n</template>\n"],"names":["useId","injectComboboxRootContext","injectComboboxGroupContext","usePrimitiveElement","computed","onMounted","onUnmounted"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;A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SAAA,CAAU,KAAM,CAAA,GAAA,CAAI,OAAO,CAAG,EAAA;AAC7C,UAAY,WAAA,CAAA,SAAA,CAAU,MAAM,GAAI,CAAA,OAAA,sBAAa,GAAI,CAAA,CAAC,EAAE,CAAC,CAAC,CAAA,CAAA;AAAA,SAEnD,MAAA;AACH,UAAA,WAAA,CAAY,UAAU,KAAM,CAAA,GAAA,CAAI,OAAO,CAAA,EAAG,IAAI,EAAE,CAAA,CAAA;AAAA,SAClD;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AACD,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAY,WAAA,CAAA,QAAA,CAAS,KAAM,CAAA,MAAA,CAAO,EAAE,CAAA,CAAA;AAAA,KACrC,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ComboboxItem.cjs","sources":["../../src/Combobox/ComboboxItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { type Ref, computed, onMounted, onUnmounted } from 'vue'\nimport type { ListboxItemEmits, ListboxItemProps } from '@/Listbox'\nimport { createContext, useId } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\nimport type { AcceptableValue } from '@/shared/types'\nimport { injectComboboxGroupContext } from './ComboboxGroup.vue'\nimport { usePrimitiveElement } from '@/Primitive'\n\ninterface ComboboxItemContext {\n isSelected: Ref<boolean>\n}\n\nexport const [injectComboboxItemContext, provideComboboxItemContext]\n = createContext<ComboboxItemContext>('ComboboxItem')\n\nexport type ComboboxItemEmits<T = AcceptableValue> = ListboxItemEmits<T>\nexport interface ComboboxItemProps<T = AcceptableValue> extends ListboxItemProps<T> {\n /**\n * A string representation of the item contents.\n *\n * If the children are not plain text, then the `textValue` prop must also be set to a plain text representation, which will be used for autocomplete in the ComboBox.\n */\n textValue?: string\n}\n</script>\n\n<script setup lang=\"ts\" generic=\"T extends AcceptableValue = AcceptableValue\">\nimport { ListboxItem } from '@/Listbox'\n\nconst props = defineProps<ComboboxItemProps<T>>()\nconst emits = defineEmits<ComboboxItemEmits<T>>()\n\nconst id = useId(undefined, 'reka-combobox-item')\nconst rootContext = injectComboboxRootContext()\nconst groupContext = injectComboboxGroupContext(null)\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nif (props.value === '') {\n throw new Error(\n 'A <ComboboxItem /> must have a value prop that is not an empty string. This is because the Combobox value can be set to an empty string to clear the selection and show the placeholder.',\n )\n}\n\nconst isRender = computed(() => {\n if (rootContext.isVirtual.value || rootContext.ignoreFilter.value || !rootContext.filterState.search) {\n return true\n }\n else {\n const filteredCurrentItem = rootContext.filterState.filtered.items.get(id)\n // If the filtered items is undefined means not in the all times map yet\n // Do the first render to add into the map\n if (filteredCurrentItem === undefined) {\n return true\n }\n\n // Check with filter\n return filteredCurrentItem > 0\n }\n})\n\nonMounted(() => {\n // textValue to perform filter\n rootContext.allItems.value.set(id, props.textValue || currentElement.value.textContent || currentElement.value.innerText)\n\n const groupId = groupContext?.id\n if (groupId) {\n if (!rootContext.allGroups.value.has(groupId)) {\n rootContext.allGroups.value.set(groupId, new Set([id]))\n }\n else {\n rootContext.allGroups.value.get(groupId)?.add(id)\n }\n }\n})\nonUnmounted(() => {\n rootContext.allItems.value.delete(id)\n})\n</script>\n\n<template>\n <ListboxItem\n v-if=\"isRender\"\n v-bind=\"props\"\n :id=\"id\"\n ref=\"primitiveElement\"\n @select=\"(event) => {\n emits('select', event as any)\n if (event.defaultPrevented)\n return\n\n if (!rootContext.multiple.value) {\n event.preventDefault()\n rootContext.onOpenChange(false)\n rootContext.modelValue.value = props.value\n }\n }\"\n >\n <slot>{{ value }}</slot>\n </ListboxItem>\n</template>\n"],"names":["createContext","useId","injectComboboxRootContext","injectComboboxGroupContext","usePrimitiveElement","computed","onMounted","onUnmounted"],"mappings":";;;;;;;;;;AAaO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/DA,mCAAmC,cAAc,EAAA;;;;;;;;;;;;AAgBrD,IAAA,MAAM,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A,IAAI,CAAC,WAAY,CAAA,SAAA,CAAU,KAAM,CAAA,GAAA,CAAI,OAAO,CAAG,EAAA;AAC7C,UAAY,WAAA,CAAA,SAAA,CAAU,MAAM,GAAI,CAAA,OAAA,sBAAa,GAAI,CAAA,CAAC,EAAE,CAAC,CAAC,CAAA,CAAA;AAAA,SAEnD,MAAA;AACH,UAAA,WAAA,CAAY,UAAU,KAAM,CAAA,GAAA,CAAI,OAAO,CAAA,EAAG,IAAI,EAAE,CAAA,CAAA;AAAA,SAClD;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AACD,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAY,WAAA,CAAA,QAAA,CAAS,KAAM,CAAA,MAAA,CAAO,EAAE,CAAA,CAAA;AAAA,KACrC,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -2,9 +2,11 @@ import { defineComponent, computed, onMounted, onUnmounted, openBlock, createBlo
2
2
  import { u as useId } from '../shared/useId.js';
3
3
  import { u as usePrimitiveElement } from '../Primitive/usePrimitiveElement.js';
4
4
  import { _ as _sfc_main$1 } from '../Listbox/ListboxItem.js';
5
+ import { c as createContext } from '../shared/createContext.js';
5
6
  import { i as injectComboboxRootContext } from './ComboboxRoot.js';
6
7
  import { i as injectComboboxGroupContext } from './ComboboxGroup.js';
7
8
 
9
+ const [injectComboboxItemContext, provideComboboxItemContext] = createContext("ComboboxItem");
8
10
  const _sfc_main = /* @__PURE__ */ defineComponent({
9
11
  __name: "ComboboxItem",
10
12
  props: {
@@ -79,5 +81,5 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
79
81
  }
80
82
  });
81
83
 
82
- export { _sfc_main as _ };
84
+ export { _sfc_main as _, injectComboboxItemContext as i };
83
85
  //# sourceMappingURL=ComboboxItem.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxItem.js","sources":["../../src/Combobox/ComboboxItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { type Ref, computed, onMounted, onUnmounted } from 'vue'\nimport type { ListboxItemEmits, ListboxItemProps } from '@/Listbox'\nimport { createContext, useId } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\nimport type { AcceptableValue } from '@/shared/types'\nimport { injectComboboxGroupContext } from './ComboboxGroup.vue'\nimport { usePrimitiveElement } from '@/Primitive'\n\ninterface ComboboxItemContext {\n isSelected: Ref<boolean>\n}\n\nexport const [injectComboboxItemContext, provideComboboxItemContext]\n = createContext<ComboboxItemContext>('ComboboxItem')\n\nexport type ComboboxItemEmits<T = AcceptableValue> = ListboxItemEmits<T>\nexport interface ComboboxItemProps<T = AcceptableValue> extends ListboxItemProps<T> {\n /**\n * A string representation of the item contents.\n *\n * If the children are not plain text, then the `textValue` prop must also be set to a plain text representation, which will be used for autocomplete in the ComboBox.\n */\n textValue?: string\n}\n</script>\n\n<script setup lang=\"ts\" generic=\"T extends AcceptableValue = AcceptableValue\">\nimport { ListboxItem } from '@/Listbox'\n\nconst props = defineProps<ComboboxItemProps<T>>()\nconst emits = defineEmits<ComboboxItemEmits<T>>()\n\nconst id = useId(undefined, 'reka-combobox-item')\nconst rootContext = injectComboboxRootContext()\nconst groupContext = injectComboboxGroupContext(null)\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nif (props.value === '') {\n throw new Error(\n 'A <ComboboxItem /> must have a value prop that is not an empty string. This is because the Combobox value can be set to an empty string to clear the selection and show the placeholder.',\n )\n}\n\nconst isRender = computed(() => {\n if (rootContext.isVirtual.value || rootContext.ignoreFilter.value || !rootContext.filterState.search) {\n return true\n }\n else {\n const filteredCurrentItem = rootContext.filterState.filtered.items.get(id)\n // If the filtered items is undefined means not in the all times map yet\n // Do the first render to add into the map\n if (filteredCurrentItem === undefined) {\n return true\n }\n\n // Check with filter\n return filteredCurrentItem > 0\n }\n})\n\nonMounted(() => {\n // textValue to perform filter\n rootContext.allItems.value.set(id, props.textValue || currentElement.value.textContent || currentElement.value.innerText)\n\n const groupId = groupContext?.id\n if (groupId) {\n if (!rootContext.allGroups.value.has(groupId)) {\n rootContext.allGroups.value.set(groupId, new Set([id]))\n }\n else {\n rootContext.allGroups.value.get(groupId)?.add(id)\n }\n }\n})\nonUnmounted(() => {\n rootContext.allItems.value.delete(id)\n})\n</script>\n\n<template>\n <ListboxItem\n v-if=\"isRender\"\n v-bind=\"props\"\n :id=\"id\"\n ref=\"primitiveElement\"\n @select=\"(event) => {\n emits('select', event as any)\n if (event.defaultPrevented)\n return\n\n if (!rootContext.multiple.value) {\n event.preventDefault()\n rootContext.onOpenChange(false)\n rootContext.modelValue.value = props.value\n }\n }\"\n >\n <slot>{{ value }}</slot>\n </ListboxItem>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AA8BA,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAEd,IAAM,MAAA,EAAA,GAAK,KAAM,CAAA,KAAA,CAAA,EAAW,oBAAoB,CAAA,CAAA;AAChD,IAAA,MAAM,cAAc,yBAA0B,EAAA,CAAA;AAC9C,IAAM,MAAA,YAAA,GAAe,2BAA2B,IAAI,CAAA,CAAA;AAEpD,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAe,EAAA,GAAI,mBAAoB,EAAA,CAAA;AAEjE,IAAI,IAAA,KAAA,CAAM,UAAU,EAAI,EAAA;AACtB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,0LAAA;AAAA,OACF,CAAA;AAAA,KACF;AAEA,IAAM,MAAA,QAAA,GAAW,SAAS,MAAM;AAC9B,MAAI,IAAA,WAAA,CAAY,UAAU,KAAS,IAAA,WAAA,CAAY,aAAa,KAAS,IAAA,CAAC,WAAY,CAAA,WAAA,CAAY,MAAQ,EAAA;AACpG,QAAO,OAAA,IAAA,CAAA;AAAA,OAEJ,MAAA;AACH,QAAA,MAAM,sBAAsB,WAAY,CAAA,WAAA,CAAY,QAAS,CAAA,KAAA,CAAM,IAAI,EAAE,CAAA,CAAA;AAGzE,QAAA,IAAI,wBAAwB,KAAW,CAAA,EAAA;AACrC,UAAO,OAAA,IAAA,CAAA;AAAA,SACT;AAGA,QAAA,OAAO,mBAAsB,GAAA,CAAA,CAAA;AAAA,OAC/B;AAAA,KACD,CAAA,CAAA;AAED,IAAA,SAAA,CAAU,MAAM;AAEd,MAAY,WAAA,CAAA,QAAA,CAAS,KAAM,CAAA,GAAA,CAAI,EAAI,EAAA,KAAA,CAAM,SAAa,IAAA,cAAA,CAAe,KAAM,CAAA,WAAA,IAAe,cAAe,CAAA,KAAA,CAAM,SAAS,CAAA,CAAA;AAExH,MAAA,MAAM,UAAU,YAAc,EAAA,EAAA,CAAA;AAC9B,MAAA,IAAI,OAAS,EAAA;AACX,QAAA,IAAI,CAAC,WAAY,CAAA,SAAA,CAAU,KAAM,CAAA,GAAA,CAAI,OAAO,CAAG,EAAA;AAC7C,UAAY,WAAA,CAAA,SAAA,CAAU,MAAM,GAAI,CAAA,OAAA,sBAAa,GAAI,CAAA,CAAC,EAAE,CAAC,CAAC,CAAA,CAAA;AAAA,SAEnD,MAAA;AACH,UAAA,WAAA,CAAY,UAAU,KAAM,CAAA,GAAA,CAAI,OAAO,CAAA,EAAG,IAAI,EAAE,CAAA,CAAA;AAAA,SAClD;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AACD,IAAA,WAAA,CAAY,MAAM;AAChB,MAAY,WAAA,CAAA,QAAA,CAAS,KAAM,CAAA,MAAA,CAAO,EAAE,CAAA,CAAA;AAAA,KACrC,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ComboboxItem.js","sources":["../../src/Combobox/ComboboxItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { type Ref, computed, onMounted, onUnmounted } from 'vue'\nimport type { ListboxItemEmits, ListboxItemProps } from '@/Listbox'\nimport { createContext, useId } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\nimport type { AcceptableValue } from '@/shared/types'\nimport { injectComboboxGroupContext } from './ComboboxGroup.vue'\nimport { usePrimitiveElement } from '@/Primitive'\n\ninterface ComboboxItemContext {\n isSelected: Ref<boolean>\n}\n\nexport const [injectComboboxItemContext, provideComboboxItemContext]\n = createContext<ComboboxItemContext>('ComboboxItem')\n\nexport type ComboboxItemEmits<T = AcceptableValue> = ListboxItemEmits<T>\nexport interface ComboboxItemProps<T = AcceptableValue> extends ListboxItemProps<T> {\n /**\n * A string representation of the item contents.\n *\n * If the children are not plain text, then the `textValue` prop must also be set to a plain text representation, which will be used for autocomplete in the ComboBox.\n */\n textValue?: string\n}\n</script>\n\n<script setup lang=\"ts\" generic=\"T extends AcceptableValue = AcceptableValue\">\nimport { ListboxItem } from '@/Listbox'\n\nconst props = defineProps<ComboboxItemProps<T>>()\nconst emits = defineEmits<ComboboxItemEmits<T>>()\n\nconst id = useId(undefined, 'reka-combobox-item')\nconst rootContext = injectComboboxRootContext()\nconst groupContext = injectComboboxGroupContext(null)\n\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nif (props.value === '') {\n throw new Error(\n 'A <ComboboxItem /> must have a value prop that is not an empty string. This is because the Combobox value can be set to an empty string to clear the selection and show the placeholder.',\n )\n}\n\nconst isRender = computed(() => {\n if (rootContext.isVirtual.value || rootContext.ignoreFilter.value || !rootContext.filterState.search) {\n return true\n }\n else {\n const filteredCurrentItem = rootContext.filterState.filtered.items.get(id)\n // If the filtered items is undefined means not in the all times map yet\n // Do the first render to add into the map\n if (filteredCurrentItem === undefined) {\n return true\n }\n\n // Check with filter\n return filteredCurrentItem > 0\n }\n})\n\nonMounted(() => {\n // textValue to perform filter\n rootContext.allItems.value.set(id, props.textValue || currentElement.value.textContent || currentElement.value.innerText)\n\n const groupId = groupContext?.id\n if (groupId) {\n if (!rootContext.allGroups.value.has(groupId)) {\n rootContext.allGroups.value.set(groupId, new Set([id]))\n }\n else {\n rootContext.allGroups.value.get(groupId)?.add(id)\n }\n }\n})\nonUnmounted(() => {\n rootContext.allItems.value.delete(id)\n})\n</script>\n\n<template>\n <ListboxItem\n v-if=\"isRender\"\n v-bind=\"props\"\n :id=\"id\"\n ref=\"primitiveElement\"\n @select=\"(event) => {\n emits('select', event as any)\n if (event.defaultPrevented)\n return\n\n if (!rootContext.multiple.value) {\n event.preventDefault()\n rootContext.onOpenChange(false)\n rootContext.modelValue.value = props.value\n }\n }\"\n >\n <slot>{{ value }}</slot>\n </ListboxItem>\n</template>\n"],"names":[],"mappings":";;;;;;;;AAaO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/D,cAAmC,cAAc,EAAA;;;;;;;;;;;;AAgBrD,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAEd,IAAM,MAAA,EAAA,GAAK,KAAM,CAAA,KAAA,CAAA,EAAW,oBAAoB,CAAA,CAAA;AAChD,IAAA,MAAM,cAAc,yBAA0B,EAAA,CAAA;AAC9C,IAAM,MAAA,YAAA,GAAe,2BAA2B,IAAI,CAAA,CAAA;AAEpD,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAe,EAAA,GAAI,mBAAoB,EAAA,CAAA;AAEjE,IAAI,IAAA,KAAA,CAAM,UAAU,EAAI,EAAA;AACtB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR,0LAAA;AAAA,OACF,CAAA;AAAA,KACF;AAEA,IAAM,MAAA,QAAA,GAAW,SAAS,MAAM;AAC9B,MAAI,IAAA,WAAA,CAAY,UAAU,KAAS,IAAA,WAAA,CAAY,aAAa,KAAS,IAAA,CAAC,WAAY,CAAA,WAAA,CAAY,MAAQ,EAAA;AACpG,QAAO,OAAA,IAAA,CAAA;AAAA,OAEJ,MAAA;AACH,QAAA,MAAM,sBAAsB,WAAY,CAAA,WAAA,CAAY,QAAS,CAAA,KAAA,CAAM,IAAI,EAAE,CAAA,CAAA;AAGzE,QAAA,IAAI,wBAAwB,KAAW,CAAA,EAAA;AACrC,UAAO,OAAA,IAAA,CAAA;AAAA,SACT;AAGA,QAAA,OAAO,mBAAsB,GAAA,CAAA,CAAA;AAAA,OAC/B;AAAA,KACD,CAAA,CAAA;AAED,IAAA,SAAA,CAAU,MAAM;AAEd,MAAY,WAAA,CAAA,QAAA,CAAS,KAAM,CAAA,GAAA,CAAI,EAAI,EAAA,KAAA,CAAM,SAAa,IAAA,cAAA,CAAe,KAAM,CAAA,WAAA,IAAe,cAAe,CAAA,KAAA,CAAM,SAAS,CAAA,CAAA;AAExH,MAAA,MAAM,UAAU,YAAc,EAAA,EAAA,CAAA;AAC9B,MAAA,IAAI,OAAS,EAAA;AACX,QAAA,IAAI,CAAC,WAAY,CAAA,SAAA,CAAU,KAAM,CAAA,GAAA,CAAI,OAAO,CAAG,EAAA;AAC7C,UAAY,WAAA,CAAA,SAAA,CAAU,MAAM,GAAI,CAAA,OAAA,sBAAa,GAAI,CAAA,CAAC,EAAE,CAAC,CAAC,CAAA,CAAA;AAAA,SAEnD,MAAA;AACH,UAAA,WAAA,CAAY,UAAU,KAAM,CAAA,GAAA,CAAI,OAAO,CAAA,EAAG,IAAI,EAAE,CAAA,CAAA;AAAA,SAClD;AAAA,OACF;AAAA,KACD,CAAA,CAAA;AACD,IAAA,WAAA,CAAY,MAAM;AAChB,MAAY,WAAA,CAAA,QAAA,CAAS,KAAM,CAAA,MAAA,CAAO,EAAE,CAAA,CAAA;AAAA,KACrC,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -50,6 +50,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
50
50
  open.value = val;
51
51
  filterState.search = "";
52
52
  if (val) {
53
+ await vue.nextTick();
53
54
  primitiveElement.value?.highlightSelected();
54
55
  isUserInputted.value = true;
55
56
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxRoot.cjs","sources":["../../src/Combobox/ComboboxRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ListboxRootProps } from '@/Listbox'\nimport { createContext, useDirection, useFilter } from '@/shared'\nimport { usePrimitiveElement } from '@/Primitive'\nimport type { AcceptableValue, GenericComponentInstance } from '@/shared/types'\n\ntype ComboboxRootContext<T> = {\n modelValue: Ref<T | Array<T>>\n multiple: Ref<boolean>\n disabled: Ref<boolean>\n open: Ref<boolean>\n onOpenChange: (value: boolean) => void\n isUserInputted: Ref<boolean>\n isVirtual: Ref<boolean>\n contentId: string\n inputElement: Ref<HTMLInputElement | undefined>\n onInputElementChange: (el: HTMLInputElement) => void\n triggerElement: Ref<HTMLElement | undefined>\n onTriggerElementChange: (el: HTMLElement) => void\n highlightedElement: Ref<HTMLElement | undefined>\n parentElement: Ref<HTMLElement | undefined>\n onResetSearchTerm: EventHookOn\n allItems: Ref<Map<string, string>>\n allGroups: Ref<Map<string, Set<string>>>\n filterState: {\n search: string\n filtered: { count: number, items: Map<string, number>, groups: Set<string> }\n }\n ignoreFilter: Ref<boolean>\n}\n\nexport const [injectComboboxRootContext, provideComboboxRootContext]\n = createContext<ComboboxRootContext<AcceptableValue>>('ComboboxRoot')\n\nexport type ComboboxRootEmits<T = AcceptableValue> = {\n /** Event handler called when the value changes. */\n 'update:modelValue': [value: T]\n /** Event handler when highlighted element changes. */\n 'highlight': [payload: { ref: HTMLElement, value: T } | undefined]\n /** Event handler called when the open state of the combobox changes. */\n 'update:open': [value: boolean]\n}\n\nexport interface ComboboxRootProps<T = AcceptableValue> extends Omit<ListboxRootProps<T>, 'orientation' | 'selectionBehavior' > {\n /** The controlled open state of the Combobox. Can be binded with with `v-model:open`. */\n open?: boolean\n /** The open state of the combobox when it is initially rendered. <br> Use when you do not need to control its open state. */\n defaultOpen?: boolean\n /**\n * Whether to reset the searchTerm when the Combobox input blurred\n * @defaultValue `true`\n */\n resetSearchTermOnBlur?: boolean\n /**\n * When `true`, disable the default filters\n */\n ignoreFilter?: boolean\n}\n</script>\n\n<script setup lang=\"ts\" generic=\"T extends AcceptableValue = AcceptableValue\">\nimport { computed, nextTick, reactive, ref, toRefs, watch } from 'vue'\nimport { PopperRoot } from '@/Popper'\nimport { type EventHookOn, createEventHook, useVModel } from '@vueuse/core'\nimport { ListboxRoot } from '@/Listbox'\n\nconst props = withDefaults(defineProps<ComboboxRootProps<T>>(), {\n open: undefined,\n resetSearchTermOnBlur: true,\n})\nconst emits = defineEmits<ComboboxRootEmits<T>>()\n\ndefineSlots<{\n default: (props: {\n /** Current open state */\n open: typeof open.value\n /** Current active value */\n modelValue: typeof modelValue.value\n }) => any\n}>()\n\nconst { primitiveElement, currentElement: parentElement } = usePrimitiveElement<GenericComponentInstance<typeof ListboxRoot>>()\nconst { multiple, disabled, ignoreFilter, dir: propDir } = toRefs(props)\n\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n // @ts-expect-error ignore the type error here\n defaultValue: props.defaultValue ?? multiple.value ? [] : undefined,\n passive: (props.modelValue === undefined) as false,\n deep: true,\n}) as Ref<T | T[]>\n\nconst open = useVModel(props, 'open', emits, {\n defaultValue: props.defaultOpen,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n\nasync function onOpenChange(val: boolean) {\n open.value = val\n filterState.search = ''\n\n if (val) {\n primitiveElement.value?.highlightSelected()\n isUserInputted.value = true\n }\n else {\n isUserInputted.value = false\n }\n\n inputElement.value?.focus()\n setTimeout(() => {\n if (!val && props.resetSearchTermOnBlur)\n resetSearchTerm.trigger()\n }, 1)\n}\n\nconst resetSearchTerm = createEventHook()\nconst isUserInputted = ref(false)\nconst isVirtual = ref(false)\nconst inputElement = ref<HTMLInputElement>()\nconst triggerElement = ref<HTMLElement>()\n\nconst highlightedElement = computed(() => primitiveElement.value?.highlightedElement ?? undefined)\n\nconst allItems = ref<Map<string, string>>(new Map())\nconst allGroups = ref<Map<string, Set<string>>>(new Map())\n\nconst { contains } = useFilter({ sensitivity: 'base' })\nconst filterState = reactive({\n search: '',\n filtered: {\n /** The count of all visible items. */\n count: 0,\n /** Map from visible item id to its search score. */\n items: new Map() as Map<string, number>,\n /** Set of groups with at least one visible item. */\n groups: new Set() as Set<string>,\n },\n})\n\nfunction filterItems() {\n if (!filterState.search || props.ignoreFilter || isVirtual.value) {\n filterState.filtered.count = allItems.value.size\n // Do nothing, each item will know to show itself because search is empty\n return\n }\n\n // Reset the groups\n filterState.filtered.groups = new Set()\n let itemCount = 0\n\n // Check which items should be included\n for (const [id, value] of allItems.value) {\n const score = contains(value, filterState.search)\n filterState.filtered.items.set(id, score ? 1 : 0)\n if (score)\n itemCount++\n }\n\n // Check which groups have at least 1 item shown\n for (const [groupId, group] of allGroups.value) {\n for (const itemId of group) {\n if (filterState.filtered.items.get(itemId)! > 0) {\n filterState.filtered.groups.add(groupId)\n break\n }\n }\n }\n\n filterState.filtered.count = itemCount\n}\n\nwatch([() => filterState.search, () => allItems.value.size], () => {\n filterItems()\n}, { immediate: true })\n\nwatch(() => open.value, () => {\n // nextTick to allow multiple items to be mounted first\n nextTick(() => {\n if (open.value)\n filterItems()\n })\n}, { flush: 'post' })\n\ndefineExpose({\n filtered: computed(() => filterState.filtered),\n highlightedElement,\n highlightItem: primitiveElement.value?.highlightItem,\n highlightFirstItem: primitiveElement.value?.highlightFirstItem,\n highlightSelected: primitiveElement.value?.highlightSelected,\n})\n\nprovideComboboxRootContext({\n modelValue,\n multiple,\n disabled,\n open,\n onOpenChange,\n contentId: '',\n isUserInputted,\n isVirtual,\n inputElement,\n highlightedElement,\n onInputElementChange: val => inputElement.value = val,\n triggerElement,\n onTriggerElementChange: val => triggerElement.value = val,\n parentElement,\n onResetSearchTerm: resetSearchTerm.on,\n allItems,\n allGroups,\n filterState,\n ignoreFilter,\n})\n</script>\n\n<template>\n <PopperRoot>\n <ListboxRoot\n ref=\"primitiveElement\"\n v-bind=\"$attrs\"\n v-model=\"modelValue\"\n :style=\"{\n pointerEvents: open ? 'auto' : undefined,\n }\"\n :as=\"as\"\n :as-child=\"asChild\"\n :dir=\"dir\"\n :multiple=\"multiple\"\n :name=\"name\"\n :required=\"required\"\n :disabled=\"disabled\"\n :highlight-on-hover=\"true\"\n @highlight=\"emits('highlight', $event as any)\"\n >\n <slot\n :open=\"open\"\n :model-value=\"modelValue\"\n />\n </ListboxRoot>\n </PopperRoot>\n</template>\n"],"names":["createContext","usePrimitiveElement","toRefs","useDirection","useVModel","createEventHook","ref","computed","useFilter","reactive","watch","nextTick"],"mappings":";;;;;;;;;;;AAgCO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/DA,mCAAoD,cAAc,EAAA;;;;;;;;;;;;;;;;;;;;;;AAkCtE,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAId,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAWd,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAgB,EAAA,aAAA,KAAkBC,iDAAkE,EAAA,CAAA;AAC9H,IAAM,MAAA,EAAE,UAAU,QAAU,EAAA,YAAA,EAAc,KAAK,OAAQ,EAAA,GAAIC,WAAO,KAAK,CAAA,CAAA;AAEvE,IAAM,MAAA,GAAA,GAAMC,iCAAa,OAAO,CAAA,CAAA;AAEhC,IAAA,MAAM,UAAa,GAAAC,cAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA;AAAA,MAEvD,cAAc,KAAM,CAAA,YAAA,IAAgB,QAAS,CAAA,KAAA,GAAQ,EAAK,GAAA,KAAA,CAAA;AAAA,MAC1D,OAAA,EAAU,MAAM,UAAe,KAAA,KAAA,CAAA;AAAA,MAC/B,IAAM,EAAA,IAAA;AAAA,KACP,CAAA,CAAA;AAED,IAAA,MAAM,IAAO,GAAAA,cAAA,CAAU,KAAO,EAAA,MAAA,EAAQ,KAAO,EAAA;AAAA,MAC3C,cAAc,KAAM,CAAA,WAAA;AAAA,MACpB,OAAA,EAAU,MAAM,IAAS,KAAA,KAAA,CAAA;AAAA,KAC1B,CAAA,CAAA;AAED,IAAA,eAAe,aAAa,GAAc,E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AAA,MACA,YAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ComboboxRoot.cjs","sources":["../../src/Combobox/ComboboxRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ListboxRootProps } from '@/Listbox'\nimport { createContext, useDirection, useFilter } from '@/shared'\nimport { usePrimitiveElement } from '@/Primitive'\nimport type { AcceptableValue, GenericComponentInstance } from '@/shared/types'\n\ntype ComboboxRootContext<T> = {\n modelValue: Ref<T | Array<T>>\n multiple: Ref<boolean>\n disabled: Ref<boolean>\n open: Ref<boolean>\n onOpenChange: (value: boolean) => void\n isUserInputted: Ref<boolean>\n isVirtual: Ref<boolean>\n contentId: string\n inputElement: Ref<HTMLInputElement | undefined>\n onInputElementChange: (el: HTMLInputElement) => void\n triggerElement: Ref<HTMLElement | undefined>\n onTriggerElementChange: (el: HTMLElement) => void\n highlightedElement: Ref<HTMLElement | undefined>\n parentElement: Ref<HTMLElement | undefined>\n onResetSearchTerm: EventHookOn\n allItems: Ref<Map<string, string>>\n allGroups: Ref<Map<string, Set<string>>>\n filterState: {\n search: string\n filtered: { count: number, items: Map<string, number>, groups: Set<string> }\n }\n ignoreFilter: Ref<boolean>\n}\n\nexport const [injectComboboxRootContext, provideComboboxRootContext]\n = createContext<ComboboxRootContext<AcceptableValue>>('ComboboxRoot')\n\nexport type ComboboxRootEmits<T = AcceptableValue> = {\n /** Event handler called when the value changes. */\n 'update:modelValue': [value: T]\n /** Event handler when highlighted element changes. */\n 'highlight': [payload: { ref: HTMLElement, value: T } | undefined]\n /** Event handler called when the open state of the combobox changes. */\n 'update:open': [value: boolean]\n}\n\nexport interface ComboboxRootProps<T = AcceptableValue> extends Omit<ListboxRootProps<T>, 'orientation' | 'selectionBehavior' > {\n /** The controlled open state of the Combobox. Can be binded with with `v-model:open`. */\n open?: boolean\n /** The open state of the combobox when it is initially rendered. <br> Use when you do not need to control its open state. */\n defaultOpen?: boolean\n /**\n * Whether to reset the searchTerm when the Combobox input blurred\n * @defaultValue `true`\n */\n resetSearchTermOnBlur?: boolean\n /**\n * When `true`, disable the default filters\n */\n ignoreFilter?: boolean\n}\n</script>\n\n<script setup lang=\"ts\" generic=\"T extends AcceptableValue = AcceptableValue\">\nimport { computed, nextTick, reactive, ref, toRefs, watch } from 'vue'\nimport { PopperRoot } from '@/Popper'\nimport { type EventHookOn, createEventHook, useVModel } from '@vueuse/core'\nimport { ListboxRoot } from '@/Listbox'\n\nconst props = withDefaults(defineProps<ComboboxRootProps<T>>(), {\n open: undefined,\n resetSearchTermOnBlur: true,\n})\nconst emits = defineEmits<ComboboxRootEmits<T>>()\n\ndefineSlots<{\n default: (props: {\n /** Current open state */\n open: typeof open.value\n /** Current active value */\n modelValue: typeof modelValue.value\n }) => any\n}>()\n\nconst { primitiveElement, currentElement: parentElement } = usePrimitiveElement<GenericComponentInstance<typeof ListboxRoot>>()\nconst { multiple, disabled, ignoreFilter, dir: propDir } = toRefs(props)\n\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n // @ts-expect-error ignore the type error here\n defaultValue: props.defaultValue ?? multiple.value ? [] : undefined,\n passive: (props.modelValue === undefined) as false,\n deep: true,\n}) as Ref<T | T[]>\n\nconst open = useVModel(props, 'open', emits, {\n defaultValue: props.defaultOpen,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n\nasync function onOpenChange(val: boolean) {\n open.value = val\n filterState.search = ''\n\n if (val) {\n // make sure dom is ready then only highlight the selected\n await nextTick()\n primitiveElement.value?.highlightSelected()\n isUserInputted.value = true\n }\n else {\n isUserInputted.value = false\n }\n\n inputElement.value?.focus()\n setTimeout(() => {\n if (!val && props.resetSearchTermOnBlur)\n resetSearchTerm.trigger()\n }, 1)\n}\n\nconst resetSearchTerm = createEventHook()\nconst isUserInputted = ref(false)\nconst isVirtual = ref(false)\nconst inputElement = ref<HTMLInputElement>()\nconst triggerElement = ref<HTMLElement>()\n\nconst highlightedElement = computed(() => primitiveElement.value?.highlightedElement ?? undefined)\n\nconst allItems = ref<Map<string, string>>(new Map())\nconst allGroups = ref<Map<string, Set<string>>>(new Map())\n\nconst { contains } = useFilter({ sensitivity: 'base' })\nconst filterState = reactive({\n search: '',\n filtered: {\n /** The count of all visible items. */\n count: 0,\n /** Map from visible item id to its search score. */\n items: new Map() as Map<string, number>,\n /** Set of groups with at least one visible item. */\n groups: new Set() as Set<string>,\n },\n})\n\nfunction filterItems() {\n if (!filterState.search || props.ignoreFilter || isVirtual.value) {\n filterState.filtered.count = allItems.value.size\n // Do nothing, each item will know to show itself because search is empty\n return\n }\n\n // Reset the groups\n filterState.filtered.groups = new Set()\n let itemCount = 0\n\n // Check which items should be included\n for (const [id, value] of allItems.value) {\n const score = contains(value, filterState.search)\n filterState.filtered.items.set(id, score ? 1 : 0)\n if (score)\n itemCount++\n }\n\n // Check which groups have at least 1 item shown\n for (const [groupId, group] of allGroups.value) {\n for (const itemId of group) {\n if (filterState.filtered.items.get(itemId)! > 0) {\n filterState.filtered.groups.add(groupId)\n break\n }\n }\n }\n\n filterState.filtered.count = itemCount\n}\n\nwatch([() => filterState.search, () => allItems.value.size], () => {\n filterItems()\n}, { immediate: true })\n\nwatch(() => open.value, () => {\n // nextTick to allow multiple items to be mounted first\n nextTick(() => {\n if (open.value)\n filterItems()\n })\n}, { flush: 'post' })\n\ndefineExpose({\n filtered: computed(() => filterState.filtered),\n highlightedElement,\n highlightItem: primitiveElement.value?.highlightItem,\n highlightFirstItem: primitiveElement.value?.highlightFirstItem,\n highlightSelected: primitiveElement.value?.highlightSelected,\n})\n\nprovideComboboxRootContext({\n modelValue,\n multiple,\n disabled,\n open,\n onOpenChange,\n contentId: '',\n isUserInputted,\n isVirtual,\n inputElement,\n highlightedElement,\n onInputElementChange: val => inputElement.value = val,\n triggerElement,\n onTriggerElementChange: val => triggerElement.value = val,\n parentElement,\n onResetSearchTerm: resetSearchTerm.on,\n allItems,\n allGroups,\n filterState,\n ignoreFilter,\n})\n</script>\n\n<template>\n <PopperRoot>\n <ListboxRoot\n ref=\"primitiveElement\"\n v-bind=\"$attrs\"\n v-model=\"modelValue\"\n :style=\"{\n pointerEvents: open ? 'auto' : undefined,\n }\"\n :as=\"as\"\n :as-child=\"asChild\"\n :dir=\"dir\"\n :multiple=\"multiple\"\n :name=\"name\"\n :required=\"required\"\n :disabled=\"disabled\"\n :highlight-on-hover=\"true\"\n @highlight=\"emits('highlight', $event as any)\"\n >\n <slot\n :open=\"open\"\n :model-value=\"modelValue\"\n />\n </ListboxRoot>\n </PopperRoot>\n</template>\n"],"names":["createContext","usePrimitiveElement","toRefs","useDirection","useVModel","nextTick","createEventHook","ref","computed","useFilter","reactive","watch"],"mappings":";;;;;;;;;;;AAgCO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/DA,mCAAoD,cAAc,EAAA;;;;;;;;;;;;;;;;;;;;;;AAkCtE,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAId,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAWd,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAgB,EAAA,aAAA,KAAkBC,iDAAkE,EAAA,CAAA;AAC9H,IAAM,MAAA,EAAE,UAAU,QAAU,EAAA,YAAA,EAAc,KAAK,OAAQ,EAAA,GAAIC,WAAO,KAAK,CAAA,CAAA;AAEvE,IAAM,MAAA,GAAA,GAAMC,iCAAa,OAAO,CAAA,CAAA;AAEhC,IAAA,MAAM,UAAa,GAAAC,cAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA;AAAA,MAEvD,cAAc,KAAM,CAAA,YAAA,IAAgB,QAAS,CAAA,KAAA,GAAQ,EAAK,GAAA,KAAA,CAAA;AAAA,MAC1D,OAAA,EAAU,MAAM,UAAe,KAAA,KAAA,CAAA;AAAA,MAC/B,IAAM,EAAA,IAAA;AAAA,KACP,CAAA,CAA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BAAA,EAAsB,CAAO,GAAA,KAAA,YAAA,CAAa,KAAQ,GAAA,GAAA;AAAA,MAClD,cAAA;AAAA,MACA,sBAAA,EAAwB,CAAO,GAAA,KAAA,cAAA,CAAe,KAAQ,GAAA,GAAA;AAAA,MACtD,aAAA;AAAA,MACA,mBAAmB,eAAgB,CAAA,EAAA;AAAA,MACnC,QAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -48,6 +48,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
48
48
  open.value = val;
49
49
  filterState.search = "";
50
50
  if (val) {
51
+ await nextTick();
51
52
  primitiveElement.value?.highlightSelected();
52
53
  isUserInputted.value = true;
53
54
  } else {
@@ -1 +1 @@
1
- {"version":3,"file":"ComboboxRoot.js","sources":["../../src/Combobox/ComboboxRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ListboxRootProps } from '@/Listbox'\nimport { createContext, useDirection, useFilter } from '@/shared'\nimport { usePrimitiveElement } from '@/Primitive'\nimport type { AcceptableValue, GenericComponentInstance } from '@/shared/types'\n\ntype ComboboxRootContext<T> = {\n modelValue: Ref<T | Array<T>>\n multiple: Ref<boolean>\n disabled: Ref<boolean>\n open: Ref<boolean>\n onOpenChange: (value: boolean) => void\n isUserInputted: Ref<boolean>\n isVirtual: Ref<boolean>\n contentId: string\n inputElement: Ref<HTMLInputElement | undefined>\n onInputElementChange: (el: HTMLInputElement) => void\n triggerElement: Ref<HTMLElement | undefined>\n onTriggerElementChange: (el: HTMLElement) => void\n highlightedElement: Ref<HTMLElement | undefined>\n parentElement: Ref<HTMLElement | undefined>\n onResetSearchTerm: EventHookOn\n allItems: Ref<Map<string, string>>\n allGroups: Ref<Map<string, Set<string>>>\n filterState: {\n search: string\n filtered: { count: number, items: Map<string, number>, groups: Set<string> }\n }\n ignoreFilter: Ref<boolean>\n}\n\nexport const [injectComboboxRootContext, provideComboboxRootContext]\n = createContext<ComboboxRootContext<AcceptableValue>>('ComboboxRoot')\n\nexport type ComboboxRootEmits<T = AcceptableValue> = {\n /** Event handler called when the value changes. */\n 'update:modelValue': [value: T]\n /** Event handler when highlighted element changes. */\n 'highlight': [payload: { ref: HTMLElement, value: T } | undefined]\n /** Event handler called when the open state of the combobox changes. */\n 'update:open': [value: boolean]\n}\n\nexport interface ComboboxRootProps<T = AcceptableValue> extends Omit<ListboxRootProps<T>, 'orientation' | 'selectionBehavior' > {\n /** The controlled open state of the Combobox. Can be binded with with `v-model:open`. */\n open?: boolean\n /** The open state of the combobox when it is initially rendered. <br> Use when you do not need to control its open state. */\n defaultOpen?: boolean\n /**\n * Whether to reset the searchTerm when the Combobox input blurred\n * @defaultValue `true`\n */\n resetSearchTermOnBlur?: boolean\n /**\n * When `true`, disable the default filters\n */\n ignoreFilter?: boolean\n}\n</script>\n\n<script setup lang=\"ts\" generic=\"T extends AcceptableValue = AcceptableValue\">\nimport { computed, nextTick, reactive, ref, toRefs, watch } from 'vue'\nimport { PopperRoot } from '@/Popper'\nimport { type EventHookOn, createEventHook, useVModel } from '@vueuse/core'\nimport { ListboxRoot } from '@/Listbox'\n\nconst props = withDefaults(defineProps<ComboboxRootProps<T>>(), {\n open: undefined,\n resetSearchTermOnBlur: true,\n})\nconst emits = defineEmits<ComboboxRootEmits<T>>()\n\ndefineSlots<{\n default: (props: {\n /** Current open state */\n open: typeof open.value\n /** Current active value */\n modelValue: typeof modelValue.value\n }) => any\n}>()\n\nconst { primitiveElement, currentElement: parentElement } = usePrimitiveElement<GenericComponentInstance<typeof ListboxRoot>>()\nconst { multiple, disabled, ignoreFilter, dir: propDir } = toRefs(props)\n\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n // @ts-expect-error ignore the type error here\n defaultValue: props.defaultValue ?? multiple.value ? [] : undefined,\n passive: (props.modelValue === undefined) as false,\n deep: true,\n}) as Ref<T | T[]>\n\nconst open = useVModel(props, 'open', emits, {\n defaultValue: props.defaultOpen,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n\nasync function onOpenChange(val: boolean) {\n open.value = val\n filterState.search = ''\n\n if (val) {\n primitiveElement.value?.highlightSelected()\n isUserInputted.value = true\n }\n else {\n isUserInputted.value = false\n }\n\n inputElement.value?.focus()\n setTimeout(() => {\n if (!val && props.resetSearchTermOnBlur)\n resetSearchTerm.trigger()\n }, 1)\n}\n\nconst resetSearchTerm = createEventHook()\nconst isUserInputted = ref(false)\nconst isVirtual = ref(false)\nconst inputElement = ref<HTMLInputElement>()\nconst triggerElement = ref<HTMLElement>()\n\nconst highlightedElement = computed(() => primitiveElement.value?.highlightedElement ?? undefined)\n\nconst allItems = ref<Map<string, string>>(new Map())\nconst allGroups = ref<Map<string, Set<string>>>(new Map())\n\nconst { contains } = useFilter({ sensitivity: 'base' })\nconst filterState = reactive({\n search: '',\n filtered: {\n /** The count of all visible items. */\n count: 0,\n /** Map from visible item id to its search score. */\n items: new Map() as Map<string, number>,\n /** Set of groups with at least one visible item. */\n groups: new Set() as Set<string>,\n },\n})\n\nfunction filterItems() {\n if (!filterState.search || props.ignoreFilter || isVirtual.value) {\n filterState.filtered.count = allItems.value.size\n // Do nothing, each item will know to show itself because search is empty\n return\n }\n\n // Reset the groups\n filterState.filtered.groups = new Set()\n let itemCount = 0\n\n // Check which items should be included\n for (const [id, value] of allItems.value) {\n const score = contains(value, filterState.search)\n filterState.filtered.items.set(id, score ? 1 : 0)\n if (score)\n itemCount++\n }\n\n // Check which groups have at least 1 item shown\n for (const [groupId, group] of allGroups.value) {\n for (const itemId of group) {\n if (filterState.filtered.items.get(itemId)! > 0) {\n filterState.filtered.groups.add(groupId)\n break\n }\n }\n }\n\n filterState.filtered.count = itemCount\n}\n\nwatch([() => filterState.search, () => allItems.value.size], () => {\n filterItems()\n}, { immediate: true })\n\nwatch(() => open.value, () => {\n // nextTick to allow multiple items to be mounted first\n nextTick(() => {\n if (open.value)\n filterItems()\n })\n}, { flush: 'post' })\n\ndefineExpose({\n filtered: computed(() => filterState.filtered),\n highlightedElement,\n highlightItem: primitiveElement.value?.highlightItem,\n highlightFirstItem: primitiveElement.value?.highlightFirstItem,\n highlightSelected: primitiveElement.value?.highlightSelected,\n})\n\nprovideComboboxRootContext({\n modelValue,\n multiple,\n disabled,\n open,\n onOpenChange,\n contentId: '',\n isUserInputted,\n isVirtual,\n inputElement,\n highlightedElement,\n onInputElementChange: val => inputElement.value = val,\n triggerElement,\n onTriggerElementChange: val => triggerElement.value = val,\n parentElement,\n onResetSearchTerm: resetSearchTerm.on,\n allItems,\n allGroups,\n filterState,\n ignoreFilter,\n})\n</script>\n\n<template>\n <PopperRoot>\n <ListboxRoot\n ref=\"primitiveElement\"\n v-bind=\"$attrs\"\n v-model=\"modelValue\"\n :style=\"{\n pointerEvents: open ? 'auto' : undefined,\n }\"\n :as=\"as\"\n :as-child=\"asChild\"\n :dir=\"dir\"\n :multiple=\"multiple\"\n :name=\"name\"\n :required=\"required\"\n :disabled=\"disabled\"\n :highlight-on-hover=\"true\"\n @highlight=\"emits('highlight', $event as any)\"\n >\n <slot\n :open=\"open\"\n :model-value=\"modelValue\"\n />\n </ListboxRoot>\n </PopperRoot>\n</template>\n"],"names":[],"mappings":";;;;;;;;;AAgCO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/D,cAAoD,cAAc,EAAA;;;;;;;;;;;;;;;;;;;;;;AAkCtE,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAId,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAWd,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAgB,EAAA,aAAA,KAAkB,mBAAkE,EAAA,CAAA;AAC9H,IAAM,MAAA,EAAE,UAAU,QAAU,EAAA,YAAA,EAAc,KAAK,OAAQ,EAAA,GAAI,OAAO,KAAK,CAAA,CAAA;AAEvE,IAAM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BAAiB,KAAO,EAAA,iBAAA;AAAA,KAC5C,CAAA,CAAA;AAED,IAA2B,0BAAA,CAAA;AAAA,MACzB,UAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAW,EAAA,EAAA;AAAA,MACX,cAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAA;AAAA,MACA,kBAAA;AAAA,MACA,oBAAA,EAAsB,CAAO,GAAA,KAAA,YAAA,CAAa,KAAQ,GAAA,GAAA;AAAA,MAClD,cAAA;AAAA,MACA,sBAAA,EAAwB,CAAO,GAAA,KAAA,cAAA,CAAe,KAAQ,GAAA,GAAA;AAAA,MACtD,aAAA;AAAA,MACA,mBAAmB,eAAgB,CAAA,EAAA;AAAA,MACnC,QAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ComboboxRoot.js","sources":["../../src/Combobox/ComboboxRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { Ref } from 'vue'\nimport type { ListboxRootProps } from '@/Listbox'\nimport { createContext, useDirection, useFilter } from '@/shared'\nimport { usePrimitiveElement } from '@/Primitive'\nimport type { AcceptableValue, GenericComponentInstance } from '@/shared/types'\n\ntype ComboboxRootContext<T> = {\n modelValue: Ref<T | Array<T>>\n multiple: Ref<boolean>\n disabled: Ref<boolean>\n open: Ref<boolean>\n onOpenChange: (value: boolean) => void\n isUserInputted: Ref<boolean>\n isVirtual: Ref<boolean>\n contentId: string\n inputElement: Ref<HTMLInputElement | undefined>\n onInputElementChange: (el: HTMLInputElement) => void\n triggerElement: Ref<HTMLElement | undefined>\n onTriggerElementChange: (el: HTMLElement) => void\n highlightedElement: Ref<HTMLElement | undefined>\n parentElement: Ref<HTMLElement | undefined>\n onResetSearchTerm: EventHookOn\n allItems: Ref<Map<string, string>>\n allGroups: Ref<Map<string, Set<string>>>\n filterState: {\n search: string\n filtered: { count: number, items: Map<string, number>, groups: Set<string> }\n }\n ignoreFilter: Ref<boolean>\n}\n\nexport const [injectComboboxRootContext, provideComboboxRootContext]\n = createContext<ComboboxRootContext<AcceptableValue>>('ComboboxRoot')\n\nexport type ComboboxRootEmits<T = AcceptableValue> = {\n /** Event handler called when the value changes. */\n 'update:modelValue': [value: T]\n /** Event handler when highlighted element changes. */\n 'highlight': [payload: { ref: HTMLElement, value: T } | undefined]\n /** Event handler called when the open state of the combobox changes. */\n 'update:open': [value: boolean]\n}\n\nexport interface ComboboxRootProps<T = AcceptableValue> extends Omit<ListboxRootProps<T>, 'orientation' | 'selectionBehavior' > {\n /** The controlled open state of the Combobox. Can be binded with with `v-model:open`. */\n open?: boolean\n /** The open state of the combobox when it is initially rendered. <br> Use when you do not need to control its open state. */\n defaultOpen?: boolean\n /**\n * Whether to reset the searchTerm when the Combobox input blurred\n * @defaultValue `true`\n */\n resetSearchTermOnBlur?: boolean\n /**\n * When `true`, disable the default filters\n */\n ignoreFilter?: boolean\n}\n</script>\n\n<script setup lang=\"ts\" generic=\"T extends AcceptableValue = AcceptableValue\">\nimport { computed, nextTick, reactive, ref, toRefs, watch } from 'vue'\nimport { PopperRoot } from '@/Popper'\nimport { type EventHookOn, createEventHook, useVModel } from '@vueuse/core'\nimport { ListboxRoot } from '@/Listbox'\n\nconst props = withDefaults(defineProps<ComboboxRootProps<T>>(), {\n open: undefined,\n resetSearchTermOnBlur: true,\n})\nconst emits = defineEmits<ComboboxRootEmits<T>>()\n\ndefineSlots<{\n default: (props: {\n /** Current open state */\n open: typeof open.value\n /** Current active value */\n modelValue: typeof modelValue.value\n }) => any\n}>()\n\nconst { primitiveElement, currentElement: parentElement } = usePrimitiveElement<GenericComponentInstance<typeof ListboxRoot>>()\nconst { multiple, disabled, ignoreFilter, dir: propDir } = toRefs(props)\n\nconst dir = useDirection(propDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n // @ts-expect-error ignore the type error here\n defaultValue: props.defaultValue ?? multiple.value ? [] : undefined,\n passive: (props.modelValue === undefined) as false,\n deep: true,\n}) as Ref<T | T[]>\n\nconst open = useVModel(props, 'open', emits, {\n defaultValue: props.defaultOpen,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n\nasync function onOpenChange(val: boolean) {\n open.value = val\n filterState.search = ''\n\n if (val) {\n // make sure dom is ready then only highlight the selected\n await nextTick()\n primitiveElement.value?.highlightSelected()\n isUserInputted.value = true\n }\n else {\n isUserInputted.value = false\n }\n\n inputElement.value?.focus()\n setTimeout(() => {\n if (!val && props.resetSearchTermOnBlur)\n resetSearchTerm.trigger()\n }, 1)\n}\n\nconst resetSearchTerm = createEventHook()\nconst isUserInputted = ref(false)\nconst isVirtual = ref(false)\nconst inputElement = ref<HTMLInputElement>()\nconst triggerElement = ref<HTMLElement>()\n\nconst highlightedElement = computed(() => primitiveElement.value?.highlightedElement ?? undefined)\n\nconst allItems = ref<Map<string, string>>(new Map())\nconst allGroups = ref<Map<string, Set<string>>>(new Map())\n\nconst { contains } = useFilter({ sensitivity: 'base' })\nconst filterState = reactive({\n search: '',\n filtered: {\n /** The count of all visible items. */\n count: 0,\n /** Map from visible item id to its search score. */\n items: new Map() as Map<string, number>,\n /** Set of groups with at least one visible item. */\n groups: new Set() as Set<string>,\n },\n})\n\nfunction filterItems() {\n if (!filterState.search || props.ignoreFilter || isVirtual.value) {\n filterState.filtered.count = allItems.value.size\n // Do nothing, each item will know to show itself because search is empty\n return\n }\n\n // Reset the groups\n filterState.filtered.groups = new Set()\n let itemCount = 0\n\n // Check which items should be included\n for (const [id, value] of allItems.value) {\n const score = contains(value, filterState.search)\n filterState.filtered.items.set(id, score ? 1 : 0)\n if (score)\n itemCount++\n }\n\n // Check which groups have at least 1 item shown\n for (const [groupId, group] of allGroups.value) {\n for (const itemId of group) {\n if (filterState.filtered.items.get(itemId)! > 0) {\n filterState.filtered.groups.add(groupId)\n break\n }\n }\n }\n\n filterState.filtered.count = itemCount\n}\n\nwatch([() => filterState.search, () => allItems.value.size], () => {\n filterItems()\n}, { immediate: true })\n\nwatch(() => open.value, () => {\n // nextTick to allow multiple items to be mounted first\n nextTick(() => {\n if (open.value)\n filterItems()\n })\n}, { flush: 'post' })\n\ndefineExpose({\n filtered: computed(() => filterState.filtered),\n highlightedElement,\n highlightItem: primitiveElement.value?.highlightItem,\n highlightFirstItem: primitiveElement.value?.highlightFirstItem,\n highlightSelected: primitiveElement.value?.highlightSelected,\n})\n\nprovideComboboxRootContext({\n modelValue,\n multiple,\n disabled,\n open,\n onOpenChange,\n contentId: '',\n isUserInputted,\n isVirtual,\n inputElement,\n highlightedElement,\n onInputElementChange: val => inputElement.value = val,\n triggerElement,\n onTriggerElementChange: val => triggerElement.value = val,\n parentElement,\n onResetSearchTerm: resetSearchTerm.on,\n allItems,\n allGroups,\n filterState,\n ignoreFilter,\n})\n</script>\n\n<template>\n <PopperRoot>\n <ListboxRoot\n ref=\"primitiveElement\"\n v-bind=\"$attrs\"\n v-model=\"modelValue\"\n :style=\"{\n pointerEvents: open ? 'auto' : undefined,\n }\"\n :as=\"as\"\n :as-child=\"asChild\"\n :dir=\"dir\"\n :multiple=\"multiple\"\n :name=\"name\"\n :required=\"required\"\n :disabled=\"disabled\"\n :highlight-on-hover=\"true\"\n @highlight=\"emits('highlight', $event as any)\"\n >\n <slot\n :open=\"open\"\n :model-value=\"modelValue\"\n />\n </ListboxRoot>\n </PopperRoot>\n</template>\n"],"names":[],"mappings":";;;;;;;;;AAgCO,MAAM,CAAC,yBAAA,EAA2B,0BAA0B,CAAA,GAC/D,cAAoD,cAAc,EAAA;;;;;;;;;;;;;;;;;;;;;;AAkCtE,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAId,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AAWd,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAgB,EAAA,aAAA,KAAkB,mBAAkE,EAAA,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CAAA;AAAA,MAC7C,kBAAA;AAAA,MACA,aAAA,EAAe,iBAAiB,KAAO,EAAA,aAAA;AAAA,MACvC,kBAAA,EAAoB,iBAAiB,KAAO,EAAA,kBAAA;AAAA,MAC5C,iBAAA,EAAmB,iBAAiB,KAAO,EAAA,iBAAA;AAAA,KAC5C,CAAA,CAAA;AAED,IAA2B,0BAAA,CAAA;AAAA,MACzB,UAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAW,EAAA,EAAA;AAAA,MACX,cAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAA;AAAA,MACA,kBAAA;AAAA,MACA,oBAAA,EAAsB,CAAO,GAAA,KAAA,YAAA,CAAa,KAAQ,GAAA,GAAA;AAAA,MAClD,cAAA;AAAA,MACA,sBAAA,EAAwB,CAAO,GAAA,KAAA,cAAA,CAAe,KAAQ,GAAA,GAAA;AAAA,MACtD,aAAA;AAAA,MACA,mBAAmB,eAAgB,CAAA,EAAA;AAAA,MACnC,QAAA;AAAA,MACA,SAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -141,7 +141,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
141
141
  modal: vue.unref(modal)
142
142
  }, {
143
143
  default: vue.withCtx(() => [
144
- vue.renderSlot(_ctx.$slots, "default")
144
+ vue.renderSlot(_ctx.$slots, "default", {
145
+ modelValue: vue.unref(modelValue),
146
+ open: vue.unref(open)
147
+ })
145
148
  ]),
146
149
  _: 3
147
150
  }, 8, ["open", "default-open", "modal"]);
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePickerRoot.cjs","sources":["../../src/DateRangePicker/DateRangePickerRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { DateValue } from '@internationalized/date'\n\nimport type { Ref } from 'vue'\nimport { createContext, useDirection } from '@/shared'\nimport { type DateRange, type Granularity, type HourCycle, getDefaultDate } from '@/shared/date'\nimport type { Matcher, WeekDayFormat } from '@/date'\n\nimport { type DateRangeFieldRoot, type DateRangeFieldRootProps, PopoverRoot, type PopoverRootEmits, type PopoverRootProps, type RangeCalendarRootProps } from '..'\nimport type { Direction } from '@/shared/types'\n\ntype DateRangePickerRootContext = {\n id: Ref<string | undefined>\n name: Ref<string | undefined>\n minValue: Ref<DateValue | undefined>\n maxValue: Ref<DateValue | undefined>\n hourCycle: Ref<HourCycle | undefined>\n granularity: Ref<Granularity | undefined>\n hideTimeZone: Ref<boolean>\n required: Ref<boolean>\n locale: Ref<string>\n dateFieldRef: Ref<InstanceType<typeof DateRangeFieldRoot> | undefined>\n modelValue: Ref<{ start: DateValue | undefined, end: DateValue | undefined }>\n placeholder: Ref<DateValue>\n pagedNavigation: Ref<boolean>\n preventDeselect: Ref<boolean>\n weekStartsOn: Ref<0 | 1 | 2 | 3 | 4 | 5 | 6>\n weekdayFormat: Ref<WeekDayFormat>\n fixedWeeks: Ref<boolean>\n numberOfMonths: Ref<number>\n disabled: Ref<boolean>\n readonly: Ref<boolean>\n isDateDisabled?: Matcher\n isDateUnavailable?: Matcher\n defaultOpen: Ref<boolean>\n open: Ref<boolean>\n modal: Ref<boolean>\n onDateChange: (date: DateRange) => void\n onPlaceholderChange: (date: DateValue) => void\n onStartValueChange: (date: DateValue | undefined) => void\n dir: Ref<Direction>\n allowNonContiguousRanges: Ref<boolean>\n}\n\nexport type DateRangePickerRootProps = DateRangeFieldRootProps & PopoverRootProps & Pick<RangeCalendarRootProps, 'isDateDisabled' | 'pagedNavigation' | 'weekStartsOn' | 'weekdayFormat' | 'fixedWeeks' | 'numberOfMonths' | 'preventDeselect' | 'isDateUnavailable' | 'allowNonContiguousRanges'>\n\nexport type DateRangePickerRootEmits = {\n /** Event handler called whenever the model value changes */\n 'update:modelValue': [date: DateRange]\n /** Event handler called whenever the placeholder value changes */\n 'update:placeholder': [date: DateValue]\n /** Event handler called whenever the start value changes */\n 'update:startValue': [date: DateValue | undefined]\n}\n\nexport const [injectDateRangePickerRootContext, provideDateRangePickerRootContext]\n = createContext<DateRangePickerRootContext>('DateRangePickerRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, toRefs } from 'vue'\nimport { useVModel } from '@vueuse/core'\n\ndefineOptions({\n inheritAttrs: false,\n})\nconst props = withDefaults(defineProps<DateRangePickerRootProps>(), {\n defaultValue: () => ({ start: undefined, end: undefined }),\n defaultOpen: false,\n open: undefined,\n modal: false,\n pagedNavigation: false,\n preventDeselect: false,\n weekStartsOn: 0,\n weekdayFormat: 'narrow',\n fixedWeeks: false,\n numberOfMonths: 1,\n disabled: false,\n readonly: false,\n initialFocus: false,\n placeholder: undefined,\n locale: 'en',\n isDateDisabled: undefined,\n isDateUnavailable: undefined,\n allowNonContiguousRanges: false,\n})\nconst emits = defineEmits<DateRangePickerRootEmits & PopoverRootEmits>()\nconst {\n locale,\n disabled,\n readonly,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n numberOfMonths,\n preventDeselect,\n isDateDisabled: propsIsDateDisabled,\n isDateUnavailable: propsIsDateUnavailable,\n defaultOpen,\n modal,\n id,\n name,\n required,\n minValue,\n maxValue,\n granularity,\n hideTimeZone,\n hourCycle,\n dir: propsDir,\n allowNonContiguousRanges,\n} = toRefs(props)\n\nconst dir = useDirection(propsDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue ?? { start: undefined, end: undefined },\n passive: (props.modelValue === undefined) as false,\n}) as Ref<DateRange>\n\nconst defaultDate = getDefaultDate({\n defaultPlaceholder: props.placeholder,\n granularity: props.granularity,\n defaultValue: modelValue.value.start,\n locale: props.locale,\n})\n\nconst placeholder = useVModel(props, 'placeholder', emits, {\n defaultValue: props.defaultPlaceholder ?? defaultDate.copy(),\n passive: (props.placeholder === undefined) as false,\n}) as Ref<DateValue>\n\nconst open = useVModel(props, 'open', emits, {\n defaultValue: defaultOpen.value,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n\nconst dateFieldRef = ref<InstanceType<typeof DateRangeFieldRoot> | undefined>()\n\nprovideDateRangePickerRootContext({\n allowNonContiguousRanges,\n isDateUnavailable: propsIsDateUnavailable.value,\n isDateDisabled: propsIsDateDisabled.value,\n locale,\n disabled,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n numberOfMonths,\n readonly,\n preventDeselect,\n modelValue,\n placeholder,\n defaultOpen,\n modal,\n open,\n id,\n name,\n required,\n minValue,\n maxValue,\n granularity,\n hideTimeZone,\n hourCycle,\n dateFieldRef,\n dir,\n onStartValueChange(date: DateValue | undefined) {\n emits('update:startValue', date)\n },\n onDateChange(date: DateRange) {\n modelValue.value = { start: date.start?.copy(), end: date.end?.copy() }\n },\n onPlaceholderChange(date: DateValue) {\n placeholder.value = date.copy()\n },\n})\n</script>\n\n<template>\n <PopoverRoot\n v-model:open=\"open\"\n :default-open=\"defaultOpen\"\n :modal=\"modal\"\n >\n <slot />\n </PopoverRoot>\n</template>\n"],"names":["createContext","toRefs","useDirection","useVModel","getDefaultDate","ref"],"mappings":";;;;;;;;;;AAuDO,MAAM,CAAC,gCAAA,EAAkC,iCAAiC,CAAA,GAC7EA,mCAA0C,qBAAqB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUnE,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAoBd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AACd,IAAM,MAAA;AAAA,MACJ,MAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,eAAA;AAAA,MACA,cAAgB,EAAA,mBAAA;AAAA,MAChB,iBAAmB,EAAA,sBAAA;AAAA,MACnB,WAAA;AAAA,MACA,KAAA;A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A,CAAA;AAE9E,IAAkC,iCAAA,CAAA;AAAA,MAChC,wBAAA;AAAA,MACA,mBAAmB,sBAAuB,CAAA,KAAA;AAAA,MAC1C,gBAAgB,mBAAoB,CAAA,KAAA;AAAA,MACpC,MAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,EAAA;AAAA,MACA,IAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAA;AAAA,MACA,GAAA;AAAA,MACA,mBAAmB,IAA6B,EAAA;AAC9C,QAAA,KAAA,CAAM,qBAAqB,IAAI,CAAA,CAAA;AAAA,OACjC;AAAA,MACA,aAAa,IAAiB,EAAA;AAC5B,QAAW,UAAA,CAAA,KAAA,GAAQ,EAAE,KAAA,EAAO,IAAK,CAAA,KAAA,EAAO,IAAK,EAAA,EAAG,GAAK,EAAA,IAAA,CAAK,GAAK,EAAA,IAAA,EAAO,EAAA,CAAA;AAAA,OACxE;AAAA,MACA,oBAAoB,IAAiB,EAAA;AACnC,QAAY,WAAA,CAAA,KAAA,GAAQ,KAAK,IAAK,EAAA,CAAA;AAAA,OAChC;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"DateRangePickerRoot.cjs","sources":["../../src/DateRangePicker/DateRangePickerRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { DateValue } from '@internationalized/date'\n\nimport type { Ref } from 'vue'\nimport { createContext, useDirection } from '@/shared'\nimport { type DateRange, type Granularity, type HourCycle, getDefaultDate } from '@/shared/date'\nimport type { Matcher, WeekDayFormat } from '@/date'\n\nimport { type DateRangeFieldRoot, type DateRangeFieldRootProps, PopoverRoot, type PopoverRootEmits, type PopoverRootProps, type RangeCalendarRootProps } from '..'\nimport type { Direction } from '@/shared/types'\n\ntype DateRangePickerRootContext = {\n id: Ref<string | undefined>\n name: Ref<string | undefined>\n minValue: Ref<DateValue | undefined>\n maxValue: Ref<DateValue | undefined>\n hourCycle: Ref<HourCycle | undefined>\n granularity: Ref<Granularity | undefined>\n hideTimeZone: Ref<boolean>\n required: Ref<boolean>\n locale: Ref<string>\n dateFieldRef: Ref<InstanceType<typeof DateRangeFieldRoot> | undefined>\n modelValue: Ref<{ start: DateValue | undefined, end: DateValue | undefined }>\n placeholder: Ref<DateValue>\n pagedNavigation: Ref<boolean>\n preventDeselect: Ref<boolean>\n weekStartsOn: Ref<0 | 1 | 2 | 3 | 4 | 5 | 6>\n weekdayFormat: Ref<WeekDayFormat>\n fixedWeeks: Ref<boolean>\n numberOfMonths: Ref<number>\n disabled: Ref<boolean>\n readonly: Ref<boolean>\n isDateDisabled?: Matcher\n isDateUnavailable?: Matcher\n defaultOpen: Ref<boolean>\n open: Ref<boolean>\n modal: Ref<boolean>\n onDateChange: (date: DateRange) => void\n onPlaceholderChange: (date: DateValue) => void\n onStartValueChange: (date: DateValue | undefined) => void\n dir: Ref<Direction>\n allowNonContiguousRanges: Ref<boolean>\n}\n\nexport type DateRangePickerRootProps = DateRangeFieldRootProps & PopoverRootProps & Pick<RangeCalendarRootProps, 'isDateDisabled' | 'pagedNavigation' | 'weekStartsOn' | 'weekdayFormat' | 'fixedWeeks' | 'numberOfMonths' | 'preventDeselect' | 'isDateUnavailable' | 'allowNonContiguousRanges'>\n\nexport type DateRangePickerRootEmits = {\n /** Event handler called whenever the model value changes */\n 'update:modelValue': [date: DateRange]\n /** Event handler called whenever the placeholder value changes */\n 'update:placeholder': [date: DateValue]\n /** Event handler called whenever the start value changes */\n 'update:startValue': [date: DateValue | undefined]\n}\n\nexport const [injectDateRangePickerRootContext, provideDateRangePickerRootContext]\n = createContext<DateRangePickerRootContext>('DateRangePickerRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, toRefs } from 'vue'\nimport { useVModel } from '@vueuse/core'\n\ndefineOptions({\n inheritAttrs: false,\n})\nconst props = withDefaults(defineProps<DateRangePickerRootProps>(), {\n defaultValue: () => ({ start: undefined, end: undefined }),\n defaultOpen: false,\n open: undefined,\n modal: false,\n pagedNavigation: false,\n preventDeselect: false,\n weekStartsOn: 0,\n weekdayFormat: 'narrow',\n fixedWeeks: false,\n numberOfMonths: 1,\n disabled: false,\n readonly: false,\n initialFocus: false,\n placeholder: undefined,\n locale: 'en',\n isDateDisabled: undefined,\n isDateUnavailable: undefined,\n allowNonContiguousRanges: false,\n})\nconst emits = defineEmits<DateRangePickerRootEmits & PopoverRootEmits>()\nconst {\n locale,\n disabled,\n readonly,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n numberOfMonths,\n preventDeselect,\n isDateDisabled: propsIsDateDisabled,\n isDateUnavailable: propsIsDateUnavailable,\n defaultOpen,\n modal,\n id,\n name,\n required,\n minValue,\n maxValue,\n granularity,\n hideTimeZone,\n hourCycle,\n dir: propsDir,\n allowNonContiguousRanges,\n} = toRefs(props)\n\nconst dir = useDirection(propsDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue ?? { start: undefined, end: undefined },\n passive: (props.modelValue === undefined) as false,\n}) as Ref<DateRange>\n\nconst defaultDate = getDefaultDate({\n defaultPlaceholder: props.placeholder,\n granularity: props.granularity,\n defaultValue: modelValue.value.start,\n locale: props.locale,\n})\n\nconst placeholder = useVModel(props, 'placeholder', emits, {\n defaultValue: props.defaultPlaceholder ?? defaultDate.copy(),\n passive: (props.placeholder === undefined) as false,\n}) as Ref<DateValue>\n\nconst open = useVModel(props, 'open', emits, {\n defaultValue: defaultOpen.value,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n\nconst dateFieldRef = ref<InstanceType<typeof DateRangeFieldRoot> | undefined>()\n\nprovideDateRangePickerRootContext({\n allowNonContiguousRanges,\n isDateUnavailable: propsIsDateUnavailable.value,\n isDateDisabled: propsIsDateDisabled.value,\n locale,\n disabled,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n numberOfMonths,\n readonly,\n preventDeselect,\n modelValue,\n placeholder,\n defaultOpen,\n modal,\n open,\n id,\n name,\n required,\n minValue,\n maxValue,\n granularity,\n hideTimeZone,\n hourCycle,\n dateFieldRef,\n dir,\n onStartValueChange(date: DateValue | undefined) {\n emits('update:startValue', date)\n },\n onDateChange(date: DateRange) {\n modelValue.value = { start: date.start?.copy(), end: date.end?.copy() }\n },\n onPlaceholderChange(date: DateValue) {\n placeholder.value = date.copy()\n },\n})\n</script>\n\n<template>\n <PopoverRoot\n v-model:open=\"open\"\n :default-open=\"defaultOpen\"\n :modal=\"modal\"\n >\n <slot\n :model-value=\"modelValue\"\n :open=\"open\"\n />\n </PopoverRoot>\n</template>\n"],"names":["createContext","toRefs","useDirection","useVModel","getDefaultDate","ref"],"mappings":";;;;;;;;;;AAuDO,MAAM,CAAC,gCAAA,EAAkC,iCAAiC,CAAA,GAC7EA,mCAA0C,qBAAqB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUnE,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAoBd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AACd,IAAM,MAAA;AAAA,MACJ,MAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,eAAA;AAAA,MACA,cAAgB,EAAA,mBAAA;AAAA,MAChB,iBAAmB,EAAA,sBAAA;AAAA,MACnB,WAAA;AAAA,MACA,KAAA;AAAA,MACA,EAAA;AAAA,MACA,IAAA;AAAA,MACA,QAA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,wBAAA;AAAA,MACA,mBAAmB,sBAAuB,CAAA,KAAA;AAAA,MAC1C,gBAAgB,mBAAoB,CAAA,KAAA;AAAA,MACpC,MAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,EAAA;AAAA,MACA,IAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAA;AAAA,MACA,GAAA;AAAA,MACA,mBAAmB,IAA6B,EAAA;AAC9C,QAAA,KAAA,CAAM,qBAAqB,IAAI,CAAA,CAAA;AAAA,OACjC;AAAA,MACA,aAAa,IAAiB,EAAA;AAC5B,QAAW,UAAA,CAAA,KAAA,GAAQ,EAAE,KAAA,EAAO,IAAK,CAAA,KAAA,EAAO,IAAK,EAAA,EAAG,GAAK,EAAA,IAAA,CAAK,GAAK,EAAA,IAAA,EAAO,EAAA,CAAA;AAAA,OACxE;AAAA,MACA,oBAAoB,IAAiB,EAAA;AACnC,QAAY,WAAA,CAAA,KAAA,GAAQ,KAAK,IAAK,EAAA,CAAA;AAAA,OAChC;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -139,7 +139,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
139
139
  modal: unref(modal)
140
140
  }, {
141
141
  default: withCtx(() => [
142
- renderSlot(_ctx.$slots, "default")
142
+ renderSlot(_ctx.$slots, "default", {
143
+ modelValue: unref(modelValue),
144
+ open: unref(open)
145
+ })
143
146
  ]),
144
147
  _: 3
145
148
  }, 8, ["open", "default-open", "modal"]);
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePickerRoot.js","sources":["../../src/DateRangePicker/DateRangePickerRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { DateValue } from '@internationalized/date'\n\nimport type { Ref } from 'vue'\nimport { createContext, useDirection } from '@/shared'\nimport { type DateRange, type Granularity, type HourCycle, getDefaultDate } from '@/shared/date'\nimport type { Matcher, WeekDayFormat } from '@/date'\n\nimport { type DateRangeFieldRoot, type DateRangeFieldRootProps, PopoverRoot, type PopoverRootEmits, type PopoverRootProps, type RangeCalendarRootProps } from '..'\nimport type { Direction } from '@/shared/types'\n\ntype DateRangePickerRootContext = {\n id: Ref<string | undefined>\n name: Ref<string | undefined>\n minValue: Ref<DateValue | undefined>\n maxValue: Ref<DateValue | undefined>\n hourCycle: Ref<HourCycle | undefined>\n granularity: Ref<Granularity | undefined>\n hideTimeZone: Ref<boolean>\n required: Ref<boolean>\n locale: Ref<string>\n dateFieldRef: Ref<InstanceType<typeof DateRangeFieldRoot> | undefined>\n modelValue: Ref<{ start: DateValue | undefined, end: DateValue | undefined }>\n placeholder: Ref<DateValue>\n pagedNavigation: Ref<boolean>\n preventDeselect: Ref<boolean>\n weekStartsOn: Ref<0 | 1 | 2 | 3 | 4 | 5 | 6>\n weekdayFormat: Ref<WeekDayFormat>\n fixedWeeks: Ref<boolean>\n numberOfMonths: Ref<number>\n disabled: Ref<boolean>\n readonly: Ref<boolean>\n isDateDisabled?: Matcher\n isDateUnavailable?: Matcher\n defaultOpen: Ref<boolean>\n open: Ref<boolean>\n modal: Ref<boolean>\n onDateChange: (date: DateRange) => void\n onPlaceholderChange: (date: DateValue) => void\n onStartValueChange: (date: DateValue | undefined) => void\n dir: Ref<Direction>\n allowNonContiguousRanges: Ref<boolean>\n}\n\nexport type DateRangePickerRootProps = DateRangeFieldRootProps & PopoverRootProps & Pick<RangeCalendarRootProps, 'isDateDisabled' | 'pagedNavigation' | 'weekStartsOn' | 'weekdayFormat' | 'fixedWeeks' | 'numberOfMonths' | 'preventDeselect' | 'isDateUnavailable' | 'allowNonContiguousRanges'>\n\nexport type DateRangePickerRootEmits = {\n /** Event handler called whenever the model value changes */\n 'update:modelValue': [date: DateRange]\n /** Event handler called whenever the placeholder value changes */\n 'update:placeholder': [date: DateValue]\n /** Event handler called whenever the start value changes */\n 'update:startValue': [date: DateValue | undefined]\n}\n\nexport const [injectDateRangePickerRootContext, provideDateRangePickerRootContext]\n = createContext<DateRangePickerRootContext>('DateRangePickerRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, toRefs } from 'vue'\nimport { useVModel } from '@vueuse/core'\n\ndefineOptions({\n inheritAttrs: false,\n})\nconst props = withDefaults(defineProps<DateRangePickerRootProps>(), {\n defaultValue: () => ({ start: undefined, end: undefined }),\n defaultOpen: false,\n open: undefined,\n modal: false,\n pagedNavigation: false,\n preventDeselect: false,\n weekStartsOn: 0,\n weekdayFormat: 'narrow',\n fixedWeeks: false,\n numberOfMonths: 1,\n disabled: false,\n readonly: false,\n initialFocus: false,\n placeholder: undefined,\n locale: 'en',\n isDateDisabled: undefined,\n isDateUnavailable: undefined,\n allowNonContiguousRanges: false,\n})\nconst emits = defineEmits<DateRangePickerRootEmits & PopoverRootEmits>()\nconst {\n locale,\n disabled,\n readonly,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n numberOfMonths,\n preventDeselect,\n isDateDisabled: propsIsDateDisabled,\n isDateUnavailable: propsIsDateUnavailable,\n defaultOpen,\n modal,\n id,\n name,\n required,\n minValue,\n maxValue,\n granularity,\n hideTimeZone,\n hourCycle,\n dir: propsDir,\n allowNonContiguousRanges,\n} = toRefs(props)\n\nconst dir = useDirection(propsDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue ?? { start: undefined, end: undefined },\n passive: (props.modelValue === undefined) as false,\n}) as Ref<DateRange>\n\nconst defaultDate = getDefaultDate({\n defaultPlaceholder: props.placeholder,\n granularity: props.granularity,\n defaultValue: modelValue.value.start,\n locale: props.locale,\n})\n\nconst placeholder = useVModel(props, 'placeholder', emits, {\n defaultValue: props.defaultPlaceholder ?? defaultDate.copy(),\n passive: (props.placeholder === undefined) as false,\n}) as Ref<DateValue>\n\nconst open = useVModel(props, 'open', emits, {\n defaultValue: defaultOpen.value,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n\nconst dateFieldRef = ref<InstanceType<typeof DateRangeFieldRoot> | undefined>()\n\nprovideDateRangePickerRootContext({\n allowNonContiguousRanges,\n isDateUnavailable: propsIsDateUnavailable.value,\n isDateDisabled: propsIsDateDisabled.value,\n locale,\n disabled,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n numberOfMonths,\n readonly,\n preventDeselect,\n modelValue,\n placeholder,\n defaultOpen,\n modal,\n open,\n id,\n name,\n required,\n minValue,\n maxValue,\n granularity,\n hideTimeZone,\n hourCycle,\n dateFieldRef,\n dir,\n onStartValueChange(date: DateValue | undefined) {\n emits('update:startValue', date)\n },\n onDateChange(date: DateRange) {\n modelValue.value = { start: date.start?.copy(), end: date.end?.copy() }\n },\n onPlaceholderChange(date: DateValue) {\n placeholder.value = date.copy()\n },\n})\n</script>\n\n<template>\n <PopoverRoot\n v-model:open=\"open\"\n :default-open=\"defaultOpen\"\n :modal=\"modal\"\n >\n <slot />\n </PopoverRoot>\n</template>\n"],"names":[],"mappings":";;;;;;;;AAuDO,MAAM,CAAC,gCAAA,EAAkC,iCAAiC,CAAA,GAC7E,cAA0C,qBAAqB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUnE,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAoBd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AACd,IAAM,MAAA;AAAA,MACJ,MAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,eAAA;AA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AAM,IAAS,KAAA,KAAA,CAAA;AAAA,KAC1B,CAAA,CAAA;AAED,IAAA,MAAM,eAAe,GAAyD,EAAA,CAAA;AAE9E,IAAkC,iCAAA,CAAA;AAAA,MAChC,wBAAA;AAAA,MACA,mBAAmB,sBAAuB,CAAA,KAAA;AAAA,MAC1C,gBAAgB,mBAAoB,CAAA,KAAA;AAAA,MACpC,MAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,EAAA;AAAA,MACA,IAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAA;AAAA,MACA,GAAA;AAAA,MACA,mBAAmB,IAA6B,EAAA;AAC9C,QAAA,KAAA,CAAM,qBAAqB,IAAI,CAAA,CAAA;AAAA,OACjC;AAAA,MACA,aAAa,IAAiB,EAAA;AAC5B,QAAW,UAAA,CAAA,KAAA,GAAQ,EAAE,KAAA,EAAO,IAAK,CAAA,KAAA,EAAO,IAAK,EAAA,EAAG,GAAK,EAAA,IAAA,CAAK,GAAK,EAAA,IAAA,EAAO,EAAA,CAAA;AAAA,OACxE;AAAA,MACA,oBAAoB,IAAiB,EAAA;AACnC,QAAY,WAAA,CAAA,KAAA,GAAQ,KAAK,IAAK,EAAA,CAAA;AAAA,OAChC;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"DateRangePickerRoot.js","sources":["../../src/DateRangePicker/DateRangePickerRoot.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { DateValue } from '@internationalized/date'\n\nimport type { Ref } from 'vue'\nimport { createContext, useDirection } from '@/shared'\nimport { type DateRange, type Granularity, type HourCycle, getDefaultDate } from '@/shared/date'\nimport type { Matcher, WeekDayFormat } from '@/date'\n\nimport { type DateRangeFieldRoot, type DateRangeFieldRootProps, PopoverRoot, type PopoverRootEmits, type PopoverRootProps, type RangeCalendarRootProps } from '..'\nimport type { Direction } from '@/shared/types'\n\ntype DateRangePickerRootContext = {\n id: Ref<string | undefined>\n name: Ref<string | undefined>\n minValue: Ref<DateValue | undefined>\n maxValue: Ref<DateValue | undefined>\n hourCycle: Ref<HourCycle | undefined>\n granularity: Ref<Granularity | undefined>\n hideTimeZone: Ref<boolean>\n required: Ref<boolean>\n locale: Ref<string>\n dateFieldRef: Ref<InstanceType<typeof DateRangeFieldRoot> | undefined>\n modelValue: Ref<{ start: DateValue | undefined, end: DateValue | undefined }>\n placeholder: Ref<DateValue>\n pagedNavigation: Ref<boolean>\n preventDeselect: Ref<boolean>\n weekStartsOn: Ref<0 | 1 | 2 | 3 | 4 | 5 | 6>\n weekdayFormat: Ref<WeekDayFormat>\n fixedWeeks: Ref<boolean>\n numberOfMonths: Ref<number>\n disabled: Ref<boolean>\n readonly: Ref<boolean>\n isDateDisabled?: Matcher\n isDateUnavailable?: Matcher\n defaultOpen: Ref<boolean>\n open: Ref<boolean>\n modal: Ref<boolean>\n onDateChange: (date: DateRange) => void\n onPlaceholderChange: (date: DateValue) => void\n onStartValueChange: (date: DateValue | undefined) => void\n dir: Ref<Direction>\n allowNonContiguousRanges: Ref<boolean>\n}\n\nexport type DateRangePickerRootProps = DateRangeFieldRootProps & PopoverRootProps & Pick<RangeCalendarRootProps, 'isDateDisabled' | 'pagedNavigation' | 'weekStartsOn' | 'weekdayFormat' | 'fixedWeeks' | 'numberOfMonths' | 'preventDeselect' | 'isDateUnavailable' | 'allowNonContiguousRanges'>\n\nexport type DateRangePickerRootEmits = {\n /** Event handler called whenever the model value changes */\n 'update:modelValue': [date: DateRange]\n /** Event handler called whenever the placeholder value changes */\n 'update:placeholder': [date: DateValue]\n /** Event handler called whenever the start value changes */\n 'update:startValue': [date: DateValue | undefined]\n}\n\nexport const [injectDateRangePickerRootContext, provideDateRangePickerRootContext]\n = createContext<DateRangePickerRootContext>('DateRangePickerRoot')\n</script>\n\n<script setup lang=\"ts\">\nimport { ref, toRefs } from 'vue'\nimport { useVModel } from '@vueuse/core'\n\ndefineOptions({\n inheritAttrs: false,\n})\nconst props = withDefaults(defineProps<DateRangePickerRootProps>(), {\n defaultValue: () => ({ start: undefined, end: undefined }),\n defaultOpen: false,\n open: undefined,\n modal: false,\n pagedNavigation: false,\n preventDeselect: false,\n weekStartsOn: 0,\n weekdayFormat: 'narrow',\n fixedWeeks: false,\n numberOfMonths: 1,\n disabled: false,\n readonly: false,\n initialFocus: false,\n placeholder: undefined,\n locale: 'en',\n isDateDisabled: undefined,\n isDateUnavailable: undefined,\n allowNonContiguousRanges: false,\n})\nconst emits = defineEmits<DateRangePickerRootEmits & PopoverRootEmits>()\nconst {\n locale,\n disabled,\n readonly,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n numberOfMonths,\n preventDeselect,\n isDateDisabled: propsIsDateDisabled,\n isDateUnavailable: propsIsDateUnavailable,\n defaultOpen,\n modal,\n id,\n name,\n required,\n minValue,\n maxValue,\n granularity,\n hideTimeZone,\n hourCycle,\n dir: propsDir,\n allowNonContiguousRanges,\n} = toRefs(props)\n\nconst dir = useDirection(propsDir)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue ?? { start: undefined, end: undefined },\n passive: (props.modelValue === undefined) as false,\n}) as Ref<DateRange>\n\nconst defaultDate = getDefaultDate({\n defaultPlaceholder: props.placeholder,\n granularity: props.granularity,\n defaultValue: modelValue.value.start,\n locale: props.locale,\n})\n\nconst placeholder = useVModel(props, 'placeholder', emits, {\n defaultValue: props.defaultPlaceholder ?? defaultDate.copy(),\n passive: (props.placeholder === undefined) as false,\n}) as Ref<DateValue>\n\nconst open = useVModel(props, 'open', emits, {\n defaultValue: defaultOpen.value,\n passive: (props.open === undefined) as false,\n}) as Ref<boolean>\n\nconst dateFieldRef = ref<InstanceType<typeof DateRangeFieldRoot> | undefined>()\n\nprovideDateRangePickerRootContext({\n allowNonContiguousRanges,\n isDateUnavailable: propsIsDateUnavailable.value,\n isDateDisabled: propsIsDateDisabled.value,\n locale,\n disabled,\n pagedNavigation,\n weekStartsOn,\n weekdayFormat,\n fixedWeeks,\n numberOfMonths,\n readonly,\n preventDeselect,\n modelValue,\n placeholder,\n defaultOpen,\n modal,\n open,\n id,\n name,\n required,\n minValue,\n maxValue,\n granularity,\n hideTimeZone,\n hourCycle,\n dateFieldRef,\n dir,\n onStartValueChange(date: DateValue | undefined) {\n emits('update:startValue', date)\n },\n onDateChange(date: DateRange) {\n modelValue.value = { start: date.start?.copy(), end: date.end?.copy() }\n },\n onPlaceholderChange(date: DateValue) {\n placeholder.value = date.copy()\n },\n})\n</script>\n\n<template>\n <PopoverRoot\n v-model:open=\"open\"\n :default-open=\"defaultOpen\"\n :modal=\"modal\"\n >\n <slot\n :model-value=\"modelValue\"\n :open=\"open\"\n />\n </PopoverRoot>\n</template>\n"],"names":[],"mappings":";;;;;;;;AAuDO,MAAM,CAAC,gCAAA,EAAkC,iCAAiC,CAAA,GAC7E,cAA0C,qBAAqB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUnE,IAAA,MAAM,KAAQ,GAAA,OAAA,CAAA;AAoBd,IAAA,MAAM,KAAQ,GAAA,MAAA,CAAA;AACd,IAAM,MAAA;AAAA,MACJ,MAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,eAAA;AAAA,MACA,cAAgB,EAAA,mBAAA;AAAA,MAChB,iBAAmB,EAAA,sBAAA;AAAA,MACnB,WAAA;AAAA,MACA,KAAA;AAAA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,IAAkC,iCAAA,CAAA;AAAA,MAChC,wBAAA;AAAA,MACA,mBAAmB,sBAAuB,CAAA,KAAA;AAAA,MAC1C,gBAAgB,mBAAoB,CAAA,KAAA;AAAA,MACpC,MAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,YAAA;AAAA,MACA,aAAA;AAAA,MACA,UAAA;AAAA,MACA,cAAA;AAAA,MACA,QAAA;AAAA,MACA,eAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAA;AAAA,MACA,WAAA;AAAA,MACA,KAAA;AAAA,MACA,IAAA;AAAA,MACA,EAAA;AAAA,MACA,IAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,WAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAA;AAAA,MACA,YAAA;AAAA,MACA,GAAA;AAAA,MACA,mBAAmB,IAA6B,EAAA;AAC9C,QAAA,KAAA,CAAM,qBAAqB,IAAI,CAAA,CAAA;AAAA,OACjC;AAAA,MACA,aAAa,IAAiB,EAAA;AAC5B,QAAW,UAAA,CAAA,KAAA,GAAQ,EAAE,KAAA,EAAO,IAAK,CAAA,KAAA,EAAO,IAAK,EAAA,EAAG,GAAK,EAAA,IAAA,CAAK,GAAK,EAAA,IAAA,EAAO,EAAA,CAAA;AAAA,OACxE;AAAA,MACA,oBAAoB,IAAiB,EAAA;AACnC,QAAY,WAAA,CAAA,KAAA,GAAQ,KAAK,IAAK,EAAA,CAAA;AAAA,OAChC;AAAA,KACD,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;"}
@@ -112,7 +112,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
112
112
  }
113
113
  }
114
114
  function onKeydownEnter(event) {
115
- if (highlightedElement.value) {
115
+ if (highlightedElement.value && highlightedElement.value.isConnected) {
116
116
  event.preventDefault();
117
117
  event.stopPropagation();
118
118
  if (!isComposing.value) {