reka-ui 2.3.1 → 2.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Accordion/AccordionItem.cjs +1 -1
- package/dist/Accordion/AccordionItem.cjs.map +1 -1
- package/dist/Accordion/AccordionItem.js +1 -1
- package/dist/Accordion/AccordionItem.js.map +1 -1
- package/dist/AlertDialog/AlertDialogContent.cjs +0 -1
- package/dist/AlertDialog/AlertDialogContent.cjs.map +1 -1
- package/dist/AlertDialog/AlertDialogContent.js +0 -1
- package/dist/AlertDialog/AlertDialogContent.js.map +1 -1
- package/dist/Combobox/ComboboxCancel.cjs +1 -1
- package/dist/Combobox/ComboboxCancel.cjs.map +1 -1
- package/dist/Combobox/ComboboxCancel.js +1 -1
- package/dist/Combobox/ComboboxCancel.js.map +1 -1
- package/dist/Combobox/ComboboxEmpty.cjs +1 -1
- package/dist/Combobox/ComboboxEmpty.cjs.map +1 -1
- package/dist/Combobox/ComboboxEmpty.js +1 -1
- package/dist/Combobox/ComboboxEmpty.js.map +1 -1
- package/dist/Combobox/ComboboxGroup.cjs +1 -1
- package/dist/Combobox/ComboboxGroup.cjs.map +1 -1
- package/dist/Combobox/ComboboxGroup.js +1 -1
- package/dist/Combobox/ComboboxGroup.js.map +1 -1
- package/dist/Combobox/ComboboxInput.cjs +7 -10
- package/dist/Combobox/ComboboxInput.cjs.map +1 -1
- package/dist/Combobox/ComboboxInput.js +7 -10
- package/dist/Combobox/ComboboxInput.js.map +1 -1
- package/dist/Combobox/ComboboxItem.cjs +2 -2
- package/dist/Combobox/ComboboxItem.cjs.map +1 -1
- package/dist/Combobox/ComboboxItem.js +2 -2
- package/dist/Combobox/ComboboxItem.js.map +1 -1
- package/dist/Combobox/ComboboxRoot.cjs +23 -33
- package/dist/Combobox/ComboboxRoot.cjs.map +1 -1
- package/dist/Combobox/ComboboxRoot.js +24 -34
- package/dist/Combobox/ComboboxRoot.js.map +1 -1
- package/dist/DateRangePicker/DateRangePickerCalendar.cjs +2 -1
- package/dist/DateRangePicker/DateRangePickerCalendar.cjs.map +1 -1
- package/dist/DateRangePicker/DateRangePickerCalendar.js +2 -1
- package/dist/DateRangePicker/DateRangePickerCalendar.js.map +1 -1
- package/dist/DateRangePicker/DateRangePickerRoot.cjs +5 -2
- package/dist/DateRangePicker/DateRangePickerRoot.cjs.map +1 -1
- package/dist/DateRangePicker/DateRangePickerRoot.js +5 -2
- package/dist/DateRangePicker/DateRangePickerRoot.js.map +1 -1
- package/dist/Dialog/DialogContent.cjs +0 -1
- package/dist/Dialog/DialogContent.cjs.map +1 -1
- package/dist/Dialog/DialogContent.js +0 -1
- package/dist/Dialog/DialogContent.js.map +1 -1
- package/dist/Listbox/ListboxFilter.cjs +1 -1
- package/dist/Listbox/ListboxFilter.cjs.map +1 -1
- package/dist/Listbox/ListboxFilter.js +1 -1
- package/dist/Listbox/ListboxFilter.js.map +1 -1
- package/dist/Listbox/ListboxRoot.cjs.map +1 -1
- package/dist/Listbox/ListboxRoot.js.map +1 -1
- package/dist/Listbox/ListboxVirtualizer.cjs +1 -1
- package/dist/Listbox/ListboxVirtualizer.cjs.map +1 -1
- package/dist/Listbox/ListboxVirtualizer.js +1 -1
- package/dist/Listbox/ListboxVirtualizer.js.map +1 -1
- package/dist/Primitive/Slot.cjs +7 -7
- package/dist/Primitive/Slot.cjs.map +1 -1
- package/dist/Primitive/Slot.js +7 -7
- package/dist/Primitive/Slot.js.map +1 -1
- package/dist/RangeCalendar/useRangeCalendar.cjs +22 -4
- package/dist/RangeCalendar/useRangeCalendar.cjs.map +1 -1
- package/dist/RangeCalendar/useRangeCalendar.js +22 -4
- package/dist/RangeCalendar/useRangeCalendar.js.map +1 -1
- package/dist/Select/SelectContent.cjs +8 -4
- package/dist/Select/SelectContent.cjs.map +1 -1
- package/dist/Select/SelectContent.js +9 -5
- package/dist/Select/SelectContent.js.map +1 -1
- package/dist/Select/SelectItemText.cjs +1 -1
- package/dist/Select/SelectItemText.cjs.map +1 -1
- package/dist/Select/SelectItemText.js +2 -2
- package/dist/Select/SelectItemText.js.map +1 -1
- package/dist/constant/components.cjs.map +1 -1
- package/dist/constant/components.js.map +1 -1
- package/dist/constant.d.ts +60 -0
- package/dist/date/useDateField.cjs +6 -2
- package/dist/date/useDateField.cjs.map +1 -1
- package/dist/date/useDateField.js +6 -2
- package/dist/date/useDateField.js.map +1 -1
- package/dist/index.d.ts +14 -14
- package/dist/nuxt/index.cjs +14 -14
- package/dist/nuxt/index.d.cts +2 -2
- package/dist/nuxt/index.d.mts +2 -2
- package/dist/nuxt/index.mjs +14 -14
- package/dist/resolver/index.cjs +9 -5
- package/dist/resolver/index.mjs +9 -5
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionItem.cjs","sources":["../../src/Accordion/AccordionItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ComputedRef, VNodeRef } from 'vue'\nimport type { CollapsibleRootProps } from '../Collapsible'\nimport { createContext, useArrowNavigation, useForwardExpose } from '@/shared'\nimport { injectAccordionRootContext } from './AccordionRoot.vue'\n\nenum AccordionItemState {\n Open = 'open',\n Closed = 'closed',\n}\n\nexport interface AccordionItemProps\n extends Omit<CollapsibleRootProps, 'open' | 'defaultOpen' | 'onOpenChange'> {\n /**\n * Whether or not an accordion item is disabled from user interaction.\n * When `true`, prevents the user from interacting with the item.\n *\n * @defaultValue false\n */\n disabled?: boolean\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n */\n value: string\n}\n\ninterface AccordionItemContext {\n open: ComputedRef<boolean>\n dataState: ComputedRef<AccordionItemState>\n disabled: ComputedRef<boolean>\n dataDisabled: ComputedRef<'' | undefined>\n triggerId: string\n currentRef: VNodeRef\n currentElement: ComputedRef<HTMLElement | undefined>\n value: ComputedRef<string>\n}\n\nexport const [injectAccordionItemContext, provideAccordionItemContext]\n = createContext<AccordionItemContext>('AccordionItem')\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { CollapsibleRoot } from '@/Collapsible'\n\nconst props = defineProps<AccordionItemProps>()\n\ndefineSlots<{\n default?: (props: {\n /** Current open state */\n open: typeof open.value\n }) => any\n}>()\n\nconst rootContext = injectAccordionRootContext()\n\nconst open = computed(() =>\n rootContext.isSingle.value\n ? props.value === rootContext.modelValue.value\n : Array.isArray(rootContext.modelValue.value)\n && rootContext.modelValue.value.includes(props.value),\n)\n\nconst disabled = computed(() => {\n return (rootContext.disabled.value || props.disabled)\n})\n\nconst dataDisabled = computed(() => (disabled.value ? '' : undefined))\n\nconst dataState = computed(() =>\n open.value ? AccordionItemState.Open : AccordionItemState.Closed,\n)\n\ndefineExpose({ open, dataDisabled })\nconst { currentRef, currentElement } = useForwardExpose()\n\nprovideAccordionItemContext({\n open,\n dataState,\n disabled,\n dataDisabled,\n triggerId: '',\n currentRef,\n currentElement,\n value: computed(() => props.value),\n})\n\nfunction handleArrowKey(e: KeyboardEvent) {\n const target = e.target as HTMLElement\n const allCollectionItems: HTMLElement[] = Array.from(rootContext.parentElement.value?.querySelectorAll('[data-reka-collection-item]') ?? [])\n\n const collectionItemIndex = allCollectionItems.findIndex(item => item === target)\n if (collectionItemIndex === -1)\n return null\n\n useArrowNavigation(\n e,\n
|
|
1
|
+
{"version":3,"file":"AccordionItem.cjs","sources":["../../src/Accordion/AccordionItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ComputedRef, VNodeRef } from 'vue'\nimport type { CollapsibleRootProps } from '../Collapsible'\nimport { createContext, useArrowNavigation, useForwardExpose } from '@/shared'\nimport { injectAccordionRootContext } from './AccordionRoot.vue'\n\nenum AccordionItemState {\n Open = 'open',\n Closed = 'closed',\n}\n\nexport interface AccordionItemProps\n extends Omit<CollapsibleRootProps, 'open' | 'defaultOpen' | 'onOpenChange'> {\n /**\n * Whether or not an accordion item is disabled from user interaction.\n * When `true`, prevents the user from interacting with the item.\n *\n * @defaultValue false\n */\n disabled?: boolean\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n */\n value: string\n}\n\ninterface AccordionItemContext {\n open: ComputedRef<boolean>\n dataState: ComputedRef<AccordionItemState>\n disabled: ComputedRef<boolean>\n dataDisabled: ComputedRef<'' | undefined>\n triggerId: string\n currentRef: VNodeRef\n currentElement: ComputedRef<HTMLElement | undefined>\n value: ComputedRef<string>\n}\n\nexport const [injectAccordionItemContext, provideAccordionItemContext]\n = createContext<AccordionItemContext>('AccordionItem')\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { CollapsibleRoot } from '@/Collapsible'\n\nconst props = defineProps<AccordionItemProps>()\n\ndefineSlots<{\n default?: (props: {\n /** Current open state */\n open: typeof open.value\n }) => any\n}>()\n\nconst rootContext = injectAccordionRootContext()\n\nconst open = computed(() =>\n rootContext.isSingle.value\n ? props.value === rootContext.modelValue.value\n : Array.isArray(rootContext.modelValue.value)\n && rootContext.modelValue.value.includes(props.value),\n)\n\nconst disabled = computed(() => {\n return (rootContext.disabled.value || props.disabled)\n})\n\nconst dataDisabled = computed(() => (disabled.value ? '' : undefined))\n\nconst dataState = computed(() =>\n open.value ? AccordionItemState.Open : AccordionItemState.Closed,\n)\n\ndefineExpose({ open, dataDisabled })\nconst { currentRef, currentElement } = useForwardExpose()\n\nprovideAccordionItemContext({\n open,\n dataState,\n disabled,\n dataDisabled,\n triggerId: '',\n currentRef,\n currentElement,\n value: computed(() => props.value),\n})\n\nfunction handleArrowKey(e: KeyboardEvent) {\n const target = e.target as HTMLElement\n const allCollectionItems: HTMLElement[] = Array.from(rootContext.parentElement.value?.querySelectorAll('[data-reka-collection-item]') ?? [])\n\n const collectionItemIndex = allCollectionItems.findIndex(item => item === target)\n if (collectionItemIndex === -1)\n return null\n\n useArrowNavigation(\n e,\n target,\n rootContext.parentElement.value!,\n {\n arrowKeyOptions: rootContext.orientation,\n dir: rootContext.direction.value,\n focus: true,\n },\n )\n}\n</script>\n\n<template>\n <CollapsibleRoot\n :data-orientation=\"rootContext.orientation\"\n :data-disabled=\"dataDisabled\"\n :data-state=\"dataState\"\n :disabled=\"disabled\"\n :open=\"open\"\n :as=\"props.as\"\n :as-child=\"props.asChild\"\n :unmount-on-hide=\"rootContext.unmountOnHide.value\"\n @keydown.up.down.left.right.home.end=\"handleArrowKey\"\n >\n <slot :open=\"open\" />\n </CollapsibleRoot>\n</template>\n"],"names":["createContext","injectAccordionRootContext","computed","useForwardExpose","useArrowNavigation"],"mappings":";;;;;;;;;AAqCO,MAAM,CAAC,0BAAA,EAA4B,2BAA2B,CAAA,GACjEA,mCAAoC,eAAe;;;;;;;;;;;AAOvD,IAAA,MAAM,KAAQ,GAAA,OAAA;AASd,IAAA,MAAM,cAAcC,kDAA2B,EAAA;AAE/C,IAAA,MAAM,IAAO,GAAAC,YAAA;AAAA,MAAS,MACpB,YAAY,QAAS,CAAA,KAAA,GACjB,MAAM,KAAU,KAAA,WAAA,CAAY,WAAW,KACvC,GAAA,KAAA,CAAM,QAAQ,WAAY,CAAA,UAAA,CAAW,KAAK,CACvC,IAAA,WAAA,CAAY,WAAW,KAAM,CAAA,QAAA,CAAS,MAAM,KAAK;AAAA,KAC1D;AAEA,IAAM,MAAA,QAAA,GAAWA,aAAS,MAAM;AAC9B,MAAQ,OAAA,WAAA,CAAY,QAAS,CAAA,KAAA,IAAS,KAAM,CAAA,QAAA;AAAA,KAC7C,CAAA;AAED,IAAA,MAAM,eAAeA,YAAS,CAAA,MAAO,QAAS,CAAA,KAAA,GAAQ,KAAK,MAAU,CAAA;AAErE,IAAA,MAAM,SAAY,GAAAA,YAAA;AAAA,MAAS,MACzB,IAAK,CAAA,KAAA,GAAQ,MAA0B,cAAA,QAAA;AAAA,KACzC;AAEA,IAAa,QAAA,CAAA,EAAE,IAAM,EAAA,YAAA,EAAc,CAAA;AACnC,IAAA,MAAM,EAAE,UAAA,EAAY,cAAe,EAAA,GAAIC,wCAAiB,EAAA;AAExD,IAA4B,2BAAA,CAAA;AAAA,MAC1B,IAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAW,EAAA,EAAA;AAAA,MACX,UAAA;AAAA,MACA,cAAA;AAAA,MACA,KAAO,EAAAD,YAAA,CAAS,MAAM,KAAA,CAAM,KAAK;AAAA,KAClC,CAAA;AAED,IAAA,SAAS,eAAe,CAAkB,EAAA;AACxC,MAAA,MAAM,SAAS,CAAE,CAAA,MAAA;AACjB,MAAM,MAAA,kBAAA,GAAoC,KAAM,CAAA,IAAA,CAAK,WAAY,CAAA,aAAA,CAAc,OAAO,gBAAiB,CAAA,6BAA6B,CAAK,IAAA,EAAE,CAAA;AAE3I,MAAA,MAAM,mBAAsB,GAAA,kBAAA,CAAmB,SAAU,CAAA,CAAA,IAAA,KAAQ,SAAS,MAAM,CAAA;AAChF,MAAA,IAAI,mBAAwB,KAAA,EAAA;AAC1B,QAAO,OAAA,IAAA;AAET,MAAAE,4CAAA;AAAA,QACE,CAAA;AAAA,QACA,MAAA;AAAA,QACA,YAAY,aAAc,CAAA,KAAA;AAAA,QAC1B;AAAA,UACE,iBAAiB,WAAY,CAAA,WAAA;AAAA,UAC7B,GAAA,EAAK,YAAY,SAAU,CAAA,KAAA;AAAA,UAC3B,KAAO,EAAA;AAAA;AACT,OACF;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccordionItem.js","sources":["../../src/Accordion/AccordionItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ComputedRef, VNodeRef } from 'vue'\nimport type { CollapsibleRootProps } from '../Collapsible'\nimport { createContext, useArrowNavigation, useForwardExpose } from '@/shared'\nimport { injectAccordionRootContext } from './AccordionRoot.vue'\n\nenum AccordionItemState {\n Open = 'open',\n Closed = 'closed',\n}\n\nexport interface AccordionItemProps\n extends Omit<CollapsibleRootProps, 'open' | 'defaultOpen' | 'onOpenChange'> {\n /**\n * Whether or not an accordion item is disabled from user interaction.\n * When `true`, prevents the user from interacting with the item.\n *\n * @defaultValue false\n */\n disabled?: boolean\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n */\n value: string\n}\n\ninterface AccordionItemContext {\n open: ComputedRef<boolean>\n dataState: ComputedRef<AccordionItemState>\n disabled: ComputedRef<boolean>\n dataDisabled: ComputedRef<'' | undefined>\n triggerId: string\n currentRef: VNodeRef\n currentElement: ComputedRef<HTMLElement | undefined>\n value: ComputedRef<string>\n}\n\nexport const [injectAccordionItemContext, provideAccordionItemContext]\n = createContext<AccordionItemContext>('AccordionItem')\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { CollapsibleRoot } from '@/Collapsible'\n\nconst props = defineProps<AccordionItemProps>()\n\ndefineSlots<{\n default?: (props: {\n /** Current open state */\n open: typeof open.value\n }) => any\n}>()\n\nconst rootContext = injectAccordionRootContext()\n\nconst open = computed(() =>\n rootContext.isSingle.value\n ? props.value === rootContext.modelValue.value\n : Array.isArray(rootContext.modelValue.value)\n && rootContext.modelValue.value.includes(props.value),\n)\n\nconst disabled = computed(() => {\n return (rootContext.disabled.value || props.disabled)\n})\n\nconst dataDisabled = computed(() => (disabled.value ? '' : undefined))\n\nconst dataState = computed(() =>\n open.value ? AccordionItemState.Open : AccordionItemState.Closed,\n)\n\ndefineExpose({ open, dataDisabled })\nconst { currentRef, currentElement } = useForwardExpose()\n\nprovideAccordionItemContext({\n open,\n dataState,\n disabled,\n dataDisabled,\n triggerId: '',\n currentRef,\n currentElement,\n value: computed(() => props.value),\n})\n\nfunction handleArrowKey(e: KeyboardEvent) {\n const target = e.target as HTMLElement\n const allCollectionItems: HTMLElement[] = Array.from(rootContext.parentElement.value?.querySelectorAll('[data-reka-collection-item]') ?? [])\n\n const collectionItemIndex = allCollectionItems.findIndex(item => item === target)\n if (collectionItemIndex === -1)\n return null\n\n useArrowNavigation(\n e,\n
|
|
1
|
+
{"version":3,"file":"AccordionItem.js","sources":["../../src/Accordion/AccordionItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ComputedRef, VNodeRef } from 'vue'\nimport type { CollapsibleRootProps } from '../Collapsible'\nimport { createContext, useArrowNavigation, useForwardExpose } from '@/shared'\nimport { injectAccordionRootContext } from './AccordionRoot.vue'\n\nenum AccordionItemState {\n Open = 'open',\n Closed = 'closed',\n}\n\nexport interface AccordionItemProps\n extends Omit<CollapsibleRootProps, 'open' | 'defaultOpen' | 'onOpenChange'> {\n /**\n * Whether or not an accordion item is disabled from user interaction.\n * When `true`, prevents the user from interacting with the item.\n *\n * @defaultValue false\n */\n disabled?: boolean\n /**\n * A string value for the accordion item. All items within an accordion should use a unique value.\n */\n value: string\n}\n\ninterface AccordionItemContext {\n open: ComputedRef<boolean>\n dataState: ComputedRef<AccordionItemState>\n disabled: ComputedRef<boolean>\n dataDisabled: ComputedRef<'' | undefined>\n triggerId: string\n currentRef: VNodeRef\n currentElement: ComputedRef<HTMLElement | undefined>\n value: ComputedRef<string>\n}\n\nexport const [injectAccordionItemContext, provideAccordionItemContext]\n = createContext<AccordionItemContext>('AccordionItem')\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { CollapsibleRoot } from '@/Collapsible'\n\nconst props = defineProps<AccordionItemProps>()\n\ndefineSlots<{\n default?: (props: {\n /** Current open state */\n open: typeof open.value\n }) => any\n}>()\n\nconst rootContext = injectAccordionRootContext()\n\nconst open = computed(() =>\n rootContext.isSingle.value\n ? props.value === rootContext.modelValue.value\n : Array.isArray(rootContext.modelValue.value)\n && rootContext.modelValue.value.includes(props.value),\n)\n\nconst disabled = computed(() => {\n return (rootContext.disabled.value || props.disabled)\n})\n\nconst dataDisabled = computed(() => (disabled.value ? '' : undefined))\n\nconst dataState = computed(() =>\n open.value ? AccordionItemState.Open : AccordionItemState.Closed,\n)\n\ndefineExpose({ open, dataDisabled })\nconst { currentRef, currentElement } = useForwardExpose()\n\nprovideAccordionItemContext({\n open,\n dataState,\n disabled,\n dataDisabled,\n triggerId: '',\n currentRef,\n currentElement,\n value: computed(() => props.value),\n})\n\nfunction handleArrowKey(e: KeyboardEvent) {\n const target = e.target as HTMLElement\n const allCollectionItems: HTMLElement[] = Array.from(rootContext.parentElement.value?.querySelectorAll('[data-reka-collection-item]') ?? [])\n\n const collectionItemIndex = allCollectionItems.findIndex(item => item === target)\n if (collectionItemIndex === -1)\n return null\n\n useArrowNavigation(\n e,\n target,\n rootContext.parentElement.value!,\n {\n arrowKeyOptions: rootContext.orientation,\n dir: rootContext.direction.value,\n focus: true,\n },\n )\n}\n</script>\n\n<template>\n <CollapsibleRoot\n :data-orientation=\"rootContext.orientation\"\n :data-disabled=\"dataDisabled\"\n :data-state=\"dataState\"\n :disabled=\"disabled\"\n :open=\"open\"\n :as=\"props.as\"\n :as-child=\"props.asChild\"\n :unmount-on-hide=\"rootContext.unmountOnHide.value\"\n @keydown.up.down.left.right.home.end=\"handleArrowKey\"\n >\n <slot :open=\"open\" />\n </CollapsibleRoot>\n</template>\n"],"names":[],"mappings":";;;;;;;AAqCO,MAAM,CAAC,0BAAA,EAA4B,2BAA2B,CAAA,GACjE,cAAoC,eAAe;;;;;;;;;;;AAOvD,IAAA,MAAM,KAAQ,GAAA,OAAA;AASd,IAAA,MAAM,cAAc,0BAA2B,EAAA;AAE/C,IAAA,MAAM,IAAO,GAAA,QAAA;AAAA,MAAS,MACpB,YAAY,QAAS,CAAA,KAAA,GACjB,MAAM,KAAU,KAAA,WAAA,CAAY,WAAW,KACvC,GAAA,KAAA,CAAM,QAAQ,WAAY,CAAA,UAAA,CAAW,KAAK,CACvC,IAAA,WAAA,CAAY,WAAW,KAAM,CAAA,QAAA,CAAS,MAAM,KAAK;AAAA,KAC1D;AAEA,IAAM,MAAA,QAAA,GAAW,SAAS,MAAM;AAC9B,MAAQ,OAAA,WAAA,CAAY,QAAS,CAAA,KAAA,IAAS,KAAM,CAAA,QAAA;AAAA,KAC7C,CAAA;AAED,IAAA,MAAM,eAAe,QAAS,CAAA,MAAO,QAAS,CAAA,KAAA,GAAQ,KAAK,MAAU,CAAA;AAErE,IAAA,MAAM,SAAY,GAAA,QAAA;AAAA,MAAS,MACzB,IAAK,CAAA,KAAA,GAAQ,MAA0B,cAAA,QAAA;AAAA,KACzC;AAEA,IAAa,QAAA,CAAA,EAAE,IAAM,EAAA,YAAA,EAAc,CAAA;AACnC,IAAA,MAAM,EAAE,UAAA,EAAY,cAAe,EAAA,GAAI,gBAAiB,EAAA;AAExD,IAA4B,2BAAA,CAAA;AAAA,MAC1B,IAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,SAAW,EAAA,EAAA;AAAA,MACX,UAAA;AAAA,MACA,cAAA;AAAA,MACA,KAAO,EAAA,QAAA,CAAS,MAAM,KAAA,CAAM,KAAK;AAAA,KAClC,CAAA;AAED,IAAA,SAAS,eAAe,CAAkB,EAAA;AACxC,MAAA,MAAM,SAAS,CAAE,CAAA,MAAA;AACjB,MAAM,MAAA,kBAAA,GAAoC,KAAM,CAAA,IAAA,CAAK,WAAY,CAAA,aAAA,CAAc,OAAO,gBAAiB,CAAA,6BAA6B,CAAK,IAAA,EAAE,CAAA;AAE3I,MAAA,MAAM,mBAAsB,GAAA,kBAAA,CAAmB,SAAU,CAAA,CAAA,IAAA,KAAQ,SAAS,MAAM,CAAA;AAChF,MAAA,IAAI,mBAAwB,KAAA,EAAA;AAC1B,QAAO,OAAA,IAAA;AAET,MAAA,kBAAA;AAAA,QACE,CAAA;AAAA,QACA,MAAA;AAAA,QACA,YAAY,aAAc,CAAA,KAAA;AAAA,QAC1B;AAAA,UACE,iBAAiB,WAAY,CAAA,WAAA;AAAA,UAC7B,GAAA,EAAK,YAAY,SAAU,CAAA,KAAA;AAAA,UAC3B,KAAO,EAAA;AAAA;AACT,OACF;AAAA;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialogContent.cjs","sources":["../../src/AlertDialog/AlertDialogContent.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type {\n DialogContentEmits,\n DialogContentProps,\n} from '@/Dialog'\nimport { createContext, useEmitAsProps, useForwardExpose } from '@/shared'\n\ninterface AlertDialogContentContext {\n onCancelElementChange: (el: HTMLElement | undefined) => void\n}\n\nexport const [injectAlertDialogContentContext, provideAlertDialogContentContext]\n = createContext<AlertDialogContentContext>('AlertDialogContent')\n\nexport type AlertDialogContentEmits = DialogContentEmits\nexport interface AlertDialogContentProps extends DialogContentProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { nextTick, ref } from 'vue'\nimport { DialogContent } from '@/Dialog'\n\nconst props = defineProps<AlertDialogContentProps>()\nconst emits = defineEmits<AlertDialogContentEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\nuseForwardExpose()\n\nconst cancelElement = ref<HTMLElement | undefined>()\n\nprovideAlertDialogContentContext({\n onCancelElementChange: (el) => {\n cancelElement.value = el\n },\n})\n</script>\n\n<template>\n <DialogContent\n v-bind=\"{ ...props, ...emitsAsProps }\"\n role=\"alertdialog\"\n @pointer-down-outside.prevent\n @interact-outside.prevent\n @open-auto-focus=\"\n () => {\n nextTick(() => {\n cancelElement?.focus({\n preventScroll: true,\n });\n });\n }\n \"\n >\n <slot />\n </DialogContent>\n</template>\n"],"names":["createContext","useEmitAsProps","useForwardExpose","ref"],"mappings":";;;;;;;;AAWO,MAAM,CAAC,+BAAA,EAAiC,gCAAgC,CAAA,GAC3EA,mCAAyC,oBAAoB
|
|
1
|
+
{"version":3,"file":"AlertDialogContent.cjs","sources":["../../src/AlertDialog/AlertDialogContent.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type {\n DialogContentEmits,\n DialogContentProps,\n} from '@/Dialog'\nimport { createContext, useEmitAsProps, useForwardExpose } from '@/shared'\n\ninterface AlertDialogContentContext {\n onCancelElementChange: (el: HTMLElement | undefined) => void\n}\n\nexport const [injectAlertDialogContentContext, provideAlertDialogContentContext]\n = createContext<AlertDialogContentContext>('AlertDialogContent')\n\nexport type AlertDialogContentEmits = DialogContentEmits\nexport interface AlertDialogContentProps extends DialogContentProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { nextTick, ref } from 'vue'\nimport { DialogContent } from '@/Dialog'\n\nconst props = defineProps<AlertDialogContentProps>()\nconst emits = defineEmits<AlertDialogContentEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\nuseForwardExpose()\n\nconst cancelElement = ref<HTMLElement | undefined>()\n\nprovideAlertDialogContentContext({\n onCancelElementChange: (el) => {\n cancelElement.value = el\n },\n})\n</script>\n\n<template>\n <DialogContent\n v-bind=\"{ ...props, ...emitsAsProps }\"\n role=\"alertdialog\"\n @pointer-down-outside.prevent\n @interact-outside.prevent\n @open-auto-focus=\"\n () => {\n nextTick(() => {\n cancelElement?.focus({\n preventScroll: true,\n });\n });\n }\n \"\n >\n <slot />\n </DialogContent>\n</template>\n"],"names":["createContext","useEmitAsProps","useForwardExpose","ref"],"mappings":";;;;;;;;AAWO,MAAM,CAAC,+BAAA,EAAiC,gCAAgC,CAAA,GAC3EA,mCAAyC,oBAAoB;;;;;;;;;;;AAUjE,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAEd,IAAM,MAAA,YAAA,GAAeC,qCAAe,KAAK,CAAA;AACzC,IAAiBC,wCAAA,EAAA;AAEjB,IAAA,MAAM,gBAAgBC,OAA6B,EAAA;AAEnD,IAAiC,gCAAA,CAAA;AAAA,MAC/B,qBAAA,EAAuB,CAAC,EAAO,KAAA;AAC7B,QAAA,aAAA,CAAc,KAAQ,GAAA,EAAA;AAAA;AACxB,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AlertDialogContent.js","sources":["../../src/AlertDialog/AlertDialogContent.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type {\n DialogContentEmits,\n DialogContentProps,\n} from '@/Dialog'\nimport { createContext, useEmitAsProps, useForwardExpose } from '@/shared'\n\ninterface AlertDialogContentContext {\n onCancelElementChange: (el: HTMLElement | undefined) => void\n}\n\nexport const [injectAlertDialogContentContext, provideAlertDialogContentContext]\n = createContext<AlertDialogContentContext>('AlertDialogContent')\n\nexport type AlertDialogContentEmits = DialogContentEmits\nexport interface AlertDialogContentProps extends DialogContentProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { nextTick, ref } from 'vue'\nimport { DialogContent } from '@/Dialog'\n\nconst props = defineProps<AlertDialogContentProps>()\nconst emits = defineEmits<AlertDialogContentEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\nuseForwardExpose()\n\nconst cancelElement = ref<HTMLElement | undefined>()\n\nprovideAlertDialogContentContext({\n onCancelElementChange: (el) => {\n cancelElement.value = el\n },\n})\n</script>\n\n<template>\n <DialogContent\n v-bind=\"{ ...props, ...emitsAsProps }\"\n role=\"alertdialog\"\n @pointer-down-outside.prevent\n @interact-outside.prevent\n @open-auto-focus=\"\n () => {\n nextTick(() => {\n cancelElement?.focus({\n preventScroll: true,\n });\n });\n }\n \"\n >\n <slot />\n </DialogContent>\n</template>\n"],"names":[],"mappings":";;;;;;AAWO,MAAM,CAAC,+BAAA,EAAiC,gCAAgC,CAAA,GAC3E,cAAyC,oBAAoB
|
|
1
|
+
{"version":3,"file":"AlertDialogContent.js","sources":["../../src/AlertDialog/AlertDialogContent.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type {\n DialogContentEmits,\n DialogContentProps,\n} from '@/Dialog'\nimport { createContext, useEmitAsProps, useForwardExpose } from '@/shared'\n\ninterface AlertDialogContentContext {\n onCancelElementChange: (el: HTMLElement | undefined) => void\n}\n\nexport const [injectAlertDialogContentContext, provideAlertDialogContentContext]\n = createContext<AlertDialogContentContext>('AlertDialogContent')\n\nexport type AlertDialogContentEmits = DialogContentEmits\nexport interface AlertDialogContentProps extends DialogContentProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { nextTick, ref } from 'vue'\nimport { DialogContent } from '@/Dialog'\n\nconst props = defineProps<AlertDialogContentProps>()\nconst emits = defineEmits<AlertDialogContentEmits>()\n\nconst emitsAsProps = useEmitAsProps(emits)\nuseForwardExpose()\n\nconst cancelElement = ref<HTMLElement | undefined>()\n\nprovideAlertDialogContentContext({\n onCancelElementChange: (el) => {\n cancelElement.value = el\n },\n})\n</script>\n\n<template>\n <DialogContent\n v-bind=\"{ ...props, ...emitsAsProps }\"\n role=\"alertdialog\"\n @pointer-down-outside.prevent\n @interact-outside.prevent\n @open-auto-focus=\"\n () => {\n nextTick(() => {\n cancelElement?.focus({\n preventScroll: true,\n });\n });\n }\n \"\n >\n <slot />\n </DialogContent>\n</template>\n"],"names":[],"mappings":";;;;;;AAWO,MAAM,CAAC,+BAAA,EAAiC,gCAAgC,CAAA,GAC3E,cAAyC,oBAAoB;;;;;;;;;;;AAUjE,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAEd,IAAM,MAAA,YAAA,GAAe,eAAe,KAAK,CAAA;AACzC,IAAiB,gBAAA,EAAA;AAEjB,IAAA,MAAM,gBAAgB,GAA6B,EAAA;AAEnD,IAAiC,gCAAA,CAAA;AAAA,MAC/B,qBAAA,EAAuB,CAAC,EAAO,KAAA;AAC7B,QAAA,aAAA,CAAc,KAAQ,GAAA,EAAA;AAAA;AACxB,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -16,7 +16,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
16
16
|
shared_useForwardExpose.useForwardExpose();
|
|
17
17
|
const rootContext = Combobox_ComboboxRoot.injectComboboxRootContext();
|
|
18
18
|
function handleClick() {
|
|
19
|
-
rootContext.
|
|
19
|
+
rootContext.filterSearch.value = "";
|
|
20
20
|
if (rootContext.inputElement.value) {
|
|
21
21
|
rootContext.inputElement.value.value = "";
|
|
22
22
|
rootContext.inputElement.value.focus();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxCancel.cjs","sources":["../../src/Combobox/ComboboxCancel.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\n\nexport interface ComboboxCancelProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { useForwardExpose } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = withDefaults(defineProps<ComboboxCancelProps>(), {\n as: 'button',\n})\n\nuseForwardExpose()\nconst rootContext = injectComboboxRootContext()\n\nfunction handleClick() {\n // Reset the search to show all options.\n rootContext.
|
|
1
|
+
{"version":3,"file":"ComboboxCancel.cjs","sources":["../../src/Combobox/ComboboxCancel.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\n\nexport interface ComboboxCancelProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { useForwardExpose } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = withDefaults(defineProps<ComboboxCancelProps>(), {\n as: 'button',\n})\n\nuseForwardExpose()\nconst rootContext = injectComboboxRootContext()\n\nfunction handleClick() {\n // Reset the search to show all options.\n rootContext.filterSearch.value = ''\n\n if (rootContext.inputElement.value) {\n rootContext.inputElement.value.value = ''\n rootContext.inputElement.value.focus()\n }\n}\n</script>\n\n<template>\n <Primitive\n :type=\"as === 'button' ? 'button' : undefined\"\n v-bind=\"props\"\n tabindex=\"-1\"\n @click=\"handleClick\"\n >\n <slot />\n </Primitive>\n</template>\n"],"names":["useForwardExpose","injectComboboxRootContext"],"mappings":";;;;;;;;;;;;;;AAWA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAiBA,wCAAA,EAAA;AACjB,IAAA,MAAM,cAAcC,+CAA0B,EAAA;AAE9C,IAAA,SAAS,WAAc,GAAA;AAErB,MAAA,WAAA,CAAY,aAAa,KAAQ,GAAA,EAAA;AAEjC,MAAI,IAAA,WAAA,CAAY,aAAa,KAAO,EAAA;AAClC,QAAY,WAAA,CAAA,YAAA,CAAa,MAAM,KAAQ,GAAA,EAAA;AACvC,QAAY,WAAA,CAAA,YAAA,CAAa,MAAM,KAAM,EAAA;AAAA;AACvC;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -14,7 +14,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
14
14
|
useForwardExpose();
|
|
15
15
|
const rootContext = injectComboboxRootContext();
|
|
16
16
|
function handleClick() {
|
|
17
|
-
rootContext.
|
|
17
|
+
rootContext.filterSearch.value = "";
|
|
18
18
|
if (rootContext.inputElement.value) {
|
|
19
19
|
rootContext.inputElement.value.value = "";
|
|
20
20
|
rootContext.inputElement.value.focus();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxCancel.js","sources":["../../src/Combobox/ComboboxCancel.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\n\nexport interface ComboboxCancelProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { useForwardExpose } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = withDefaults(defineProps<ComboboxCancelProps>(), {\n as: 'button',\n})\n\nuseForwardExpose()\nconst rootContext = injectComboboxRootContext()\n\nfunction handleClick() {\n // Reset the search to show all options.\n rootContext.
|
|
1
|
+
{"version":3,"file":"ComboboxCancel.js","sources":["../../src/Combobox/ComboboxCancel.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\n\nexport interface ComboboxCancelProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { useForwardExpose } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = withDefaults(defineProps<ComboboxCancelProps>(), {\n as: 'button',\n})\n\nuseForwardExpose()\nconst rootContext = injectComboboxRootContext()\n\nfunction handleClick() {\n // Reset the search to show all options.\n rootContext.filterSearch.value = ''\n\n if (rootContext.inputElement.value) {\n rootContext.inputElement.value.value = ''\n rootContext.inputElement.value.focus()\n }\n}\n</script>\n\n<template>\n <Primitive\n :type=\"as === 'button' ? 'button' : undefined\"\n v-bind=\"props\"\n tabindex=\"-1\"\n @click=\"handleClick\"\n >\n <slot />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;AAWA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAiB,gBAAA,EAAA;AACjB,IAAA,MAAM,cAAc,yBAA0B,EAAA;AAE9C,IAAA,SAAS,WAAc,GAAA;AAErB,MAAA,WAAA,CAAY,aAAa,KAAQ,GAAA,EAAA;AAEjC,MAAI,IAAA,WAAA,CAAY,aAAa,KAAO,EAAA;AAClC,QAAY,WAAA,CAAA,YAAA,CAAa,MAAM,KAAQ,GAAA,EAAA;AACvC,QAAY,WAAA,CAAA,YAAA,CAAa,MAAM,KAAM,EAAA;AAAA;AACvC;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -14,7 +14,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
14
14
|
const props = __props;
|
|
15
15
|
const rootContext = Combobox_ComboboxRoot.injectComboboxRootContext();
|
|
16
16
|
const isRender = vue.computed(
|
|
17
|
-
() => rootContext.ignoreFilter.value ? rootContext.allItems.value.size === 0 :
|
|
17
|
+
() => rootContext.ignoreFilter.value ? rootContext.allItems.value.size === 0 : rootContext.filterState.value.count === 0
|
|
18
18
|
);
|
|
19
19
|
return (_ctx, _cache) => {
|
|
20
20
|
return isRender.value ? (vue.openBlock(), vue.createBlock(vue.unref(Primitive_Primitive.Primitive), vue.normalizeProps(vue.mergeProps({ key: 0 }, props)), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxEmpty.cjs","sources":["../../src/Combobox/ComboboxEmpty.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { computed } from 'vue'\n\nexport interface ComboboxEmptyProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = defineProps<ComboboxEmptyProps>()\nconst rootContext = injectComboboxRootContext()\n\nconst isRender = computed(() => rootContext.ignoreFilter.value\n ? rootContext.allItems.value.size === 0\n :
|
|
1
|
+
{"version":3,"file":"ComboboxEmpty.cjs","sources":["../../src/Combobox/ComboboxEmpty.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { computed } from 'vue'\n\nexport interface ComboboxEmptyProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = defineProps<ComboboxEmptyProps>()\nconst rootContext = injectComboboxRootContext()\n\nconst isRender = computed(() => rootContext.ignoreFilter.value\n ? rootContext.allItems.value.size === 0\n : rootContext.filterState.value.count === 0,\n)\n</script>\n\n<template>\n <Primitive\n v-if=\"isRender\"\n v-bind=\"props\"\n >\n <slot>No options</slot>\n </Primitive>\n</template>\n"],"names":["injectComboboxRootContext","computed"],"mappings":";;;;;;;;;;;;;AAWA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,cAAcA,+CAA0B,EAAA;AAE9C,IAAA,MAAM,QAAW,GAAAC,YAAA;AAAA,MAAS,MAAM,WAAA,CAAY,YAAa,CAAA,KAAA,GACrD,WAAY,CAAA,QAAA,CAAS,KAAM,CAAA,IAAA,KAAS,CACpC,GAAA,WAAA,CAAY,WAAY,CAAA,KAAA,CAAM,KAAU,KAAA;AAAA,KAC5C;;;;;;;;;;;;;;;;"}
|
|
@@ -12,7 +12,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
12
12
|
const props = __props;
|
|
13
13
|
const rootContext = injectComboboxRootContext();
|
|
14
14
|
const isRender = computed(
|
|
15
|
-
() => rootContext.ignoreFilter.value ? rootContext.allItems.value.size === 0 :
|
|
15
|
+
() => rootContext.ignoreFilter.value ? rootContext.allItems.value.size === 0 : rootContext.filterState.value.count === 0
|
|
16
16
|
);
|
|
17
17
|
return (_ctx, _cache) => {
|
|
18
18
|
return isRender.value ? (openBlock(), createBlock(unref(Primitive), normalizeProps(mergeProps({ key: 0 }, props)), {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxEmpty.js","sources":["../../src/Combobox/ComboboxEmpty.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { computed } from 'vue'\n\nexport interface ComboboxEmptyProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = defineProps<ComboboxEmptyProps>()\nconst rootContext = injectComboboxRootContext()\n\nconst isRender = computed(() => rootContext.ignoreFilter.value\n ? rootContext.allItems.value.size === 0\n :
|
|
1
|
+
{"version":3,"file":"ComboboxEmpty.js","sources":["../../src/Combobox/ComboboxEmpty.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { computed } from 'vue'\n\nexport interface ComboboxEmptyProps extends PrimitiveProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport { Primitive } from '@/Primitive'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = defineProps<ComboboxEmptyProps>()\nconst rootContext = injectComboboxRootContext()\n\nconst isRender = computed(() => rootContext.ignoreFilter.value\n ? rootContext.allItems.value.size === 0\n : rootContext.filterState.value.count === 0,\n)\n</script>\n\n<template>\n <Primitive\n v-if=\"isRender\"\n v-bind=\"props\"\n >\n <slot>No options</slot>\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;AAWA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,cAAc,yBAA0B,EAAA;AAE9C,IAAA,MAAM,QAAW,GAAA,QAAA;AAAA,MAAS,MAAM,WAAA,CAAY,YAAa,CAAA,KAAA,GACrD,WAAY,CAAA,QAAA,CAAS,KAAM,CAAA,IAAA,KAAS,CACpC,GAAA,WAAA,CAAY,WAAY,CAAA,KAAA,CAAM,KAAU,KAAA;AAAA,KAC5C;;;;;;;;;;;;;;;;"}
|
|
@@ -17,7 +17,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
17
17
|
const props = __props;
|
|
18
18
|
const id = shared_useId.useId(void 0, "reka-combobox-group");
|
|
19
19
|
const rootContext = Combobox_ComboboxRoot.injectComboboxRootContext();
|
|
20
|
-
const isRender = vue.computed(() => rootContext.ignoreFilter.value ? true : !rootContext.
|
|
20
|
+
const isRender = vue.computed(() => rootContext.ignoreFilter.value ? true : !rootContext.filterSearch.value ? true : rootContext.filterState.value.groups.has(id));
|
|
21
21
|
const context = provideComboboxGroupContext({
|
|
22
22
|
id,
|
|
23
23
|
labelId: ""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxGroup.cjs","sources":["../../src/Combobox/ComboboxGroup.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxGroupProps } from '@/Listbox'\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { createContext, useId } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nexport interface ComboboxGroupProps extends ListboxGroupProps {}\n\ntype ComboboxGroupContext = {\n id: string\n labelId: string\n}\n\nexport const [injectComboboxGroupContext, provideComboboxGroupContext]\n = createContext<ComboboxGroupContext>('ComboboxGroup')\n</script>\n\n<script setup lang=\"ts\">\nimport { ListboxGroup } from '@/Listbox'\n\nconst props = defineProps<ComboboxGroupProps>()\nconst id = useId(undefined, 'reka-combobox-group')\nconst rootContext = injectComboboxRootContext()\n\nconst isRender = computed(() => rootContext.ignoreFilter.value ? true : !rootContext.
|
|
1
|
+
{"version":3,"file":"ComboboxGroup.cjs","sources":["../../src/Combobox/ComboboxGroup.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxGroupProps } from '@/Listbox'\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { createContext, useId } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nexport interface ComboboxGroupProps extends ListboxGroupProps {}\n\ntype ComboboxGroupContext = {\n id: string\n labelId: string\n}\n\nexport const [injectComboboxGroupContext, provideComboboxGroupContext]\n = createContext<ComboboxGroupContext>('ComboboxGroup')\n</script>\n\n<script setup lang=\"ts\">\nimport { ListboxGroup } from '@/Listbox'\n\nconst props = defineProps<ComboboxGroupProps>()\nconst id = useId(undefined, 'reka-combobox-group')\nconst rootContext = injectComboboxRootContext()\n\nconst isRender = computed(() => rootContext.ignoreFilter.value ? true : !rootContext.filterSearch.value ? true : rootContext.filterState.value.groups.has(id))\n\nconst context = provideComboboxGroupContext({\n id,\n labelId: '',\n})\n\nonMounted(() => {\n if (!rootContext.allGroups.value.has(id))\n rootContext.allGroups.value.set(id, new Set())\n})\nonUnmounted(() => {\n rootContext.allGroups.value.delete(id)\n})\n</script>\n\n<template>\n <ListboxGroup\n :id=\"id\"\n :aria-labelledby=\"context.labelId\"\n v-bind=\"props\"\n :hidden=\"isRender ? undefined : true\"\n >\n <slot />\n </ListboxGroup>\n</template>\n"],"names":["createContext","useId","injectComboboxRootContext","computed","onMounted","onUnmounted"],"mappings":";;;;;;;;AAaO,MAAM,CAAC,0BAAA,EAA4B,2BAA2B,CAAA,GACjEA,mCAAoC,eAAe;;;;;;;;AAMvD,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAM,MAAA,EAAA,GAAKC,kBAAM,CAAA,MAAA,EAAW,qBAAqB,CAAA;AACjD,IAAA,MAAM,cAAcC,+CAA0B,EAAA;AAE9C,IAAA,MAAM,WAAWC,YAAS,CAAA,MAAM,YAAY,YAAa,CAAA,KAAA,GAAQ,OAAO,CAAC,WAAA,CAAY,YAAa,CAAA,KAAA,GAAQ,OAAO,WAAY,CAAA,WAAA,CAAY,MAAM,MAAO,CAAA,GAAA,CAAI,EAAE,CAAC,CAAA;AAE7J,IAAA,MAAM,UAAU,2BAA4B,CAAA;AAAA,MAC1C,EAAA;AAAA,MACA,OAAS,EAAA;AAAA,KACV,CAAA;AAED,IAAAC,aAAA,CAAU,MAAM;AACd,MAAA,IAAI,CAAC,WAAA,CAAY,SAAU,CAAA,KAAA,CAAM,IAAI,EAAE,CAAA;AACrC,QAAA,WAAA,CAAY,UAAU,KAAM,CAAA,GAAA,CAAI,EAAI,kBAAA,IAAI,KAAK,CAAA;AAAA,KAChD,CAAA;AACD,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAY,WAAA,CAAA,SAAA,CAAU,KAAM,CAAA,MAAA,CAAO,EAAE,CAAA;AAAA,KACtC,CAAA;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -15,7 +15,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
15
15
|
const props = __props;
|
|
16
16
|
const id = useId(void 0, "reka-combobox-group");
|
|
17
17
|
const rootContext = injectComboboxRootContext();
|
|
18
|
-
const isRender = computed(() => rootContext.ignoreFilter.value ? true : !rootContext.
|
|
18
|
+
const isRender = computed(() => rootContext.ignoreFilter.value ? true : !rootContext.filterSearch.value ? true : rootContext.filterState.value.groups.has(id));
|
|
19
19
|
const context = provideComboboxGroupContext({
|
|
20
20
|
id,
|
|
21
21
|
labelId: ""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxGroup.js","sources":["../../src/Combobox/ComboboxGroup.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxGroupProps } from '@/Listbox'\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { createContext, useId } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nexport interface ComboboxGroupProps extends ListboxGroupProps {}\n\ntype ComboboxGroupContext = {\n id: string\n labelId: string\n}\n\nexport const [injectComboboxGroupContext, provideComboboxGroupContext]\n = createContext<ComboboxGroupContext>('ComboboxGroup')\n</script>\n\n<script setup lang=\"ts\">\nimport { ListboxGroup } from '@/Listbox'\n\nconst props = defineProps<ComboboxGroupProps>()\nconst id = useId(undefined, 'reka-combobox-group')\nconst rootContext = injectComboboxRootContext()\n\nconst isRender = computed(() => rootContext.ignoreFilter.value ? true : !rootContext.
|
|
1
|
+
{"version":3,"file":"ComboboxGroup.js","sources":["../../src/Combobox/ComboboxGroup.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxGroupProps } from '@/Listbox'\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { createContext, useId } from '@/shared'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nexport interface ComboboxGroupProps extends ListboxGroupProps {}\n\ntype ComboboxGroupContext = {\n id: string\n labelId: string\n}\n\nexport const [injectComboboxGroupContext, provideComboboxGroupContext]\n = createContext<ComboboxGroupContext>('ComboboxGroup')\n</script>\n\n<script setup lang=\"ts\">\nimport { ListboxGroup } from '@/Listbox'\n\nconst props = defineProps<ComboboxGroupProps>()\nconst id = useId(undefined, 'reka-combobox-group')\nconst rootContext = injectComboboxRootContext()\n\nconst isRender = computed(() => rootContext.ignoreFilter.value ? true : !rootContext.filterSearch.value ? true : rootContext.filterState.value.groups.has(id))\n\nconst context = provideComboboxGroupContext({\n id,\n labelId: '',\n})\n\nonMounted(() => {\n if (!rootContext.allGroups.value.has(id))\n rootContext.allGroups.value.set(id, new Set())\n})\nonUnmounted(() => {\n rootContext.allGroups.value.delete(id)\n})\n</script>\n\n<template>\n <ListboxGroup\n :id=\"id\"\n :aria-labelledby=\"context.labelId\"\n v-bind=\"props\"\n :hidden=\"isRender ? undefined : true\"\n >\n <slot />\n </ListboxGroup>\n</template>\n"],"names":[],"mappings":";;;;;;AAaO,MAAM,CAAC,0BAAA,EAA4B,2BAA2B,CAAA,GACjE,cAAoC,eAAe;;;;;;;;AAMvD,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAM,MAAA,EAAA,GAAK,KAAM,CAAA,MAAA,EAAW,qBAAqB,CAAA;AACjD,IAAA,MAAM,cAAc,yBAA0B,EAAA;AAE9C,IAAA,MAAM,WAAW,QAAS,CAAA,MAAM,YAAY,YAAa,CAAA,KAAA,GAAQ,OAAO,CAAC,WAAA,CAAY,YAAa,CAAA,KAAA,GAAQ,OAAO,WAAY,CAAA,WAAA,CAAY,MAAM,MAAO,CAAA,GAAA,CAAI,EAAE,CAAC,CAAA;AAE7J,IAAA,MAAM,UAAU,2BAA4B,CAAA;AAAA,MAC1C,EAAA;AAAA,MACA,OAAS,EAAA;AAAA,KACV,CAAA;AAED,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,CAAC,WAAA,CAAY,SAAU,CAAA,KAAA,CAAM,IAAI,EAAE,CAAA;AACrC,QAAA,WAAA,CAAY,UAAU,KAAM,CAAA,GAAA,CAAI,EAAI,kBAAA,IAAI,KAAK,CAAA;AAAA,KAChD,CAAA;AACD,IAAA,WAAA,CAAY,MAAM;AAChB,MAAY,WAAA,CAAA,SAAA,CAAU,KAAM,CAAA,MAAA,CAAO,EAAE,CAAA;AAAA,KACtC,CAAA;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -41,12 +41,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
41
41
|
rootContext.onOpenChange(true);
|
|
42
42
|
vue.nextTick(() => {
|
|
43
43
|
if (target.value) {
|
|
44
|
-
rootContext.
|
|
45
|
-
listboxContext.highlightFirstItem(
|
|
44
|
+
rootContext.filterSearch.value = target.value;
|
|
45
|
+
listboxContext.highlightFirstItem();
|
|
46
46
|
}
|
|
47
47
|
});
|
|
48
48
|
} else {
|
|
49
|
-
rootContext.
|
|
49
|
+
rootContext.filterSearch.value = target.value;
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
function resetSearchTerm() {
|
|
@@ -71,14 +71,11 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
71
71
|
if (!rootContext.isUserInputted.value && rootContext.resetSearchTermOnSelect.value)
|
|
72
72
|
resetSearchTerm();
|
|
73
73
|
}, { immediate: true, deep: true });
|
|
74
|
-
vue.watch(
|
|
75
|
-
()
|
|
76
|
-
|
|
77
|
-
if (props.modelValue !== void 0) {
|
|
78
|
-
rootContext.filterState.search = props.modelValue;
|
|
79
|
-
}
|
|
74
|
+
vue.watch(rootContext.filterState, () => {
|
|
75
|
+
if (!rootContext.isVirtual.value) {
|
|
76
|
+
listboxContext.highlightFirstItem();
|
|
80
77
|
}
|
|
81
|
-
);
|
|
78
|
+
});
|
|
82
79
|
return (_ctx, _cache) => {
|
|
83
80
|
return vue.openBlock(), vue.createBlock(vue.unref(Listbox_ListboxFilter._sfc_main), {
|
|
84
81
|
ref_key: "primitiveElement",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxInput.cjs","sources":["../../src/Combobox/ComboboxInput.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxFilterEmits, ListboxFilterProps } from '@/Listbox'\nimport { useVModel } from '@vueuse/core'\nimport { nextTick, onMounted, watch } from 'vue'\nimport { usePrimitiveElement } from '@/Primitive'\n\nexport type ComboboxInputEmits = ListboxFilterEmits\nexport interface ComboboxInputProps extends ListboxFilterProps {\n /** The display value of input for selected item. Does not work with `multiple`. */\n displayValue?: (val: any) => string\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ListboxFilter } from '@/Listbox'\nimport { injectListboxRootContext } from '@/Listbox/ListboxRoot.vue'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = withDefaults(defineProps<ComboboxInputProps>(), {\n as: 'input',\n})\nconst emits = defineEmits<ComboboxInputEmits>()\n\nconst rootContext = injectComboboxRootContext()\nconst listboxContext = injectListboxRootContext()\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n passive: (props.modelValue === undefined) as false,\n})\n\nonMounted(() => {\n if (currentElement.value)\n rootContext.onInputElementChange(currentElement.value as HTMLInputElement)\n})\n\nfunction handleKeyDown(ev: KeyboardEvent) {\n if (!rootContext.open.value)\n rootContext.onOpenChange(true)\n}\n\nfunction handleInput(event: InputEvent) {\n const target = event.target as HTMLInputElement\n if (!rootContext.open.value) {\n rootContext.onOpenChange(true)\n nextTick(() => {\n if (target.value) {\n rootContext.
|
|
1
|
+
{"version":3,"file":"ComboboxInput.cjs","sources":["../../src/Combobox/ComboboxInput.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxFilterEmits, ListboxFilterProps } from '@/Listbox'\nimport { useVModel } from '@vueuse/core'\nimport { nextTick, onMounted, watch } from 'vue'\nimport { usePrimitiveElement } from '@/Primitive'\n\nexport type ComboboxInputEmits = ListboxFilterEmits\nexport interface ComboboxInputProps extends ListboxFilterProps {\n /** The display value of input for selected item. Does not work with `multiple`. */\n displayValue?: (val: any) => string\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ListboxFilter } from '@/Listbox'\nimport { injectListboxRootContext } from '@/Listbox/ListboxRoot.vue'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = withDefaults(defineProps<ComboboxInputProps>(), {\n as: 'input',\n})\nconst emits = defineEmits<ComboboxInputEmits>()\n\nconst rootContext = injectComboboxRootContext()\nconst listboxContext = injectListboxRootContext()\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n passive: (props.modelValue === undefined) as false,\n})\n\nonMounted(() => {\n if (currentElement.value)\n rootContext.onInputElementChange(currentElement.value as HTMLInputElement)\n})\n\nfunction handleKeyDown(ev: KeyboardEvent) {\n if (!rootContext.open.value)\n rootContext.onOpenChange(true)\n}\n\nfunction handleInput(event: InputEvent) {\n const target = event.target as HTMLInputElement\n if (!rootContext.open.value) {\n rootContext.onOpenChange(true)\n nextTick(() => {\n if (target.value) {\n rootContext.filterSearch.value = target.value\n listboxContext.highlightFirstItem()\n }\n })\n }\n else {\n rootContext.filterSearch.value = target.value\n }\n}\n\nfunction resetSearchTerm() {\n const rootModelValue = rootContext.modelValue.value\n\n if (props.displayValue) {\n modelValue.value = props.displayValue(rootModelValue)\n }\n else if (!rootContext.multiple.value && rootModelValue && !Array.isArray(rootModelValue)) {\n if (typeof rootModelValue !== 'object')\n modelValue.value = rootModelValue.toString()\n else modelValue.value = ''\n }\n else {\n modelValue.value = ''\n }\n\n nextTick(() => {\n // Temporary force reassign\n // eslint-disable-next-line no-self-assign\n modelValue.value = modelValue.value\n })\n}\n\nrootContext.onResetSearchTerm(() => {\n resetSearchTerm()\n})\n\nwatch(rootContext.modelValue, async () => {\n if (!rootContext.isUserInputted.value && rootContext.resetSearchTermOnSelect.value)\n resetSearchTerm()\n}, { immediate: true, deep: true })\n\nwatch(rootContext.filterState, () => {\n // we exclude virtualized list as the state would be constantly updated\n if (!rootContext.isVirtual.value) {\n listboxContext.highlightFirstItem()\n }\n})\n</script>\n\n<template>\n <ListboxFilter\n ref=\"primitiveElement\"\n v-model=\"modelValue\"\n :as=\"as\"\n :as-child=\"asChild\"\n :auto-focus=\"autoFocus\"\n :aria-expanded=\"rootContext.open.value\"\n :aria-controls=\"rootContext.contentId\"\n aria-autocomplete=\"list\"\n role=\"combobox\"\n autocomplete=\"false\"\n @input=\"handleInput\"\n @keydown.down.up.prevent=\"handleKeyDown\"\n >\n <slot />\n </ListboxFilter>\n</template>\n"],"names":["injectComboboxRootContext","injectListboxRootContext","usePrimitiveElement","useVModel","onMounted","nextTick","watch"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAGd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAEd,IAAA,MAAM,cAAcA,+CAA0B,EAAA;AAC9C,IAAA,MAAM,iBAAiBC,4CAAyB,EAAA;AAChD,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAe,EAAA,GAAIC,iDAAoB,EAAA;AAEjE,IAAA,MAAM,UAAa,GAAAC,cAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAAC,aAAA,CAAU,MAAM;AACd,MAAA,IAAI,cAAe,CAAA,KAAA;AACjB,QAAY,WAAA,CAAA,oBAAA,CAAqB,eAAe,KAAyB,CAAA;AAAA,KAC5E,CAAA;AAED,IAAA,SAAS,cAAc,EAAmB,EAAA;AACxC,MAAI,IAAA,CAAC,YAAY,IAAK,CAAA,KAAA;AACpB,QAAA,WAAA,CAAY,aAAa,IAAI,CAAA;AAAA;AAGjC,IAAA,SAAS,YAAY,KAAmB,EAAA;AACtC,MAAA,MAAM,SAAS,KAAM,CAAA,MAAA;AACrB,MAAI,IAAA,CAAC,WAAY,CAAA,IAAA,CAAK,KAAO,EAAA;AAC3B,QAAA,WAAA,CAAY,aAAa,IAAI,CAAA;AAC7B,QAAAC,YAAA,CAAS,MAAM;AACb,UAAA,IAAI,OAAO,KAAO,EAAA;AAChB,YAAY,WAAA,CAAA,YAAA,CAAa,QAAQ,MAAO,CAAA,KAAA;AACxC,YAAA,cAAA,CAAe,kBAAmB,EAAA;AAAA;AACpC,SACD,CAAA;AAAA,OAEE,MAAA;AACH,QAAY,WAAA,CAAA,YAAA,CAAa,QAAQ,MAAO,CAAA,KAAA;AAAA;AAC1C;AAGF,IAAA,SAAS,eAAkB,GAAA;AACzB,MAAM,MAAA,cAAA,GAAiB,YAAY,UAAW,CAAA,KAAA;AAE9C,MAAA,IAAI,MAAM,YAAc,EAAA;AACtB,QAAW,UAAA,CAAA,KAAA,GAAQ,KAAM,CAAA,YAAA,CAAa,cAAc,CAAA;AAAA,OACtD,MAAA,IACS,CAAC,WAAA,CAAY,QAAS,CAAA,KAAA,IAAS,kBAAkB,CAAC,KAAA,CAAM,OAAQ,CAAA,cAAc,CAAG,EAAA;AACxF,QAAA,IAAI,OAAO,cAAmB,KAAA,QAAA;AAC5B,UAAW,UAAA,CAAA,KAAA,GAAQ,eAAe,QAAS,EAAA;AAAA,wBAC7B,KAAQ,GAAA,EAAA;AAAA,OAErB,MAAA;AACH,QAAA,UAAA,CAAW,KAAQ,GAAA,EAAA;AAAA;AAGrB,MAAAA,YAAA,CAAS,MAAM;AAGb,QAAA,UAAA,CAAW,QAAQ,UAAW,CAAA,KAAA;AAAA,OAC/B,CAAA;AAAA;AAGH,IAAA,WAAA,CAAY,kBAAkB,MAAM;AAClC,MAAgB,eAAA,EAAA;AAAA,KACjB,CAAA;AAED,IAAMC,SAAA,CAAA,WAAA,CAAY,YAAY,YAAY;AACxC,MAAA,IAAI,CAAC,WAAA,CAAY,cAAe,CAAA,KAAA,IAAS,YAAY,uBAAwB,CAAA,KAAA;AAC3E,QAAgB,eAAA,EAAA;AAAA,OACjB,EAAE,SAAA,EAAW,IAAM,EAAA,IAAA,EAAM,MAAM,CAAA;AAElC,IAAMA,SAAA,CAAA,WAAA,CAAY,aAAa,MAAM;AAEnC,MAAI,IAAA,CAAC,WAAY,CAAA,SAAA,CAAU,KAAO,EAAA;AAChC,QAAA,cAAA,CAAe,kBAAmB,EAAA;AAAA;AACpC,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -39,12 +39,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
39
39
|
rootContext.onOpenChange(true);
|
|
40
40
|
nextTick(() => {
|
|
41
41
|
if (target.value) {
|
|
42
|
-
rootContext.
|
|
43
|
-
listboxContext.highlightFirstItem(
|
|
42
|
+
rootContext.filterSearch.value = target.value;
|
|
43
|
+
listboxContext.highlightFirstItem();
|
|
44
44
|
}
|
|
45
45
|
});
|
|
46
46
|
} else {
|
|
47
|
-
rootContext.
|
|
47
|
+
rootContext.filterSearch.value = target.value;
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
function resetSearchTerm() {
|
|
@@ -69,14 +69,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
69
69
|
if (!rootContext.isUserInputted.value && rootContext.resetSearchTermOnSelect.value)
|
|
70
70
|
resetSearchTerm();
|
|
71
71
|
}, { immediate: true, deep: true });
|
|
72
|
-
watch(
|
|
73
|
-
()
|
|
74
|
-
|
|
75
|
-
if (props.modelValue !== void 0) {
|
|
76
|
-
rootContext.filterState.search = props.modelValue;
|
|
77
|
-
}
|
|
72
|
+
watch(rootContext.filterState, () => {
|
|
73
|
+
if (!rootContext.isVirtual.value) {
|
|
74
|
+
listboxContext.highlightFirstItem();
|
|
78
75
|
}
|
|
79
|
-
);
|
|
76
|
+
});
|
|
80
77
|
return (_ctx, _cache) => {
|
|
81
78
|
return openBlock(), createBlock(unref(_sfc_main$1), {
|
|
82
79
|
ref_key: "primitiveElement",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxInput.js","sources":["../../src/Combobox/ComboboxInput.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxFilterEmits, ListboxFilterProps } from '@/Listbox'\nimport { useVModel } from '@vueuse/core'\nimport { nextTick, onMounted, watch } from 'vue'\nimport { usePrimitiveElement } from '@/Primitive'\n\nexport type ComboboxInputEmits = ListboxFilterEmits\nexport interface ComboboxInputProps extends ListboxFilterProps {\n /** The display value of input for selected item. Does not work with `multiple`. */\n displayValue?: (val: any) => string\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ListboxFilter } from '@/Listbox'\nimport { injectListboxRootContext } from '@/Listbox/ListboxRoot.vue'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = withDefaults(defineProps<ComboboxInputProps>(), {\n as: 'input',\n})\nconst emits = defineEmits<ComboboxInputEmits>()\n\nconst rootContext = injectComboboxRootContext()\nconst listboxContext = injectListboxRootContext()\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n passive: (props.modelValue === undefined) as false,\n})\n\nonMounted(() => {\n if (currentElement.value)\n rootContext.onInputElementChange(currentElement.value as HTMLInputElement)\n})\n\nfunction handleKeyDown(ev: KeyboardEvent) {\n if (!rootContext.open.value)\n rootContext.onOpenChange(true)\n}\n\nfunction handleInput(event: InputEvent) {\n const target = event.target as HTMLInputElement\n if (!rootContext.open.value) {\n rootContext.onOpenChange(true)\n nextTick(() => {\n if (target.value) {\n rootContext.
|
|
1
|
+
{"version":3,"file":"ComboboxInput.js","sources":["../../src/Combobox/ComboboxInput.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxFilterEmits, ListboxFilterProps } from '@/Listbox'\nimport { useVModel } from '@vueuse/core'\nimport { nextTick, onMounted, watch } from 'vue'\nimport { usePrimitiveElement } from '@/Primitive'\n\nexport type ComboboxInputEmits = ListboxFilterEmits\nexport interface ComboboxInputProps extends ListboxFilterProps {\n /** The display value of input for selected item. Does not work with `multiple`. */\n displayValue?: (val: any) => string\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ListboxFilter } from '@/Listbox'\nimport { injectListboxRootContext } from '@/Listbox/ListboxRoot.vue'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nconst props = withDefaults(defineProps<ComboboxInputProps>(), {\n as: 'input',\n})\nconst emits = defineEmits<ComboboxInputEmits>()\n\nconst rootContext = injectComboboxRootContext()\nconst listboxContext = injectListboxRootContext()\nconst { primitiveElement, currentElement } = usePrimitiveElement()\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n passive: (props.modelValue === undefined) as false,\n})\n\nonMounted(() => {\n if (currentElement.value)\n rootContext.onInputElementChange(currentElement.value as HTMLInputElement)\n})\n\nfunction handleKeyDown(ev: KeyboardEvent) {\n if (!rootContext.open.value)\n rootContext.onOpenChange(true)\n}\n\nfunction handleInput(event: InputEvent) {\n const target = event.target as HTMLInputElement\n if (!rootContext.open.value) {\n rootContext.onOpenChange(true)\n nextTick(() => {\n if (target.value) {\n rootContext.filterSearch.value = target.value\n listboxContext.highlightFirstItem()\n }\n })\n }\n else {\n rootContext.filterSearch.value = target.value\n }\n}\n\nfunction resetSearchTerm() {\n const rootModelValue = rootContext.modelValue.value\n\n if (props.displayValue) {\n modelValue.value = props.displayValue(rootModelValue)\n }\n else if (!rootContext.multiple.value && rootModelValue && !Array.isArray(rootModelValue)) {\n if (typeof rootModelValue !== 'object')\n modelValue.value = rootModelValue.toString()\n else modelValue.value = ''\n }\n else {\n modelValue.value = ''\n }\n\n nextTick(() => {\n // Temporary force reassign\n // eslint-disable-next-line no-self-assign\n modelValue.value = modelValue.value\n })\n}\n\nrootContext.onResetSearchTerm(() => {\n resetSearchTerm()\n})\n\nwatch(rootContext.modelValue, async () => {\n if (!rootContext.isUserInputted.value && rootContext.resetSearchTermOnSelect.value)\n resetSearchTerm()\n}, { immediate: true, deep: true })\n\nwatch(rootContext.filterState, () => {\n // we exclude virtualized list as the state would be constantly updated\n if (!rootContext.isVirtual.value) {\n listboxContext.highlightFirstItem()\n }\n})\n</script>\n\n<template>\n <ListboxFilter\n ref=\"primitiveElement\"\n v-model=\"modelValue\"\n :as=\"as\"\n :as-child=\"asChild\"\n :auto-focus=\"autoFocus\"\n :aria-expanded=\"rootContext.open.value\"\n :aria-controls=\"rootContext.contentId\"\n aria-autocomplete=\"list\"\n role=\"combobox\"\n autocomplete=\"false\"\n @input=\"handleInput\"\n @keydown.down.up.prevent=\"handleKeyDown\"\n >\n <slot />\n </ListboxFilter>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAGd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAEd,IAAA,MAAM,cAAc,yBAA0B,EAAA;AAC9C,IAAA,MAAM,iBAAiB,wBAAyB,EAAA;AAChD,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAe,EAAA,GAAI,mBAAoB,EAAA;AAEjE,IAAA,MAAM,UAAa,GAAA,SAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,IAAI,cAAe,CAAA,KAAA;AACjB,QAAY,WAAA,CAAA,oBAAA,CAAqB,eAAe,KAAyB,CAAA;AAAA,KAC5E,CAAA;AAED,IAAA,SAAS,cAAc,EAAmB,EAAA;AACxC,MAAI,IAAA,CAAC,YAAY,IAAK,CAAA,KAAA;AACpB,QAAA,WAAA,CAAY,aAAa,IAAI,CAAA;AAAA;AAGjC,IAAA,SAAS,YAAY,KAAmB,EAAA;AACtC,MAAA,MAAM,SAAS,KAAM,CAAA,MAAA;AACrB,MAAI,IAAA,CAAC,WAAY,CAAA,IAAA,CAAK,KAAO,EAAA;AAC3B,QAAA,WAAA,CAAY,aAAa,IAAI,CAAA;AAC7B,QAAA,QAAA,CAAS,MAAM;AACb,UAAA,IAAI,OAAO,KAAO,EAAA;AAChB,YAAY,WAAA,CAAA,YAAA,CAAa,QAAQ,MAAO,CAAA,KAAA;AACxC,YAAA,cAAA,CAAe,kBAAmB,EAAA;AAAA;AACpC,SACD,CAAA;AAAA,OAEE,MAAA;AACH,QAAY,WAAA,CAAA,YAAA,CAAa,QAAQ,MAAO,CAAA,KAAA;AAAA;AAC1C;AAGF,IAAA,SAAS,eAAkB,GAAA;AACzB,MAAM,MAAA,cAAA,GAAiB,YAAY,UAAW,CAAA,KAAA;AAE9C,MAAA,IAAI,MAAM,YAAc,EAAA;AACtB,QAAW,UAAA,CAAA,KAAA,GAAQ,KAAM,CAAA,YAAA,CAAa,cAAc,CAAA;AAAA,OACtD,MAAA,IACS,CAAC,WAAA,CAAY,QAAS,CAAA,KAAA,IAAS,kBAAkB,CAAC,KAAA,CAAM,OAAQ,CAAA,cAAc,CAAG,EAAA;AACxF,QAAA,IAAI,OAAO,cAAmB,KAAA,QAAA;AAC5B,UAAW,UAAA,CAAA,KAAA,GAAQ,eAAe,QAAS,EAAA;AAAA,wBAC7B,KAAQ,GAAA,EAAA;AAAA,OAErB,MAAA;AACH,QAAA,UAAA,CAAW,KAAQ,GAAA,EAAA;AAAA;AAGrB,MAAA,QAAA,CAAS,MAAM;AAGb,QAAA,UAAA,CAAW,QAAQ,UAAW,CAAA,KAAA;AAAA,OAC/B,CAAA;AAAA;AAGH,IAAA,WAAA,CAAY,kBAAkB,MAAM;AAClC,MAAgB,eAAA,EAAA;AAAA,KACjB,CAAA;AAED,IAAM,KAAA,CAAA,WAAA,CAAY,YAAY,YAAY;AACxC,MAAA,IAAI,CAAC,WAAA,CAAY,cAAe,CAAA,KAAA,IAAS,YAAY,uBAAwB,CAAA,KAAA;AAC3E,QAAgB,eAAA,EAAA;AAAA,OACjB,EAAE,SAAA,EAAW,IAAM,EAAA,IAAA,EAAM,MAAM,CAAA;AAElC,IAAM,KAAA,CAAA,WAAA,CAAY,aAAa,MAAM;AAEnC,MAAI,IAAA,CAAC,WAAY,CAAA,SAAA,CAAU,KAAO,EAAA;AAChC,QAAA,cAAA,CAAe,kBAAmB,EAAA;AAAA;AACpC,KACD,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -30,10 +30,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
const isRender = vue.computed(() => {
|
|
33
|
-
if (rootContext.isVirtual.value || rootContext.ignoreFilter.value || !rootContext.
|
|
33
|
+
if (rootContext.isVirtual.value || rootContext.ignoreFilter.value || !rootContext.filterSearch.value) {
|
|
34
34
|
return true;
|
|
35
35
|
} else {
|
|
36
|
-
const filteredCurrentItem = rootContext.filterState.
|
|
36
|
+
const filteredCurrentItem = rootContext.filterState.value.items.get(id);
|
|
37
37
|
if (filteredCurrentItem === void 0) {
|
|
38
38
|
return true;
|
|
39
39
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxItem.cjs","sources":["../../src/Combobox/ComboboxItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxItemEmits, ListboxItemProps } from '@/Listbox'\nimport type { AcceptableValue } from '@/shared/types'\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { usePrimitiveElement } from '@/Primitive'\nimport { useId } from '@/shared'\nimport { injectComboboxGroupContext } from './ComboboxGroup.vue'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nexport { injectListboxItemContext as injectComboboxItemContext } from '@/Listbox'\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.
|
|
1
|
+
{"version":3,"file":"ComboboxItem.cjs","sources":["../../src/Combobox/ComboboxItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxItemEmits, ListboxItemProps } from '@/Listbox'\nimport type { AcceptableValue } from '@/shared/types'\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { usePrimitiveElement } from '@/Primitive'\nimport { useId } from '@/shared'\nimport { injectComboboxGroupContext } from './ComboboxGroup.vue'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nexport { injectListboxItemContext as injectComboboxItemContext } from '@/Listbox'\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.filterSearch.value) {\n return true\n }\n else {\n const filteredCurrentItem = rootContext.filterState.value.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 :disabled=\"rootContext.disabled.value || disabled\"\n @select=\"(event) => {\n emits('select', event as any)\n if (event.defaultPrevented)\n return\n\n if (!rootContext.multiple.value && !disabled && !rootContext.disabled.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":";;;;;;;;;;;;;;;;;;;;AAyBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAEd,IAAM,MAAA,EAAA,GAAKA,kBAAM,CAAA,MAAA,EAAW,oBAAoB,CAAA;AAChD,IAAA,MAAM,cAAcC,+CAA0B,EAAA;AAC9C,IAAM,MAAA,YAAA,GAAeC,kDAA2B,IAAI,CAAA;AAEpD,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAe,EAAA,GAAIC,iDAAoB,EAAA;AAEjE,IAAI,IAAA,KAAA,CAAM,UAAU,EAAI,EAAA;AACtB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA;AAGF,IAAM,MAAA,QAAA,GAAWC,aAAS,MAAM;AAC9B,MAAI,IAAA,WAAA,CAAY,UAAU,KAAS,IAAA,WAAA,CAAY,aAAa,KAAS,IAAA,CAAC,WAAY,CAAA,YAAA,CAAa,KAAO,EAAA;AACpG,QAAO,OAAA,IAAA;AAAA,OAEJ,MAAA;AACH,QAAA,MAAM,sBAAsB,WAAY,CAAA,WAAA,CAAY,KAAM,CAAA,KAAA,CAAM,IAAI,EAAE,CAAA;AAGtE,QAAA,IAAI,wBAAwB,MAAW,EAAA;AACrC,UAAO,OAAA,IAAA;AAAA;AAIT,QAAA,OAAO,mBAAsB,GAAA,CAAA;AAAA;AAC/B,KACD,CAAA;AAED,IAAAC,aAAA,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;AAExH,MAAA,MAAM,UAAU,YAAc,EAAA,EAAA;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;AAAA,SAEnD,MAAA;AACH,UAAA,WAAA,CAAY,UAAU,KAAM,CAAA,GAAA,CAAI,OAAO,CAAA,EAAG,IAAI,EAAE,CAAA;AAAA;AAClD;AACF,KACD,CAAA;AACD,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAY,WAAA,CAAA,QAAA,CAAS,KAAM,CAAA,MAAA,CAAO,EAAE,CAAA;AAAA,KACrC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -28,10 +28,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
28
28
|
);
|
|
29
29
|
}
|
|
30
30
|
const isRender = computed(() => {
|
|
31
|
-
if (rootContext.isVirtual.value || rootContext.ignoreFilter.value || !rootContext.
|
|
31
|
+
if (rootContext.isVirtual.value || rootContext.ignoreFilter.value || !rootContext.filterSearch.value) {
|
|
32
32
|
return true;
|
|
33
33
|
} else {
|
|
34
|
-
const filteredCurrentItem = rootContext.filterState.
|
|
34
|
+
const filteredCurrentItem = rootContext.filterState.value.items.get(id);
|
|
35
35
|
if (filteredCurrentItem === void 0) {
|
|
36
36
|
return true;
|
|
37
37
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComboboxItem.js","sources":["../../src/Combobox/ComboboxItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxItemEmits, ListboxItemProps } from '@/Listbox'\nimport type { AcceptableValue } from '@/shared/types'\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { usePrimitiveElement } from '@/Primitive'\nimport { useId } from '@/shared'\nimport { injectComboboxGroupContext } from './ComboboxGroup.vue'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nexport { injectListboxItemContext as injectComboboxItemContext } from '@/Listbox'\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.
|
|
1
|
+
{"version":3,"file":"ComboboxItem.js","sources":["../../src/Combobox/ComboboxItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ListboxItemEmits, ListboxItemProps } from '@/Listbox'\nimport type { AcceptableValue } from '@/shared/types'\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { usePrimitiveElement } from '@/Primitive'\nimport { useId } from '@/shared'\nimport { injectComboboxGroupContext } from './ComboboxGroup.vue'\nimport { injectComboboxRootContext } from './ComboboxRoot.vue'\n\nexport { injectListboxItemContext as injectComboboxItemContext } from '@/Listbox'\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.filterSearch.value) {\n return true\n }\n else {\n const filteredCurrentItem = rootContext.filterState.value.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 :disabled=\"rootContext.disabled.value || disabled\"\n @select=\"(event) => {\n emits('select', event as any)\n if (event.defaultPrevented)\n return\n\n if (!rootContext.multiple.value && !disabled && !rootContext.disabled.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":";;;;;;;;;;;;;;;;;;AAyBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAEd,IAAM,MAAA,EAAA,GAAK,KAAM,CAAA,MAAA,EAAW,oBAAoB,CAAA;AAChD,IAAA,MAAM,cAAc,yBAA0B,EAAA;AAC9C,IAAM,MAAA,YAAA,GAAe,2BAA2B,IAAI,CAAA;AAEpD,IAAA,MAAM,EAAE,gBAAA,EAAkB,cAAe,EAAA,GAAI,mBAAoB,EAAA;AAEjE,IAAI,IAAA,KAAA,CAAM,UAAU,EAAI,EAAA;AACtB,MAAA,MAAM,IAAI,KAAA;AAAA,QACR;AAAA,OACF;AAAA;AAGF,IAAM,MAAA,QAAA,GAAW,SAAS,MAAM;AAC9B,MAAI,IAAA,WAAA,CAAY,UAAU,KAAS,IAAA,WAAA,CAAY,aAAa,KAAS,IAAA,CAAC,WAAY,CAAA,YAAA,CAAa,KAAO,EAAA;AACpG,QAAO,OAAA,IAAA;AAAA,OAEJ,MAAA;AACH,QAAA,MAAM,sBAAsB,WAAY,CAAA,WAAA,CAAY,KAAM,CAAA,KAAA,CAAM,IAAI,EAAE,CAAA;AAGtE,QAAA,IAAI,wBAAwB,MAAW,EAAA;AACrC,UAAO,OAAA,IAAA;AAAA;AAIT,QAAA,OAAO,mBAAsB,GAAA,CAAA;AAAA;AAC/B,KACD,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;AAExH,MAAA,MAAM,UAAU,YAAc,EAAA,EAAA;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;AAAA,SAEnD,MAAA;AACH,UAAA,WAAA,CAAY,UAAU,KAAM,CAAA,GAAA,CAAI,OAAO,CAAA,EAAG,IAAI,EAAE,CAAA;AAAA;AAClD;AACF,KACD,CAAA;AACD,IAAA,WAAA,CAAY,MAAM;AAChB,MAAY,WAAA,CAAA,QAAA,CAAS,KAAM,CAAA,MAAA,CAAO,EAAE,CAAA;AAAA,KACrC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -48,7 +48,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
48
48
|
});
|
|
49
49
|
async function onOpenChange(val) {
|
|
50
50
|
open.value = val;
|
|
51
|
-
|
|
51
|
+
filterSearch.value = "";
|
|
52
52
|
if (val) {
|
|
53
53
|
await vue.nextTick();
|
|
54
54
|
primitiveElement.value?.highlightSelected();
|
|
@@ -71,49 +71,38 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
71
71
|
const allItems = vue.ref(/* @__PURE__ */ new Map());
|
|
72
72
|
const allGroups = vue.ref(/* @__PURE__ */ new Map());
|
|
73
73
|
const { contains } = shared_useFilter.useFilter({ sensitivity: "base" });
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
groups: /* @__PURE__ */ new Set()
|
|
74
|
+
const filterSearch = vue.ref("");
|
|
75
|
+
const filterState = vue.computed((oldValue) => {
|
|
76
|
+
if (!filterSearch.value || props.ignoreFilter || isVirtual.value) {
|
|
77
|
+
return {
|
|
78
|
+
count: allItems.value.size,
|
|
79
|
+
items: oldValue?.items ?? /* @__PURE__ */ new Map(),
|
|
80
|
+
groups: oldValue?.groups ?? new Set(allGroups.value.keys())
|
|
81
|
+
};
|
|
83
82
|
}
|
|
84
|
-
});
|
|
85
|
-
function filterItems() {
|
|
86
|
-
if (!filterState.search || props.ignoreFilter || isVirtual.value) {
|
|
87
|
-
filterState.filtered.count = allItems.value.size;
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
filterState.filtered.groups = /* @__PURE__ */ new Set();
|
|
91
83
|
let itemCount = 0;
|
|
84
|
+
const filteredItems = /* @__PURE__ */ new Map();
|
|
85
|
+
const filteredGroups = /* @__PURE__ */ new Set();
|
|
92
86
|
for (const [id, value] of allItems.value) {
|
|
93
|
-
const score = contains(value,
|
|
94
|
-
|
|
87
|
+
const score = contains(value, filterSearch.value);
|
|
88
|
+
filteredItems.set(id, score ? 1 : 0);
|
|
95
89
|
if (score)
|
|
96
90
|
itemCount++;
|
|
97
91
|
}
|
|
98
92
|
for (const [groupId, group] of allGroups.value) {
|
|
99
93
|
for (const itemId of group) {
|
|
100
|
-
if (
|
|
101
|
-
|
|
94
|
+
if (filteredItems.get(itemId) > 0) {
|
|
95
|
+
filteredGroups.add(groupId);
|
|
102
96
|
break;
|
|
103
97
|
}
|
|
104
98
|
}
|
|
105
99
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
vue.nextTick(() => {
|
|
113
|
-
if (open.value)
|
|
114
|
-
filterItems();
|
|
115
|
-
});
|
|
116
|
-
}, { flush: "post" });
|
|
100
|
+
return {
|
|
101
|
+
count: itemCount,
|
|
102
|
+
items: filteredItems,
|
|
103
|
+
groups: filteredGroups
|
|
104
|
+
};
|
|
105
|
+
});
|
|
117
106
|
const inst = vue.getCurrentInstance();
|
|
118
107
|
vue.onMounted(() => {
|
|
119
108
|
if (inst?.exposed) {
|
|
@@ -123,7 +112,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
123
112
|
}
|
|
124
113
|
});
|
|
125
114
|
__expose({
|
|
126
|
-
filtered:
|
|
115
|
+
filtered: filterState,
|
|
127
116
|
highlightedElement,
|
|
128
117
|
highlightItem: primitiveElement.value?.highlightItem,
|
|
129
118
|
highlightFirstItem: primitiveElement.value?.highlightFirstItem,
|
|
@@ -148,6 +137,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
148
137
|
onResetSearchTerm: resetSearchTerm.on,
|
|
149
138
|
allItems,
|
|
150
139
|
allGroups,
|
|
140
|
+
filterSearch,
|
|
151
141
|
filterState,
|
|
152
142
|
ignoreFilter
|
|
153
143
|
});
|