reka-ui 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/AlertDialog/AlertDialogRoot.cjs +2 -2
  2. package/dist/AlertDialog/AlertDialogRoot.cjs.map +1 -1
  3. package/dist/AlertDialog/AlertDialogRoot.js +3 -3
  4. package/dist/AlertDialog/AlertDialogRoot.js.map +1 -1
  5. package/dist/Combobox/ComboboxRoot.cjs +9 -1
  6. package/dist/Combobox/ComboboxRoot.cjs.map +1 -1
  7. package/dist/Combobox/ComboboxRoot.js +10 -2
  8. package/dist/Combobox/ComboboxRoot.js.map +1 -1
  9. package/dist/DatePicker/DatePickerRoot.cjs +1 -2
  10. package/dist/DatePicker/DatePickerRoot.cjs.map +1 -1
  11. package/dist/DatePicker/DatePickerRoot.js +1 -2
  12. package/dist/DatePicker/DatePickerRoot.js.map +1 -1
  13. package/dist/NavigationMenu/NavigationMenuViewport.cjs +1 -2
  14. package/dist/NavigationMenu/NavigationMenuViewport.cjs.map +1 -1
  15. package/dist/NavigationMenu/NavigationMenuViewport.js +1 -2
  16. package/dist/NavigationMenu/NavigationMenuViewport.js.map +1 -1
  17. package/dist/NumberField/NumberFieldInput.cjs +2 -0
  18. package/dist/NumberField/NumberFieldInput.cjs.map +1 -1
  19. package/dist/NumberField/NumberFieldInput.js +2 -0
  20. package/dist/NumberField/NumberFieldInput.js.map +1 -1
  21. package/dist/NumberField/NumberFieldRoot.cjs +5 -2
  22. package/dist/NumberField/NumberFieldRoot.cjs.map +1 -1
  23. package/dist/NumberField/NumberFieldRoot.js +5 -2
  24. package/dist/NumberField/NumberFieldRoot.js.map +1 -1
  25. package/dist/Slider/SliderHorizontal.cjs +19 -9
  26. package/dist/Slider/SliderHorizontal.cjs.map +1 -1
  27. package/dist/Slider/SliderHorizontal.js +20 -10
  28. package/dist/Slider/SliderHorizontal.js.map +1 -1
  29. package/dist/Slider/SliderRoot.cjs +4 -2
  30. package/dist/Slider/SliderRoot.cjs.map +1 -1
  31. package/dist/Slider/SliderRoot.js +4 -2
  32. package/dist/Slider/SliderRoot.js.map +1 -1
  33. package/dist/Slider/SliderThumb.cjs +1 -1
  34. package/dist/Slider/SliderThumb.cjs.map +1 -1
  35. package/dist/Slider/SliderThumb.js +1 -1
  36. package/dist/Slider/SliderThumb.js.map +1 -1
  37. package/dist/Slider/SliderThumbImpl.cjs +7 -1
  38. package/dist/Slider/SliderThumbImpl.cjs.map +1 -1
  39. package/dist/Slider/SliderThumbImpl.js +7 -1
  40. package/dist/Slider/SliderThumbImpl.js.map +1 -1
  41. package/dist/Slider/SliderVertical.cjs +19 -9
  42. package/dist/Slider/SliderVertical.cjs.map +1 -1
  43. package/dist/Slider/SliderVertical.js +20 -10
  44. package/dist/Slider/SliderVertical.js.map +1 -1
  45. package/dist/Toggle/Toggle.cjs +6 -1
  46. package/dist/Toggle/Toggle.cjs.map +1 -1
  47. package/dist/Toggle/Toggle.js +6 -1
  48. package/dist/Toggle/Toggle.js.map +1 -1
  49. package/dist/ToggleGroup/ToggleGroupItem.cjs +2 -4
  50. package/dist/ToggleGroup/ToggleGroupItem.cjs.map +1 -1
  51. package/dist/ToggleGroup/ToggleGroupItem.js +3 -5
  52. package/dist/ToggleGroup/ToggleGroupItem.js.map +1 -1
  53. package/dist/Toolbar/ToolbarToggleItem.cjs +0 -2
  54. package/dist/Toolbar/ToolbarToggleItem.cjs.map +1 -1
  55. package/dist/Toolbar/ToolbarToggleItem.js +0 -2
  56. package/dist/Toolbar/ToolbarToggleItem.js.map +1 -1
  57. package/dist/date.d.ts +2 -0
  58. package/dist/index.d.ts +51 -7
  59. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"SliderThumbImpl.cjs","sources":["../../src/Slider/SliderThumbImpl.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\n\nexport interface SliderThumbImplProps extends PrimitiveProps {\n index: number\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { useMounted } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\nimport { useCollection } from '@/Collection'\nimport { injectSliderRootContext } from './SliderRoot.vue'\nimport { convertValueToPercentage, getLabel, getThumbInBoundsOffset, injectSliderOrientationContext } from './utils'\nimport { useForwardExpose, useSize } from '@/shared'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = defineProps<SliderThumbImplProps>()\n\nconst rootContext = injectSliderRootContext()\nconst orientation = injectSliderOrientationContext()\n\nconst { forwardRef, currentElement: thumbElement } = useForwardExpose()\nconst { CollectionItem } = useCollection()\n\nconst value = computed(() => rootContext.modelValue?.value?.[props.index])\nconst percent = computed(() => value.value === undefined ? 0 : convertValueToPercentage(value.value, rootContext.min.value ?? 0, rootContext.max.value ?? 100))\nconst label = computed(() => getLabel(props.index, rootContext.modelValue?.value?.length ?? 0))\nconst size = useSize(thumbElement)\nconst orientationSize = computed(() => size[orientation!.size].value)\nconst thumbInBoundsOffset = computed(() => orientationSize.value\n ? getThumbInBoundsOffset(orientationSize.value, percent.value, orientation!.direction)\n : 0)\n\nconst isMounted = useMounted()\nonMounted(() => {\n rootContext.thumbElements.value.push(thumbElement.value)\n})\nonUnmounted(() => {\n const i = rootContext.thumbElements.value.findIndex(i => i === thumbElement.value) ?? -1\n rootContext.thumbElements.value.splice(i, 1)\n})\n</script>\n\n<template>\n <CollectionItem>\n <Primitive\n v-bind=\"$attrs\"\n :ref=\"forwardRef\"\n role=\"slider\"\n :tabindex=\"rootContext.disabled.value ? undefined : 0\"\n :aria-label=\"$attrs['aria-label'] || label\"\n :data-disabled=\"rootContext.disabled.value ? '' : undefined\"\n :data-orientation=\"rootContext.orientation.value\"\n :aria-valuenow=\"value\"\n :aria-valuemin=\"rootContext.min.value\"\n :aria-valuemax=\"rootContext.max.value\"\n :aria-orientation=\"rootContext.orientation.value\"\n :as-child=\"asChild\"\n :as=\"as\"\n :style=\"{\n transform: 'var(--reka-slider-thumb-transform)',\n position: 'absolute',\n [orientation!.startEdge]: `calc(${percent}% + ${thumbInBoundsOffset}px)`,\n /**\n * There will be no value on initial render while we work out the index so we hide thumbs\n * without a value, otherwise SSR will render them in the wrong position before they\n * snap into the correct position during hydration which would be visually jarring for\n * slower connections.\n */\n display: !isMounted && value === undefined ? 'none' : undefined,\n }\"\n @focus=\"() => {\n rootContext.valueIndexToChangeRef.value = index\n }\"\n >\n <slot />\n </Primitive>\n </CollectionItem>\n</template>\n"],"names":["injectSliderRootContext","injectSliderOrientationContext","useForwardExpose","useCollection","computed","convertValueToPercentage","getLabel","useSize","getThumbInBoundsOffset","useMounted","onMounted","onUnmounted","i"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAEd,IAAA,MAAM,cAAcA,yCAAwB,EAAA;AAC5C,IAAA,MAAM,cAAcC,2CAA+B,EAAA;AAEnD,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,YAAA,KAAiBC,wCAAiB,EAAA;AACtE,IAAM,MAAA,EAAE,cAAe,EAAA,GAAIC,mCAAc,EAAA;AAEzC,IAAM,MAAA,KAAA,GAAQC,aAAS,MAAM,WAAA,CAAY,YAAY,KAAQ,GAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACzE,IAAA,MAAM,UAAUA,YAAS,CAAA,MAAM,MAAM,KAAU,KAAA,SAAA,GAAY,IAAIC,qCAAyB,CAAA,KAAA,CAAM,KAAO,EAAA,WAAA,CAAY,IAAI,KAAS,IAAA,CAAA,EAAG,YAAY,GAAI,CAAA,KAAA,IAAS,GAAG,CAAC,CAAA;AAC9J,IAAM,MAAA,KAAA,GAAQD,YAAS,CAAA,MAAME,qBAAS,CAAA,KAAA,CAAM,KAAO,EAAA,WAAA,CAAY,UAAY,EAAA,KAAA,EAAO,MAAU,IAAA,CAAC,CAAC,CAAA;AAC9F,IAAM,MAAA,IAAA,GAAOC,uBAAQ,YAAY,CAAA;AACjC,IAAA,MAAM,kBAAkBH,YAAS,CAAA,MAAM,KAAK,WAAa,CAAA,IAAI,EAAE,KAAK,CAAA;AACpE,IAAA,MAAM,mBAAsB,GAAAA,YAAA,CAAS,MAAM,eAAA,CAAgB,KACvD,GAAAI,mCAAA,CAAuB,eAAgB,CAAA,KAAA,EAAO,OAAQ,CAAA,KAAA,EAAO,WAAa,CAAA,SAAS,IACnF,CAAC,CAAA;AAEL,IAAA,MAAM,YAAYC,eAAW,EAAA;AAC7B,IAAAC,aAAA,CAAU,MAAM;AACd,MAAA,WAAA,CAAY,aAAc,CAAA,KAAA,CAAM,IAAK,CAAA,YAAA,CAAa,KAAK,CAAA;AAAA,KACxD,CAAA;AACD,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAM,MAAA,CAAA,GAAI,WAAY,CAAA,aAAA,CAAc,KAAM,CAAA,SAAA,CAAU,CAAAC,EAAKA,KAAAA,EAAAA,KAAM,YAAa,CAAA,KAAK,CAAK,IAAA,EAAA;AACtF,MAAA,WAAA,CAAY,aAAc,CAAA,KAAA,CAAM,MAAO,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,KAC5C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"SliderThumbImpl.cjs","sources":["../../src/Slider/SliderThumbImpl.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\n\nexport interface SliderThumbImplProps extends PrimitiveProps {\n index: number\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { useMounted } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\nimport { useCollection } from '@/Collection'\nimport { injectSliderRootContext } from './SliderRoot.vue'\nimport { convertValueToPercentage, getLabel, getThumbInBoundsOffset, injectSliderOrientationContext } from './utils'\nimport { useForwardExpose, useSize } from '@/shared'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = defineProps<SliderThumbImplProps>()\n\nconst rootContext = injectSliderRootContext()\nconst orientation = injectSliderOrientationContext()\n\nconst { forwardRef, currentElement: thumbElement } = useForwardExpose()\nconst { CollectionItem } = useCollection()\n\nconst value = computed(() => rootContext.modelValue?.value?.[props.index])\nconst percent = computed(() => value.value === undefined ? 0 : convertValueToPercentage(value.value, rootContext.min.value ?? 0, rootContext.max.value ?? 100))\nconst label = computed(() => getLabel(props.index, rootContext.modelValue?.value?.length ?? 0))\nconst size = useSize(thumbElement)\nconst orientationSize = computed(() => size[orientation!.size].value)\nconst thumbInBoundsOffset = computed(() => {\n if (rootContext.thumbAlignment.value === 'overflow' || !orientationSize.value) {\n return 0\n }\n else {\n return getThumbInBoundsOffset(orientationSize.value, percent.value, orientation!.direction)\n }\n})\n\nconst isMounted = useMounted()\nonMounted(() => {\n rootContext.thumbElements.value.push(thumbElement.value)\n})\nonUnmounted(() => {\n const i = rootContext.thumbElements.value.findIndex(i => i === thumbElement.value) ?? -1\n rootContext.thumbElements.value.splice(i, 1)\n})\n</script>\n\n<template>\n <CollectionItem>\n <Primitive\n v-bind=\"$attrs\"\n :ref=\"forwardRef\"\n role=\"slider\"\n :tabindex=\"rootContext.disabled.value ? undefined : 0\"\n :aria-label=\"$attrs['aria-label'] || label\"\n :data-disabled=\"rootContext.disabled.value ? '' : undefined\"\n :data-orientation=\"rootContext.orientation.value\"\n :aria-valuenow=\"value\"\n :aria-valuemin=\"rootContext.min.value\"\n :aria-valuemax=\"rootContext.max.value\"\n :aria-orientation=\"rootContext.orientation.value\"\n :as-child=\"asChild\"\n :as=\"as\"\n :style=\"{\n transform: 'var(--reka-slider-thumb-transform)',\n position: 'absolute',\n [orientation!.startEdge]: `calc(${percent}% + ${thumbInBoundsOffset}px)`,\n /**\n * There will be no value on initial render while we work out the index so we hide thumbs\n * without a value, otherwise SSR will render them in the wrong position before they\n * snap into the correct position during hydration which would be visually jarring for\n * slower connections.\n */\n display: !isMounted && value === undefined ? 'none' : undefined,\n }\"\n @focus=\"() => {\n rootContext.valueIndexToChangeRef.value = index\n }\"\n >\n <slot />\n </Primitive>\n </CollectionItem>\n</template>\n"],"names":["injectSliderRootContext","injectSliderOrientationContext","useForwardExpose","useCollection","computed","convertValueToPercentage","getLabel","useSize","getThumbInBoundsOffset","useMounted","onMounted","onUnmounted","i"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAqBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAEd,IAAA,MAAM,cAAcA,yCAAwB,EAAA;AAC5C,IAAA,MAAM,cAAcC,2CAA+B,EAAA;AAEnD,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,YAAA,KAAiBC,wCAAiB,EAAA;AACtE,IAAM,MAAA,EAAE,cAAe,EAAA,GAAIC,mCAAc,EAAA;AAEzC,IAAM,MAAA,KAAA,GAAQC,aAAS,MAAM,WAAA,CAAY,YAAY,KAAQ,GAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACzE,IAAA,MAAM,UAAUA,YAAS,CAAA,MAAM,MAAM,KAAU,KAAA,SAAA,GAAY,IAAIC,qCAAyB,CAAA,KAAA,CAAM,KAAO,EAAA,WAAA,CAAY,IAAI,KAAS,IAAA,CAAA,EAAG,YAAY,GAAI,CAAA,KAAA,IAAS,GAAG,CAAC,CAAA;AAC9J,IAAM,MAAA,KAAA,GAAQD,YAAS,CAAA,MAAME,qBAAS,CAAA,KAAA,CAAM,KAAO,EAAA,WAAA,CAAY,UAAY,EAAA,KAAA,EAAO,MAAU,IAAA,CAAC,CAAC,CAAA;AAC9F,IAAM,MAAA,IAAA,GAAOC,uBAAQ,YAAY,CAAA;AACjC,IAAA,MAAM,kBAAkBH,YAAS,CAAA,MAAM,KAAK,WAAa,CAAA,IAAI,EAAE,KAAK,CAAA;AACpE,IAAM,MAAA,mBAAA,GAAsBA,aAAS,MAAM;AACzC,MAAA,IAAI,YAAY,cAAe,CAAA,KAAA,KAAU,UAAc,IAAA,CAAC,gBAAgB,KAAO,EAAA;AAC7E,QAAO,OAAA,CAAA;AAAA,OAEJ,MAAA;AACH,QAAA,OAAOI,oCAAuB,eAAgB,CAAA,KAAA,EAAO,OAAQ,CAAA,KAAA,EAAO,YAAa,SAAS,CAAA;AAAA;AAC5F,KACD,CAAA;AAED,IAAA,MAAM,YAAYC,eAAW,EAAA;AAC7B,IAAAC,aAAA,CAAU,MAAM;AACd,MAAA,WAAA,CAAY,aAAc,CAAA,KAAA,CAAM,IAAK,CAAA,YAAA,CAAa,KAAK,CAAA;AAAA,KACxD,CAAA;AACD,IAAAC,eAAA,CAAY,MAAM;AAChB,MAAM,MAAA,CAAA,GAAI,WAAY,CAAA,aAAA,CAAc,KAAM,CAAA,SAAA,CAAU,CAAAC,EAAKA,KAAAA,EAAAA,KAAM,YAAa,CAAA,KAAK,CAAK,IAAA,EAAA;AACtF,MAAA,WAAA,CAAY,aAAc,CAAA,KAAA,CAAM,MAAO,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,KAC5C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -28,7 +28,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
28
28
  const label = computed(() => getLabel(props.index, rootContext.modelValue?.value?.length ?? 0));
29
29
  const size = useSize(thumbElement);
30
30
  const orientationSize = computed(() => size[orientation.size].value);
31
- const thumbInBoundsOffset = computed(() => orientationSize.value ? getThumbInBoundsOffset(orientationSize.value, percent.value, orientation.direction) : 0);
31
+ const thumbInBoundsOffset = computed(() => {
32
+ if (rootContext.thumbAlignment.value === "overflow" || !orientationSize.value) {
33
+ return 0;
34
+ } else {
35
+ return getThumbInBoundsOffset(orientationSize.value, percent.value, orientation.direction);
36
+ }
37
+ });
32
38
  const isMounted = useMounted();
33
39
  onMounted(() => {
34
40
  rootContext.thumbElements.value.push(thumbElement.value);
@@ -1 +1 @@
1
- {"version":3,"file":"SliderThumbImpl.js","sources":["../../src/Slider/SliderThumbImpl.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\n\nexport interface SliderThumbImplProps extends PrimitiveProps {\n index: number\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { useMounted } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\nimport { useCollection } from '@/Collection'\nimport { injectSliderRootContext } from './SliderRoot.vue'\nimport { convertValueToPercentage, getLabel, getThumbInBoundsOffset, injectSliderOrientationContext } from './utils'\nimport { useForwardExpose, useSize } from '@/shared'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = defineProps<SliderThumbImplProps>()\n\nconst rootContext = injectSliderRootContext()\nconst orientation = injectSliderOrientationContext()\n\nconst { forwardRef, currentElement: thumbElement } = useForwardExpose()\nconst { CollectionItem } = useCollection()\n\nconst value = computed(() => rootContext.modelValue?.value?.[props.index])\nconst percent = computed(() => value.value === undefined ? 0 : convertValueToPercentage(value.value, rootContext.min.value ?? 0, rootContext.max.value ?? 100))\nconst label = computed(() => getLabel(props.index, rootContext.modelValue?.value?.length ?? 0))\nconst size = useSize(thumbElement)\nconst orientationSize = computed(() => size[orientation!.size].value)\nconst thumbInBoundsOffset = computed(() => orientationSize.value\n ? getThumbInBoundsOffset(orientationSize.value, percent.value, orientation!.direction)\n : 0)\n\nconst isMounted = useMounted()\nonMounted(() => {\n rootContext.thumbElements.value.push(thumbElement.value)\n})\nonUnmounted(() => {\n const i = rootContext.thumbElements.value.findIndex(i => i === thumbElement.value) ?? -1\n rootContext.thumbElements.value.splice(i, 1)\n})\n</script>\n\n<template>\n <CollectionItem>\n <Primitive\n v-bind=\"$attrs\"\n :ref=\"forwardRef\"\n role=\"slider\"\n :tabindex=\"rootContext.disabled.value ? undefined : 0\"\n :aria-label=\"$attrs['aria-label'] || label\"\n :data-disabled=\"rootContext.disabled.value ? '' : undefined\"\n :data-orientation=\"rootContext.orientation.value\"\n :aria-valuenow=\"value\"\n :aria-valuemin=\"rootContext.min.value\"\n :aria-valuemax=\"rootContext.max.value\"\n :aria-orientation=\"rootContext.orientation.value\"\n :as-child=\"asChild\"\n :as=\"as\"\n :style=\"{\n transform: 'var(--reka-slider-thumb-transform)',\n position: 'absolute',\n [orientation!.startEdge]: `calc(${percent}% + ${thumbInBoundsOffset}px)`,\n /**\n * There will be no value on initial render while we work out the index so we hide thumbs\n * without a value, otherwise SSR will render them in the wrong position before they\n * snap into the correct position during hydration which would be visually jarring for\n * slower connections.\n */\n display: !isMounted && value === undefined ? 'none' : undefined,\n }\"\n @focus=\"() => {\n rootContext.valueIndexToChangeRef.value = index\n }\"\n >\n <slot />\n </Primitive>\n </CollectionItem>\n</template>\n"],"names":["i"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAEd,IAAA,MAAM,cAAc,uBAAwB,EAAA;AAC5C,IAAA,MAAM,cAAc,8BAA+B,EAAA;AAEnD,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,YAAA,KAAiB,gBAAiB,EAAA;AACtE,IAAM,MAAA,EAAE,cAAe,EAAA,GAAI,aAAc,EAAA;AAEzC,IAAM,MAAA,KAAA,GAAQ,SAAS,MAAM,WAAA,CAAY,YAAY,KAAQ,GAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACzE,IAAA,MAAM,UAAU,QAAS,CAAA,MAAM,MAAM,KAAU,KAAA,SAAA,GAAY,IAAI,wBAAyB,CAAA,KAAA,CAAM,KAAO,EAAA,WAAA,CAAY,IAAI,KAAS,IAAA,CAAA,EAAG,YAAY,GAAI,CAAA,KAAA,IAAS,GAAG,CAAC,CAAA;AAC9J,IAAM,MAAA,KAAA,GAAQ,QAAS,CAAA,MAAM,QAAS,CAAA,KAAA,CAAM,KAAO,EAAA,WAAA,CAAY,UAAY,EAAA,KAAA,EAAO,MAAU,IAAA,CAAC,CAAC,CAAA;AAC9F,IAAM,MAAA,IAAA,GAAO,QAAQ,YAAY,CAAA;AACjC,IAAA,MAAM,kBAAkB,QAAS,CAAA,MAAM,KAAK,WAAa,CAAA,IAAI,EAAE,KAAK,CAAA;AACpE,IAAA,MAAM,mBAAsB,GAAA,QAAA,CAAS,MAAM,eAAA,CAAgB,KACvD,GAAA,sBAAA,CAAuB,eAAgB,CAAA,KAAA,EAAO,OAAQ,CAAA,KAAA,EAAO,WAAa,CAAA,SAAS,IACnF,CAAC,CAAA;AAEL,IAAA,MAAM,YAAY,UAAW,EAAA;AAC7B,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,WAAA,CAAY,aAAc,CAAA,KAAA,CAAM,IAAK,CAAA,YAAA,CAAa,KAAK,CAAA;AAAA,KACxD,CAAA;AACD,IAAA,WAAA,CAAY,MAAM;AAChB,MAAM,MAAA,CAAA,GAAI,WAAY,CAAA,aAAA,CAAc,KAAM,CAAA,SAAA,CAAU,CAAAA,EAAKA,KAAAA,EAAAA,KAAM,YAAa,CAAA,KAAK,CAAK,IAAA,EAAA;AACtF,MAAA,WAAA,CAAY,aAAc,CAAA,KAAA,CAAM,MAAO,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,KAC5C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"SliderThumbImpl.js","sources":["../../src/Slider/SliderThumbImpl.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\n\nexport interface SliderThumbImplProps extends PrimitiveProps {\n index: number\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, onMounted, onUnmounted } from 'vue'\nimport { useMounted } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\nimport { useCollection } from '@/Collection'\nimport { injectSliderRootContext } from './SliderRoot.vue'\nimport { convertValueToPercentage, getLabel, getThumbInBoundsOffset, injectSliderOrientationContext } from './utils'\nimport { useForwardExpose, useSize } from '@/shared'\n\ndefineOptions({\n inheritAttrs: false,\n})\n\nconst props = defineProps<SliderThumbImplProps>()\n\nconst rootContext = injectSliderRootContext()\nconst orientation = injectSliderOrientationContext()\n\nconst { forwardRef, currentElement: thumbElement } = useForwardExpose()\nconst { CollectionItem } = useCollection()\n\nconst value = computed(() => rootContext.modelValue?.value?.[props.index])\nconst percent = computed(() => value.value === undefined ? 0 : convertValueToPercentage(value.value, rootContext.min.value ?? 0, rootContext.max.value ?? 100))\nconst label = computed(() => getLabel(props.index, rootContext.modelValue?.value?.length ?? 0))\nconst size = useSize(thumbElement)\nconst orientationSize = computed(() => size[orientation!.size].value)\nconst thumbInBoundsOffset = computed(() => {\n if (rootContext.thumbAlignment.value === 'overflow' || !orientationSize.value) {\n return 0\n }\n else {\n return getThumbInBoundsOffset(orientationSize.value, percent.value, orientation!.direction)\n }\n})\n\nconst isMounted = useMounted()\nonMounted(() => {\n rootContext.thumbElements.value.push(thumbElement.value)\n})\nonUnmounted(() => {\n const i = rootContext.thumbElements.value.findIndex(i => i === thumbElement.value) ?? -1\n rootContext.thumbElements.value.splice(i, 1)\n})\n</script>\n\n<template>\n <CollectionItem>\n <Primitive\n v-bind=\"$attrs\"\n :ref=\"forwardRef\"\n role=\"slider\"\n :tabindex=\"rootContext.disabled.value ? undefined : 0\"\n :aria-label=\"$attrs['aria-label'] || label\"\n :data-disabled=\"rootContext.disabled.value ? '' : undefined\"\n :data-orientation=\"rootContext.orientation.value\"\n :aria-valuenow=\"value\"\n :aria-valuemin=\"rootContext.min.value\"\n :aria-valuemax=\"rootContext.max.value\"\n :aria-orientation=\"rootContext.orientation.value\"\n :as-child=\"asChild\"\n :as=\"as\"\n :style=\"{\n transform: 'var(--reka-slider-thumb-transform)',\n position: 'absolute',\n [orientation!.startEdge]: `calc(${percent}% + ${thumbInBoundsOffset}px)`,\n /**\n * There will be no value on initial render while we work out the index so we hide thumbs\n * without a value, otherwise SSR will render them in the wrong position before they\n * snap into the correct position during hydration which would be visually jarring for\n * slower connections.\n */\n display: !isMounted && value === undefined ? 'none' : undefined,\n }\"\n @focus=\"() => {\n rootContext.valueIndexToChangeRef.value = index\n }\"\n >\n <slot />\n </Primitive>\n </CollectionItem>\n</template>\n"],"names":["i"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAEd,IAAA,MAAM,cAAc,uBAAwB,EAAA;AAC5C,IAAA,MAAM,cAAc,8BAA+B,EAAA;AAEnD,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,YAAA,KAAiB,gBAAiB,EAAA;AACtE,IAAM,MAAA,EAAE,cAAe,EAAA,GAAI,aAAc,EAAA;AAEzC,IAAM,MAAA,KAAA,GAAQ,SAAS,MAAM,WAAA,CAAY,YAAY,KAAQ,GAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACzE,IAAA,MAAM,UAAU,QAAS,CAAA,MAAM,MAAM,KAAU,KAAA,SAAA,GAAY,IAAI,wBAAyB,CAAA,KAAA,CAAM,KAAO,EAAA,WAAA,CAAY,IAAI,KAAS,IAAA,CAAA,EAAG,YAAY,GAAI,CAAA,KAAA,IAAS,GAAG,CAAC,CAAA;AAC9J,IAAM,MAAA,KAAA,GAAQ,QAAS,CAAA,MAAM,QAAS,CAAA,KAAA,CAAM,KAAO,EAAA,WAAA,CAAY,UAAY,EAAA,KAAA,EAAO,MAAU,IAAA,CAAC,CAAC,CAAA;AAC9F,IAAM,MAAA,IAAA,GAAO,QAAQ,YAAY,CAAA;AACjC,IAAA,MAAM,kBAAkB,QAAS,CAAA,MAAM,KAAK,WAAa,CAAA,IAAI,EAAE,KAAK,CAAA;AACpE,IAAM,MAAA,mBAAA,GAAsB,SAAS,MAAM;AACzC,MAAA,IAAI,YAAY,cAAe,CAAA,KAAA,KAAU,UAAc,IAAA,CAAC,gBAAgB,KAAO,EAAA;AAC7E,QAAO,OAAA,CAAA;AAAA,OAEJ,MAAA;AACH,QAAA,OAAO,uBAAuB,eAAgB,CAAA,KAAA,EAAO,OAAQ,CAAA,KAAA,EAAO,YAAa,SAAS,CAAA;AAAA;AAC5F,KACD,CAAA;AAED,IAAA,MAAM,YAAY,UAAW,EAAA;AAC7B,IAAA,SAAA,CAAU,MAAM;AACd,MAAA,WAAA,CAAY,aAAc,CAAA,KAAA,CAAM,IAAK,CAAA,YAAA,CAAa,KAAK,CAAA;AAAA,KACxD,CAAA;AACD,IAAA,WAAA,CAAY,MAAM;AAChB,MAAM,MAAA,CAAA,GAAI,WAAY,CAAA,aAAA,CAAc,KAAM,CAAA,SAAA,CAAU,CAAAA,EAAKA,KAAAA,EAAAA,KAAM,YAAa,CAAA,KAAK,CAAK,IAAA,EAAA;AACtF,MAAA,WAAA,CAAY,aAAc,CAAA,KAAA,CAAM,MAAO,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,KAC5C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -4,6 +4,7 @@ const vue = require('vue');
4
4
  const Slider_SliderImpl = require('./SliderImpl.cjs');
5
5
  const Slider_utils = require('./utils.cjs');
6
6
  const shared_useForwardExpose = require('../shared/useForwardExpose.cjs');
7
+ const Slider_SliderRoot = require('./SliderRoot.cjs');
7
8
 
8
9
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
9
10
  __name: "SliderVertical",
@@ -17,16 +18,24 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
17
18
  const props = __props;
18
19
  const emits = __emit;
19
20
  const { max, min, inverted } = vue.toRefs(props);
21
+ const rootContext = Slider_SliderRoot.injectSliderRootContext();
20
22
  const { forwardRef, currentElement: sliderElement } = shared_useForwardExpose.useForwardExpose();
23
+ const offsetPosition = vue.ref();
21
24
  const rectRef = vue.ref();
22
25
  const isSlidingFromBottom = vue.computed(() => !inverted.value);
23
- function getValueFromPointer(pointerPosition) {
26
+ function getValueFromPointerEvent(event, slideStart) {
24
27
  const rect = rectRef.value || sliderElement.value.getBoundingClientRect();
25
- const input = [0, rect.height];
28
+ const thumb = [...rootContext.thumbElements.value][rootContext.valueIndexToChangeRef.value];
29
+ const thumbHeight = rootContext.thumbAlignment.value === "contain" ? thumb.clientHeight : 0;
30
+ if (!offsetPosition.value && !slideStart && rootContext.thumbAlignment.value === "contain") {
31
+ offsetPosition.value = event.clientY - thumb.getBoundingClientRect().top;
32
+ }
33
+ const input = [0, rect.height - thumbHeight];
26
34
  const output = isSlidingFromBottom.value ? [max.value, min.value] : [min.value, max.value];
27
35
  const value = Slider_utils.linearScale(input, output);
36
+ const position = slideStart ? event.clientY - rect.top - thumbHeight / 2 : event.clientY - rect.top - (offsetPosition.value ?? 0);
28
37
  rectRef.value = rect;
29
- return value(pointerPosition - rect.top);
38
+ return value(position);
30
39
  }
31
40
  Slider_utils.provideSliderOrientationContext({
32
41
  startEdge: isSlidingFromBottom.value ? "bottom" : "top",
@@ -38,19 +47,20 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
38
47
  return vue.openBlock(), vue.createBlock(Slider_SliderImpl._sfc_main, {
39
48
  ref: vue.unref(forwardRef),
40
49
  "data-orientation": "vertical",
41
- style: {
42
- ["--reka-slider-thumb-transform"]: "translateY(50%)"
43
- },
50
+ style: vue.normalizeStyle({
51
+ ["--reka-slider-thumb-transform"]: !isSlidingFromBottom.value && vue.unref(rootContext).thumbAlignment.value === "overflow" ? "translateY(-50%)" : "translateY(50%)"
52
+ }),
44
53
  onSlideStart: _cache[0] || (_cache[0] = (event) => {
45
- const value = getValueFromPointer(event.clientY);
54
+ const value = getValueFromPointerEvent(event, true);
46
55
  emits("slideStart", value);
47
56
  }),
48
57
  onSlideMove: _cache[1] || (_cache[1] = (event) => {
49
- const value = getValueFromPointer(event.clientY);
58
+ const value = getValueFromPointerEvent(event);
50
59
  emits("slideMove", value);
51
60
  }),
52
61
  onSlideEnd: _cache[2] || (_cache[2] = () => {
53
62
  rectRef.value = undefined;
63
+ offsetPosition.value = undefined;
54
64
  emits("slideEnd");
55
65
  }),
56
66
  onStepKeyDown: _cache[3] || (_cache[3] = (event) => {
@@ -65,7 +75,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
65
75
  vue.renderSlot(_ctx.$slots, "default")
66
76
  ]),
67
77
  _: 3
68
- }, 512);
78
+ }, 8, ["style"]);
69
79
  };
70
80
  }
71
81
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SliderVertical.cjs","sources":["../../src/Slider/SliderVertical.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SliderImpl from './SliderImpl.vue'\nimport { computed, ref, toRefs } from 'vue'\nimport type { SliderOrientationPrivateEmits, SliderOrientationPrivateProps } from './utils'\nimport { BACK_KEYS, linearScale, provideSliderOrientationContext } from './utils'\nimport { useForwardExpose } from '@/shared'\n\ninterface SliderVerticalProps extends SliderOrientationPrivateProps {}\nconst props = defineProps<SliderVerticalProps>()\nconst emits = defineEmits<SliderOrientationPrivateEmits>()\nconst { max, min, inverted } = toRefs(props)\n\nconst { forwardRef, currentElement: sliderElement } = useForwardExpose()\n\nconst rectRef = ref<ClientRect>()\nconst isSlidingFromBottom = computed(() => !inverted.value)\n\nfunction getValueFromPointer(pointerPosition: number) {\n const rect = rectRef.value || sliderElement.value!.getBoundingClientRect()\n const input: [number, number] = [0, rect.height]\n const output: [number, number] = isSlidingFromBottom.value ? [max.value, min.value] : [min.value, max.value]\n const value = linearScale(input, output)\n\n rectRef.value = rect\n return value(pointerPosition - rect.top)\n}\n\nprovideSliderOrientationContext({\n startEdge: isSlidingFromBottom.value ? 'bottom' : 'top',\n endEdge: isSlidingFromBottom.value ? 'top' : 'bottom',\n size: 'height',\n direction: isSlidingFromBottom.value ? 1 : -1,\n})\n</script>\n\n<template>\n <SliderImpl\n :ref=\"forwardRef\"\n data-orientation=\"vertical\"\n :style=\"{\n ['--reka-slider-thumb-transform' as any]: 'translateY(50%)',\n }\"\n @slide-start=\"(event) => {\n const value = getValueFromPointer(event.clientY);\n emits('slideStart', value)\n }\"\n @slide-move=\"(event) => {\n const value = getValueFromPointer(event.clientY);\n emits('slideMove', value)\n }\"\n @slide-end=\"() => {\n rectRef = undefined;\n emits('slideEnd')\n }\"\n @step-key-down=\"(event) => {\n const slideDirection = isSlidingFromBottom ? 'from-bottom' : 'from-top';\n const isBackKey = BACK_KEYS[slideDirection].includes(event.key);\n emits('stepKeyDown', event, isBackKey ? -1 : 1)\n }\"\n @end-key-down=\"emits('endKeyDown', $event)\"\n @home-key-down=\"emits('homeKeyDown', $event)\"\n >\n <slot />\n </SliderImpl>\n</template>\n"],"names":["toRefs","useForwardExpose","ref","computed","linearScale","provideSliderOrientationContext"],"mappings":";;;;;;;;;;;;;;;;AAQA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA;AACd,IAAA,MAAM,EAAE,GAAK,EAAA,GAAA,EAAK,QAAS,EAAA,GAAIA,WAAO,KAAK,CAAA;AAE3C,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,aAAA,KAAkBC,wCAAiB,EAAA;AAEvE,IAAA,MAAM,UAAUC,OAAgB,EAAA;AAChC,IAAA,MAAM,mBAAsB,GAAAC,YAAA,CAAS,MAAM,CAAC,SAAS,KAAK,CAAA;AAE1D,IAAA,SAAS,oBAAoB,eAAyB,EAAA;AACpD,MAAA,MAAM,IAAO,GAAA,OAAA,CAAQ,KAAS,IAAA,aAAA,CAAc,MAAO,qBAAsB,EAAA;AACzE,MAAA,MAAM,KAA0B,GAAA,CAAC,CAAG,EAAA,IAAA,CAAK,MAAM,CAAA;AAC/C,MAAA,MAAM,MAA2B,GAAA,mBAAA,CAAoB,KAAQ,GAAA,CAAC,GAAI,CAAA,KAAA,EAAO,GAAI,CAAA,KAAK,CAAI,GAAA,CAAC,GAAI,CAAA,KAAA,EAAO,IAAI,KAAK,CAAA;AAC3G,MAAM,MAAA,KAAA,GAAQC,wBAAY,CAAA,KAAA,EAAO,MAAM,CAAA;AAEvC,MAAA,OAAA,CAAQ,KAAQ,GAAA,IAAA;AAChB,MAAO,OAAA,KAAA,CAAM,eAAkB,GAAA,IAAA,CAAK,GAAG,CAAA;AAAA;AAGzC,IAAgCC,4CAAA,CAAA;AAAA,MAC9B,SAAA,EAAW,mBAAoB,CAAA,KAAA,GAAQ,QAAW,GAAA,KAAA;AAAA,MAClD,OAAA,EAAS,mBAAoB,CAAA,KAAA,GAAQ,KAAQ,GAAA,QAAA;AAAA,MAC7C,IAAM,EAAA,QAAA;AAAA,MACN,SAAA,EAAW,mBAAoB,CAAA,KAAA,GAAQ,CAAI,GAAA;AAAA,KAC5C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"SliderVertical.cjs","sources":["../../src/Slider/SliderVertical.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SliderImpl from './SliderImpl.vue'\nimport { computed, ref, toRefs } from 'vue'\nimport type { SliderOrientationPrivateEmits, SliderOrientationPrivateProps } from './utils'\nimport { BACK_KEYS, linearScale, provideSliderOrientationContext } from './utils'\nimport { useForwardExpose } from '@/shared'\nimport { injectSliderRootContext } from './SliderRoot.vue'\n\ninterface SliderVerticalProps extends SliderOrientationPrivateProps {}\nconst props = defineProps<SliderVerticalProps>()\nconst emits = defineEmits<SliderOrientationPrivateEmits>()\nconst { max, min, inverted } = toRefs(props)\n\nconst rootContext = injectSliderRootContext()\nconst { forwardRef, currentElement: sliderElement } = useForwardExpose()\n\nconst offsetPosition = ref<number>()\nconst rectRef = ref<ClientRect>()\nconst isSlidingFromBottom = computed(() => !inverted.value)\n\nfunction getValueFromPointerEvent(event: PointerEvent, slideStart?: boolean) {\n const rect = rectRef.value || sliderElement.value!.getBoundingClientRect()\n\n // Get the currently active thumb element\n const thumb = [...rootContext.thumbElements.value][rootContext.valueIndexToChangeRef.value]\n const thumbHeight = rootContext.thumbAlignment.value === 'contain' ? thumb.clientHeight : 0\n\n // Calculate offset for dragging, but only when needed\n if (!offsetPosition.value && !slideStart && rootContext.thumbAlignment.value === 'contain') {\n offsetPosition.value = event.clientY - thumb.getBoundingClientRect().top\n }\n\n // Define the input range (slider track width minus thumb width)\n const input: [number, number] = [0, rect.height - thumbHeight]\n const output: [number, number] = isSlidingFromBottom.value ? [max.value, min.value] : [min.value, max.value]\n const value = linearScale(input, output)\n\n const position = slideStart\n ? event.clientY - rect.top - thumbHeight / 2\n : event.clientY - rect.top - (offsetPosition.value ?? 0)\n\n rectRef.value = rect\n return value(position)\n}\n\nprovideSliderOrientationContext({\n startEdge: isSlidingFromBottom.value ? 'bottom' : 'top',\n endEdge: isSlidingFromBottom.value ? 'top' : 'bottom',\n size: 'height',\n direction: isSlidingFromBottom.value ? 1 : -1,\n})\n</script>\n\n<template>\n <SliderImpl\n :ref=\"forwardRef\"\n data-orientation=\"vertical\"\n :style=\"{\n ['--reka-slider-thumb-transform' as any]:\n !isSlidingFromBottom && rootContext.thumbAlignment.value === 'overflow' ? 'translateY(-50%)' : 'translateY(50%)',\n }\"\n @slide-start=\"(event) => {\n const value = getValueFromPointerEvent(event, true);\n emits('slideStart', value)\n }\"\n @slide-move=\"(event) => {\n const value = getValueFromPointerEvent(event);\n emits('slideMove', value)\n }\"\n @slide-end=\"() => {\n rectRef = undefined;\n offsetPosition = undefined\n emits('slideEnd')\n }\"\n @step-key-down=\"(event) => {\n const slideDirection = isSlidingFromBottom ? 'from-bottom' : 'from-top';\n const isBackKey = BACK_KEYS[slideDirection].includes(event.key);\n emits('stepKeyDown', event, isBackKey ? -1 : 1)\n }\"\n @end-key-down=\"emits('endKeyDown', $event)\"\n @home-key-down=\"emits('homeKeyDown', $event)\"\n >\n <slot />\n </SliderImpl>\n</template>\n"],"names":["toRefs","injectSliderRootContext","useForwardExpose","ref","computed","linearScale","provideSliderOrientationContext"],"mappings":";;;;;;;;;;;;;;;;;AASA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA;AACd,IAAA,MAAM,EAAE,GAAK,EAAA,GAAA,EAAK,QAAS,EAAA,GAAIA,WAAO,KAAK,CAAA;AAE3C,IAAA,MAAM,cAAcC,yCAAwB,EAAA;AAC5C,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,aAAA,KAAkBC,wCAAiB,EAAA;AAEvE,IAAA,MAAM,iBAAiBC,OAAY,EAAA;AACnC,IAAA,MAAM,UAAUA,OAAgB,EAAA;AAChC,IAAA,MAAM,mBAAsB,GAAAC,YAAA,CAAS,MAAM,CAAC,SAAS,KAAK,CAAA;AAE1D,IAAS,SAAA,wBAAA,CAAyB,OAAqB,UAAsB,EAAA;AAC3E,MAAA,MAAM,IAAO,GAAA,OAAA,CAAQ,KAAS,IAAA,aAAA,CAAc,MAAO,qBAAsB,EAAA;AAGzE,MAAM,MAAA,KAAA,GAAQ,CAAC,GAAG,WAAA,CAAY,cAAc,KAAK,CAAA,CAAE,WAAY,CAAA,qBAAA,CAAsB,KAAK,CAAA;AAC1F,MAAA,MAAM,cAAc,WAAY,CAAA,cAAA,CAAe,KAAU,KAAA,SAAA,GAAY,MAAM,YAAe,GAAA,CAAA;AAG1F,MAAI,IAAA,CAAC,eAAe,KAAS,IAAA,CAAC,cAAc,WAAY,CAAA,cAAA,CAAe,UAAU,SAAW,EAAA;AAC1F,QAAA,cAAA,CAAe,KAAQ,GAAA,KAAA,CAAM,OAAU,GAAA,KAAA,CAAM,uBAAwB,CAAA,GAAA;AAAA;AAIvE,MAAA,MAAM,KAA0B,GAAA,CAAC,CAAG,EAAA,IAAA,CAAK,SAAS,WAAW,CAAA;AAC7D,MAAA,MAAM,MAA2B,GAAA,mBAAA,CAAoB,KAAQ,GAAA,CAAC,GAAI,CAAA,KAAA,EAAO,GAAI,CAAA,KAAK,CAAI,GAAA,CAAC,GAAI,CAAA,KAAA,EAAO,IAAI,KAAK,CAAA;AAC3G,MAAM,MAAA,KAAA,GAAQC,wBAAY,CAAA,KAAA,EAAO,MAAM,CAAA;AAEvC,MAAA,MAAM,QAAW,GAAA,UAAA,GACb,KAAM,CAAA,OAAA,GAAU,IAAK,CAAA,GAAA,GAAM,WAAc,GAAA,CAAA,GACzC,KAAM,CAAA,OAAA,GAAU,IAAK,CAAA,GAAA,IAAO,eAAe,KAAS,IAAA,CAAA,CAAA;AAExD,MAAA,OAAA,CAAQ,KAAQ,GAAA,IAAA;AAChB,MAAA,OAAO,MAAM,QAAQ,CAAA;AAAA;AAGvB,IAAgCC,4CAAA,CAAA;AAAA,MAC9B,SAAA,EAAW,mBAAoB,CAAA,KAAA,GAAQ,QAAW,GAAA,KAAA;AAAA,MAClD,OAAA,EAAS,mBAAoB,CAAA,KAAA,GAAQ,KAAQ,GAAA,QAAA;AAAA,MAC7C,IAAM,EAAA,QAAA;AAAA,MACN,SAAA,EAAW,mBAAoB,CAAA,KAAA,GAAQ,CAAI,GAAA;AAAA,KAC5C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,7 +1,8 @@
1
- import { defineComponent, toRefs, ref, computed, openBlock, createBlock, unref, withCtx, renderSlot } from 'vue';
1
+ import { defineComponent, toRefs, ref, computed, openBlock, createBlock, unref, normalizeStyle, withCtx, renderSlot } from 'vue';
2
2
  import { _ as _sfc_main$1 } from './SliderImpl.js';
3
3
  import { p as provideSliderOrientationContext, B as BACK_KEYS, l as linearScale } from './utils.js';
4
4
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
5
+ import { i as injectSliderRootContext } from './SliderRoot.js';
5
6
 
6
7
  const _sfc_main = /* @__PURE__ */ defineComponent({
7
8
  __name: "SliderVertical",
@@ -15,16 +16,24 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
15
16
  const props = __props;
16
17
  const emits = __emit;
17
18
  const { max, min, inverted } = toRefs(props);
19
+ const rootContext = injectSliderRootContext();
18
20
  const { forwardRef, currentElement: sliderElement } = useForwardExpose();
21
+ const offsetPosition = ref();
19
22
  const rectRef = ref();
20
23
  const isSlidingFromBottom = computed(() => !inverted.value);
21
- function getValueFromPointer(pointerPosition) {
24
+ function getValueFromPointerEvent(event, slideStart) {
22
25
  const rect = rectRef.value || sliderElement.value.getBoundingClientRect();
23
- const input = [0, rect.height];
26
+ const thumb = [...rootContext.thumbElements.value][rootContext.valueIndexToChangeRef.value];
27
+ const thumbHeight = rootContext.thumbAlignment.value === "contain" ? thumb.clientHeight : 0;
28
+ if (!offsetPosition.value && !slideStart && rootContext.thumbAlignment.value === "contain") {
29
+ offsetPosition.value = event.clientY - thumb.getBoundingClientRect().top;
30
+ }
31
+ const input = [0, rect.height - thumbHeight];
24
32
  const output = isSlidingFromBottom.value ? [max.value, min.value] : [min.value, max.value];
25
33
  const value = linearScale(input, output);
34
+ const position = slideStart ? event.clientY - rect.top - thumbHeight / 2 : event.clientY - rect.top - (offsetPosition.value ?? 0);
26
35
  rectRef.value = rect;
27
- return value(pointerPosition - rect.top);
36
+ return value(position);
28
37
  }
29
38
  provideSliderOrientationContext({
30
39
  startEdge: isSlidingFromBottom.value ? "bottom" : "top",
@@ -36,19 +45,20 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
36
45
  return openBlock(), createBlock(_sfc_main$1, {
37
46
  ref: unref(forwardRef),
38
47
  "data-orientation": "vertical",
39
- style: {
40
- ["--reka-slider-thumb-transform"]: "translateY(50%)"
41
- },
48
+ style: normalizeStyle({
49
+ ["--reka-slider-thumb-transform"]: !isSlidingFromBottom.value && unref(rootContext).thumbAlignment.value === "overflow" ? "translateY(-50%)" : "translateY(50%)"
50
+ }),
42
51
  onSlideStart: _cache[0] || (_cache[0] = (event) => {
43
- const value = getValueFromPointer(event.clientY);
52
+ const value = getValueFromPointerEvent(event, true);
44
53
  emits("slideStart", value);
45
54
  }),
46
55
  onSlideMove: _cache[1] || (_cache[1] = (event) => {
47
- const value = getValueFromPointer(event.clientY);
56
+ const value = getValueFromPointerEvent(event);
48
57
  emits("slideMove", value);
49
58
  }),
50
59
  onSlideEnd: _cache[2] || (_cache[2] = () => {
51
60
  rectRef.value = undefined;
61
+ offsetPosition.value = undefined;
52
62
  emits("slideEnd");
53
63
  }),
54
64
  onStepKeyDown: _cache[3] || (_cache[3] = (event) => {
@@ -63,7 +73,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
63
73
  renderSlot(_ctx.$slots, "default")
64
74
  ]),
65
75
  _: 3
66
- }, 512);
76
+ }, 8, ["style"]);
67
77
  };
68
78
  }
69
79
  });
@@ -1 +1 @@
1
- {"version":3,"file":"SliderVertical.js","sources":["../../src/Slider/SliderVertical.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SliderImpl from './SliderImpl.vue'\nimport { computed, ref, toRefs } from 'vue'\nimport type { SliderOrientationPrivateEmits, SliderOrientationPrivateProps } from './utils'\nimport { BACK_KEYS, linearScale, provideSliderOrientationContext } from './utils'\nimport { useForwardExpose } from '@/shared'\n\ninterface SliderVerticalProps extends SliderOrientationPrivateProps {}\nconst props = defineProps<SliderVerticalProps>()\nconst emits = defineEmits<SliderOrientationPrivateEmits>()\nconst { max, min, inverted } = toRefs(props)\n\nconst { forwardRef, currentElement: sliderElement } = useForwardExpose()\n\nconst rectRef = ref<ClientRect>()\nconst isSlidingFromBottom = computed(() => !inverted.value)\n\nfunction getValueFromPointer(pointerPosition: number) {\n const rect = rectRef.value || sliderElement.value!.getBoundingClientRect()\n const input: [number, number] = [0, rect.height]\n const output: [number, number] = isSlidingFromBottom.value ? [max.value, min.value] : [min.value, max.value]\n const value = linearScale(input, output)\n\n rectRef.value = rect\n return value(pointerPosition - rect.top)\n}\n\nprovideSliderOrientationContext({\n startEdge: isSlidingFromBottom.value ? 'bottom' : 'top',\n endEdge: isSlidingFromBottom.value ? 'top' : 'bottom',\n size: 'height',\n direction: isSlidingFromBottom.value ? 1 : -1,\n})\n</script>\n\n<template>\n <SliderImpl\n :ref=\"forwardRef\"\n data-orientation=\"vertical\"\n :style=\"{\n ['--reka-slider-thumb-transform' as any]: 'translateY(50%)',\n }\"\n @slide-start=\"(event) => {\n const value = getValueFromPointer(event.clientY);\n emits('slideStart', value)\n }\"\n @slide-move=\"(event) => {\n const value = getValueFromPointer(event.clientY);\n emits('slideMove', value)\n }\"\n @slide-end=\"() => {\n rectRef = undefined;\n emits('slideEnd')\n }\"\n @step-key-down=\"(event) => {\n const slideDirection = isSlidingFromBottom ? 'from-bottom' : 'from-top';\n const isBackKey = BACK_KEYS[slideDirection].includes(event.key);\n emits('stepKeyDown', event, isBackKey ? -1 : 1)\n }\"\n @end-key-down=\"emits('endKeyDown', $event)\"\n @home-key-down=\"emits('homeKeyDown', $event)\"\n >\n <slot />\n </SliderImpl>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAQA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA;AACd,IAAA,MAAM,EAAE,GAAK,EAAA,GAAA,EAAK,QAAS,EAAA,GAAI,OAAO,KAAK,CAAA;AAE3C,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,aAAA,KAAkB,gBAAiB,EAAA;AAEvE,IAAA,MAAM,UAAU,GAAgB,EAAA;AAChC,IAAA,MAAM,mBAAsB,GAAA,QAAA,CAAS,MAAM,CAAC,SAAS,KAAK,CAAA;AAE1D,IAAA,SAAS,oBAAoB,eAAyB,EAAA;AACpD,MAAA,MAAM,IAAO,GAAA,OAAA,CAAQ,KAAS,IAAA,aAAA,CAAc,MAAO,qBAAsB,EAAA;AACzE,MAAA,MAAM,KAA0B,GAAA,CAAC,CAAG,EAAA,IAAA,CAAK,MAAM,CAAA;AAC/C,MAAA,MAAM,MAA2B,GAAA,mBAAA,CAAoB,KAAQ,GAAA,CAAC,GAAI,CAAA,KAAA,EAAO,GAAI,CAAA,KAAK,CAAI,GAAA,CAAC,GAAI,CAAA,KAAA,EAAO,IAAI,KAAK,CAAA;AAC3G,MAAM,MAAA,KAAA,GAAQ,WAAY,CAAA,KAAA,EAAO,MAAM,CAAA;AAEvC,MAAA,OAAA,CAAQ,KAAQ,GAAA,IAAA;AAChB,MAAO,OAAA,KAAA,CAAM,eAAkB,GAAA,IAAA,CAAK,GAAG,CAAA;AAAA;AAGzC,IAAgC,+BAAA,CAAA;AAAA,MAC9B,SAAA,EAAW,mBAAoB,CAAA,KAAA,GAAQ,QAAW,GAAA,KAAA;AAAA,MAClD,OAAA,EAAS,mBAAoB,CAAA,KAAA,GAAQ,KAAQ,GAAA,QAAA;AAAA,MAC7C,IAAM,EAAA,QAAA;AAAA,MACN,SAAA,EAAW,mBAAoB,CAAA,KAAA,GAAQ,CAAI,GAAA;AAAA,KAC5C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"SliderVertical.js","sources":["../../src/Slider/SliderVertical.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport SliderImpl from './SliderImpl.vue'\nimport { computed, ref, toRefs } from 'vue'\nimport type { SliderOrientationPrivateEmits, SliderOrientationPrivateProps } from './utils'\nimport { BACK_KEYS, linearScale, provideSliderOrientationContext } from './utils'\nimport { useForwardExpose } from '@/shared'\nimport { injectSliderRootContext } from './SliderRoot.vue'\n\ninterface SliderVerticalProps extends SliderOrientationPrivateProps {}\nconst props = defineProps<SliderVerticalProps>()\nconst emits = defineEmits<SliderOrientationPrivateEmits>()\nconst { max, min, inverted } = toRefs(props)\n\nconst rootContext = injectSliderRootContext()\nconst { forwardRef, currentElement: sliderElement } = useForwardExpose()\n\nconst offsetPosition = ref<number>()\nconst rectRef = ref<ClientRect>()\nconst isSlidingFromBottom = computed(() => !inverted.value)\n\nfunction getValueFromPointerEvent(event: PointerEvent, slideStart?: boolean) {\n const rect = rectRef.value || sliderElement.value!.getBoundingClientRect()\n\n // Get the currently active thumb element\n const thumb = [...rootContext.thumbElements.value][rootContext.valueIndexToChangeRef.value]\n const thumbHeight = rootContext.thumbAlignment.value === 'contain' ? thumb.clientHeight : 0\n\n // Calculate offset for dragging, but only when needed\n if (!offsetPosition.value && !slideStart && rootContext.thumbAlignment.value === 'contain') {\n offsetPosition.value = event.clientY - thumb.getBoundingClientRect().top\n }\n\n // Define the input range (slider track width minus thumb width)\n const input: [number, number] = [0, rect.height - thumbHeight]\n const output: [number, number] = isSlidingFromBottom.value ? [max.value, min.value] : [min.value, max.value]\n const value = linearScale(input, output)\n\n const position = slideStart\n ? event.clientY - rect.top - thumbHeight / 2\n : event.clientY - rect.top - (offsetPosition.value ?? 0)\n\n rectRef.value = rect\n return value(position)\n}\n\nprovideSliderOrientationContext({\n startEdge: isSlidingFromBottom.value ? 'bottom' : 'top',\n endEdge: isSlidingFromBottom.value ? 'top' : 'bottom',\n size: 'height',\n direction: isSlidingFromBottom.value ? 1 : -1,\n})\n</script>\n\n<template>\n <SliderImpl\n :ref=\"forwardRef\"\n data-orientation=\"vertical\"\n :style=\"{\n ['--reka-slider-thumb-transform' as any]:\n !isSlidingFromBottom && rootContext.thumbAlignment.value === 'overflow' ? 'translateY(-50%)' : 'translateY(50%)',\n }\"\n @slide-start=\"(event) => {\n const value = getValueFromPointerEvent(event, true);\n emits('slideStart', value)\n }\"\n @slide-move=\"(event) => {\n const value = getValueFromPointerEvent(event);\n emits('slideMove', value)\n }\"\n @slide-end=\"() => {\n rectRef = undefined;\n offsetPosition = undefined\n emits('slideEnd')\n }\"\n @step-key-down=\"(event) => {\n const slideDirection = isSlidingFromBottom ? 'from-bottom' : 'from-top';\n const isBackKey = BACK_KEYS[slideDirection].includes(event.key);\n emits('stepKeyDown', event, isBackKey ? -1 : 1)\n }\"\n @end-key-down=\"emits('endKeyDown', $event)\"\n @home-key-down=\"emits('homeKeyDown', $event)\"\n >\n <slot />\n </SliderImpl>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AASA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAA,MAAM,KAAQ,GAAA,MAAA;AACd,IAAA,MAAM,EAAE,GAAK,EAAA,GAAA,EAAK,QAAS,EAAA,GAAI,OAAO,KAAK,CAAA;AAE3C,IAAA,MAAM,cAAc,uBAAwB,EAAA;AAC5C,IAAA,MAAM,EAAE,UAAA,EAAY,cAAgB,EAAA,aAAA,KAAkB,gBAAiB,EAAA;AAEvE,IAAA,MAAM,iBAAiB,GAAY,EAAA;AACnC,IAAA,MAAM,UAAU,GAAgB,EAAA;AAChC,IAAA,MAAM,mBAAsB,GAAA,QAAA,CAAS,MAAM,CAAC,SAAS,KAAK,CAAA;AAE1D,IAAS,SAAA,wBAAA,CAAyB,OAAqB,UAAsB,EAAA;AAC3E,MAAA,MAAM,IAAO,GAAA,OAAA,CAAQ,KAAS,IAAA,aAAA,CAAc,MAAO,qBAAsB,EAAA;AAGzE,MAAM,MAAA,KAAA,GAAQ,CAAC,GAAG,WAAA,CAAY,cAAc,KAAK,CAAA,CAAE,WAAY,CAAA,qBAAA,CAAsB,KAAK,CAAA;AAC1F,MAAA,MAAM,cAAc,WAAY,CAAA,cAAA,CAAe,KAAU,KAAA,SAAA,GAAY,MAAM,YAAe,GAAA,CAAA;AAG1F,MAAI,IAAA,CAAC,eAAe,KAAS,IAAA,CAAC,cAAc,WAAY,CAAA,cAAA,CAAe,UAAU,SAAW,EAAA;AAC1F,QAAA,cAAA,CAAe,KAAQ,GAAA,KAAA,CAAM,OAAU,GAAA,KAAA,CAAM,uBAAwB,CAAA,GAAA;AAAA;AAIvE,MAAA,MAAM,KAA0B,GAAA,CAAC,CAAG,EAAA,IAAA,CAAK,SAAS,WAAW,CAAA;AAC7D,MAAA,MAAM,MAA2B,GAAA,mBAAA,CAAoB,KAAQ,GAAA,CAAC,GAAI,CAAA,KAAA,EAAO,GAAI,CAAA,KAAK,CAAI,GAAA,CAAC,GAAI,CAAA,KAAA,EAAO,IAAI,KAAK,CAAA;AAC3G,MAAM,MAAA,KAAA,GAAQ,WAAY,CAAA,KAAA,EAAO,MAAM,CAAA;AAEvC,MAAA,MAAM,QAAW,GAAA,UAAA,GACb,KAAM,CAAA,OAAA,GAAU,IAAK,CAAA,GAAA,GAAM,WAAc,GAAA,CAAA,GACzC,KAAM,CAAA,OAAA,GAAU,IAAK,CAAA,GAAA,IAAO,eAAe,KAAS,IAAA,CAAA,CAAA;AAExD,MAAA,OAAA,CAAQ,KAAQ,GAAA,IAAA;AAChB,MAAA,OAAO,MAAM,QAAQ,CAAA;AAAA;AAGvB,IAAgC,+BAAA,CAAA;AAAA,MAC9B,SAAA,EAAW,mBAAoB,CAAA,KAAA,GAAQ,QAAW,GAAA,KAAA;AAAA,MAClD,OAAA,EAAS,mBAAoB,CAAA,KAAA,GAAQ,KAAQ,GAAA,QAAA;AAAA,MAC7C,IAAM,EAAA,QAAA;AAAA,MACN,SAAA,EAAW,mBAAoB,CAAA,KAAA,GAAQ,CAAI,GAAA;AAAA,KAC5C,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -49,7 +49,12 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
49
49
  onClick: togglePressed
50
50
  }, {
51
51
  default: vue.withCtx(() => [
52
- vue.renderSlot(_ctx.$slots, "default", { modelValue: vue.unref(modelValue) }),
52
+ vue.renderSlot(_ctx.$slots, "default", {
53
+ modelValue: vue.unref(modelValue),
54
+ disabled: _ctx.disabled,
55
+ pressed: vue.unref(modelValue),
56
+ state: dataState.value
57
+ }),
53
58
  vue.unref(isFormControl) && _ctx.name && !vue.unref(toggleGroupContext) ? (vue.openBlock(), vue.createBlock(VisuallyHidden_VisuallyHiddenInput._sfc_main, {
54
59
  key: 0,
55
60
  type: "checkbox",
@@ -1 +1 @@
1
- {"version":3,"file":"Toggle.cjs","sources":["../../src/Toggle/Toggle.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useFormControl, useForwardExpose } from '@/shared'\nimport VisuallyHiddenInput from '@/VisuallyHidden/VisuallyHiddenInput.vue'\nimport type { FormFieldProps } from '@/shared/types'\nimport { injectToggleGroupRootContext } from '@/ToggleGroup/ToggleGroupRoot.vue'\n\nexport type ToggleEmits = {\n /** Event handler called when the value of the toggle changes. */\n 'update:modelValue': [value: boolean]\n}\n\nexport type DataState = 'on' | 'off'\n\nexport interface ToggleProps extends PrimitiveProps, FormFieldProps {\n /**\n * The pressed state of the toggle when it is initially rendered. Use when you do not need to control its open state.\n */\n defaultValue?: boolean\n /**\n * The controlled pressed state of the toggle. Can be bind as `v-model`.\n */\n modelValue?: boolean | null\n /**\n * When `true`, prevents the user from interacting with the toggle.\n */\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { type Ref, computed } from 'vue'\nimport { useVModel } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<ToggleProps>(), {\n modelValue: undefined,\n disabled: false,\n as: 'button',\n})\n\nconst emits = defineEmits<ToggleEmits>()\n\ndefineSlots<{\n default: (props: {\n /** Current pressed state */\n modelValue: typeof modelValue.value\n }) => any\n}>()\n\nconst { forwardRef, currentElement } = useForwardExpose()\nconst toggleGroupContext = injectToggleGroupRootContext(null)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<boolean>\n\nfunction togglePressed() {\n modelValue.value = !modelValue.value\n}\n\nconst dataState = computed<DataState>(() => {\n return modelValue.value ? 'on' : 'off'\n})\n\nconst isFormControl = useFormControl(currentElement)\n</script>\n\n<template>\n <Primitive\n :ref=\"forwardRef\"\n :type=\"as === 'button' ? 'button' : undefined\"\n :as-child=\"props.asChild\"\n :as=\"as\"\n :aria-pressed=\"modelValue\"\n :data-state=\"dataState\"\n :data-disabled=\"disabled ? '' : undefined\"\n :disabled=\"disabled\"\n @click=\"togglePressed\"\n >\n <slot :model-value=\"modelValue\" />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name && !toggleGroupContext\"\n type=\"checkbox\"\n :name=\"name\"\n :value=\"modelValue\"\n :required=\"required\"\n />\n </Primitive>\n</template>\n"],"names":["useForwardExpose","injectToggleGroupRootContext","useVModel","computed","useFormControl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAMd,IAAA,MAAM,KAAQ,GAAA,MAAA;AASd,IAAA,MAAM,EAAE,UAAA,EAAY,cAAe,EAAA,GAAIA,wCAAiB,EAAA;AACxD,IAAM,MAAA,kBAAA,GAAqBC,yDAA6B,IAAI,CAAA;AAE5D,IAAA,MAAM,UAAa,GAAAC,cAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,cAAc,KAAM,CAAA,YAAA;AAAA,MACpB,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAA,SAAS,aAAgB,GAAA;AACvB,MAAW,UAAA,CAAA,KAAA,GAAQ,CAAC,UAAW,CAAA,KAAA;AAAA;AAGjC,IAAM,MAAA,SAAA,GAAYC,aAAoB,MAAM;AAC1C,MAAO,OAAA,UAAA,CAAW,QAAQ,IAAO,GAAA,KAAA;AAAA,KAClC,CAAA;AAED,IAAM,MAAA,aAAA,GAAgBC,qCAAe,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Toggle.cjs","sources":["../../src/Toggle/Toggle.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useFormControl, useForwardExpose } from '@/shared'\nimport VisuallyHiddenInput from '@/VisuallyHidden/VisuallyHiddenInput.vue'\nimport type { FormFieldProps } from '@/shared/types'\nimport { injectToggleGroupRootContext } from '@/ToggleGroup/ToggleGroupRoot.vue'\n\nexport type ToggleEmits = {\n /** Event handler called when the value of the toggle changes. */\n 'update:modelValue': [value: boolean]\n}\n\nexport type DataState = 'on' | 'off'\n\nexport interface ToggleProps extends PrimitiveProps, FormFieldProps {\n /**\n * The pressed state of the toggle when it is initially rendered. Use when you do not need to control its open state.\n */\n defaultValue?: boolean\n /**\n * The controlled pressed state of the toggle. Can be bind as `v-model`.\n */\n modelValue?: boolean | null\n /**\n * When `true`, prevents the user from interacting with the toggle.\n */\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { type Ref, computed } from 'vue'\nimport { useVModel } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<ToggleProps>(), {\n modelValue: undefined,\n disabled: false,\n as: 'button',\n})\n\nconst emits = defineEmits<ToggleEmits>()\n\ndefineSlots<{\n default: (props: {\n /** Current value */\n modelValue: typeof modelValue.value\n /** Current state */\n state: typeof dataState.value\n /** Current pressed state */\n pressed: typeof modelValue.value\n /** Current disabled state */\n disabled: boolean\n }) => any\n}>()\n\nconst { forwardRef, currentElement } = useForwardExpose()\nconst toggleGroupContext = injectToggleGroupRootContext(null)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<boolean>\n\nfunction togglePressed() {\n modelValue.value = !modelValue.value\n}\n\nconst dataState = computed<DataState>(() => {\n return modelValue.value ? 'on' : 'off'\n})\n\nconst isFormControl = useFormControl(currentElement)\n</script>\n\n<template>\n <Primitive\n :ref=\"forwardRef\"\n :type=\"as === 'button' ? 'button' : undefined\"\n :as-child=\"props.asChild\"\n :as=\"as\"\n :aria-pressed=\"modelValue\"\n :data-state=\"dataState\"\n :data-disabled=\"disabled ? '' : undefined\"\n :disabled=\"disabled\"\n @click=\"togglePressed\"\n >\n <slot\n :model-value=\"modelValue\"\n :disabled=\"disabled\"\n :pressed=\"modelValue\"\n :state=\"dataState\"\n />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name && !toggleGroupContext\"\n type=\"checkbox\"\n :name=\"name\"\n :value=\"modelValue\"\n :required=\"required\"\n />\n </Primitive>\n</template>\n"],"names":["useForwardExpose","injectToggleGroupRootContext","useVModel","computed","useFormControl"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAmCA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAMd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAed,IAAA,MAAM,EAAE,UAAA,EAAY,cAAe,EAAA,GAAIA,wCAAiB,EAAA;AACxD,IAAM,MAAA,kBAAA,GAAqBC,yDAA6B,IAAI,CAAA;AAE5D,IAAA,MAAM,UAAa,GAAAC,cAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,cAAc,KAAM,CAAA,YAAA;AAAA,MACpB,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAA,SAAS,aAAgB,GAAA;AACvB,MAAW,UAAA,CAAA,KAAA,GAAQ,CAAC,UAAW,CAAA,KAAA;AAAA;AAGjC,IAAM,MAAA,SAAA,GAAYC,aAAoB,MAAM;AAC1C,MAAO,OAAA,UAAA,CAAW,QAAQ,IAAO,GAAA,KAAA;AAAA,KAClC,CAAA;AAED,IAAM,MAAA,aAAA,GAAgBC,qCAAe,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -47,7 +47,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
47
47
  onClick: togglePressed
48
48
  }, {
49
49
  default: withCtx(() => [
50
- renderSlot(_ctx.$slots, "default", { modelValue: unref(modelValue) }),
50
+ renderSlot(_ctx.$slots, "default", {
51
+ modelValue: unref(modelValue),
52
+ disabled: _ctx.disabled,
53
+ pressed: unref(modelValue),
54
+ state: dataState.value
55
+ }),
51
56
  unref(isFormControl) && _ctx.name && !unref(toggleGroupContext) ? (openBlock(), createBlock(_sfc_main$1, {
52
57
  key: 0,
53
58
  type: "checkbox",
@@ -1 +1 @@
1
- {"version":3,"file":"Toggle.js","sources":["../../src/Toggle/Toggle.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useFormControl, useForwardExpose } from '@/shared'\nimport VisuallyHiddenInput from '@/VisuallyHidden/VisuallyHiddenInput.vue'\nimport type { FormFieldProps } from '@/shared/types'\nimport { injectToggleGroupRootContext } from '@/ToggleGroup/ToggleGroupRoot.vue'\n\nexport type ToggleEmits = {\n /** Event handler called when the value of the toggle changes. */\n 'update:modelValue': [value: boolean]\n}\n\nexport type DataState = 'on' | 'off'\n\nexport interface ToggleProps extends PrimitiveProps, FormFieldProps {\n /**\n * The pressed state of the toggle when it is initially rendered. Use when you do not need to control its open state.\n */\n defaultValue?: boolean\n /**\n * The controlled pressed state of the toggle. Can be bind as `v-model`.\n */\n modelValue?: boolean | null\n /**\n * When `true`, prevents the user from interacting with the toggle.\n */\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { type Ref, computed } from 'vue'\nimport { useVModel } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<ToggleProps>(), {\n modelValue: undefined,\n disabled: false,\n as: 'button',\n})\n\nconst emits = defineEmits<ToggleEmits>()\n\ndefineSlots<{\n default: (props: {\n /** Current pressed state */\n modelValue: typeof modelValue.value\n }) => any\n}>()\n\nconst { forwardRef, currentElement } = useForwardExpose()\nconst toggleGroupContext = injectToggleGroupRootContext(null)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<boolean>\n\nfunction togglePressed() {\n modelValue.value = !modelValue.value\n}\n\nconst dataState = computed<DataState>(() => {\n return modelValue.value ? 'on' : 'off'\n})\n\nconst isFormControl = useFormControl(currentElement)\n</script>\n\n<template>\n <Primitive\n :ref=\"forwardRef\"\n :type=\"as === 'button' ? 'button' : undefined\"\n :as-child=\"props.asChild\"\n :as=\"as\"\n :aria-pressed=\"modelValue\"\n :data-state=\"dataState\"\n :data-disabled=\"disabled ? '' : undefined\"\n :disabled=\"disabled\"\n @click=\"togglePressed\"\n >\n <slot :model-value=\"modelValue\" />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name && !toggleGroupContext\"\n type=\"checkbox\"\n :name=\"name\"\n :value=\"modelValue\"\n :required=\"required\"\n />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmCA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAMd,IAAA,MAAM,KAAQ,GAAA,MAAA;AASd,IAAA,MAAM,EAAE,UAAA,EAAY,cAAe,EAAA,GAAI,gBAAiB,EAAA;AACxD,IAAM,MAAA,kBAAA,GAAqB,6BAA6B,IAAI,CAAA;AAE5D,IAAA,MAAM,UAAa,GAAA,SAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,cAAc,KAAM,CAAA,YAAA;AAAA,MACpB,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAA,SAAS,aAAgB,GAAA;AACvB,MAAW,UAAA,CAAA,KAAA,GAAQ,CAAC,UAAW,CAAA,KAAA;AAAA;AAGjC,IAAM,MAAA,SAAA,GAAY,SAAoB,MAAM;AAC1C,MAAO,OAAA,UAAA,CAAW,QAAQ,IAAO,GAAA,KAAA;AAAA,KAClC,CAAA;AAED,IAAM,MAAA,aAAA,GAAgB,eAAe,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Toggle.js","sources":["../../src/Toggle/Toggle.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { PrimitiveProps } from '@/Primitive'\nimport { useFormControl, useForwardExpose } from '@/shared'\nimport VisuallyHiddenInput from '@/VisuallyHidden/VisuallyHiddenInput.vue'\nimport type { FormFieldProps } from '@/shared/types'\nimport { injectToggleGroupRootContext } from '@/ToggleGroup/ToggleGroupRoot.vue'\n\nexport type ToggleEmits = {\n /** Event handler called when the value of the toggle changes. */\n 'update:modelValue': [value: boolean]\n}\n\nexport type DataState = 'on' | 'off'\n\nexport interface ToggleProps extends PrimitiveProps, FormFieldProps {\n /**\n * The pressed state of the toggle when it is initially rendered. Use when you do not need to control its open state.\n */\n defaultValue?: boolean\n /**\n * The controlled pressed state of the toggle. Can be bind as `v-model`.\n */\n modelValue?: boolean | null\n /**\n * When `true`, prevents the user from interacting with the toggle.\n */\n disabled?: boolean\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { type Ref, computed } from 'vue'\nimport { useVModel } from '@vueuse/core'\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<ToggleProps>(), {\n modelValue: undefined,\n disabled: false,\n as: 'button',\n})\n\nconst emits = defineEmits<ToggleEmits>()\n\ndefineSlots<{\n default: (props: {\n /** Current value */\n modelValue: typeof modelValue.value\n /** Current state */\n state: typeof dataState.value\n /** Current pressed state */\n pressed: typeof modelValue.value\n /** Current disabled state */\n disabled: boolean\n }) => any\n}>()\n\nconst { forwardRef, currentElement } = useForwardExpose()\nconst toggleGroupContext = injectToggleGroupRootContext(null)\n\nconst modelValue = useVModel(props, 'modelValue', emits, {\n defaultValue: props.defaultValue,\n passive: (props.modelValue === undefined) as false,\n}) as Ref<boolean>\n\nfunction togglePressed() {\n modelValue.value = !modelValue.value\n}\n\nconst dataState = computed<DataState>(() => {\n return modelValue.value ? 'on' : 'off'\n})\n\nconst isFormControl = useFormControl(currentElement)\n</script>\n\n<template>\n <Primitive\n :ref=\"forwardRef\"\n :type=\"as === 'button' ? 'button' : undefined\"\n :as-child=\"props.asChild\"\n :as=\"as\"\n :aria-pressed=\"modelValue\"\n :data-state=\"dataState\"\n :data-disabled=\"disabled ? '' : undefined\"\n :disabled=\"disabled\"\n @click=\"togglePressed\"\n >\n <slot\n :model-value=\"modelValue\"\n :disabled=\"disabled\"\n :pressed=\"modelValue\"\n :state=\"dataState\"\n />\n\n <VisuallyHiddenInput\n v-if=\"isFormControl && name && !toggleGroupContext\"\n type=\"checkbox\"\n :name=\"name\"\n :value=\"modelValue\"\n :required=\"required\"\n />\n </Primitive>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmCA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAMd,IAAA,MAAM,KAAQ,GAAA,MAAA;AAed,IAAA,MAAM,EAAE,UAAA,EAAY,cAAe,EAAA,GAAI,gBAAiB,EAAA;AACxD,IAAM,MAAA,kBAAA,GAAqB,6BAA6B,IAAI,CAAA;AAE5D,IAAA,MAAM,UAAa,GAAA,SAAA,CAAU,KAAO,EAAA,YAAA,EAAc,KAAO,EAAA;AAAA,MACvD,cAAc,KAAM,CAAA,YAAA;AAAA,MACpB,OAAA,EAAU,MAAM,UAAe,KAAA;AAAA,KAChC,CAAA;AAED,IAAA,SAAS,aAAgB,GAAA;AACvB,MAAW,UAAA,CAAA,KAAA,GAAQ,CAAC,UAAW,CAAA,KAAA;AAAA;AAGjC,IAAM,MAAA,SAAA,GAAY,SAAoB,MAAM;AAC1C,MAAO,OAAA,UAAA,CAAW,QAAQ,IAAO,GAAA,KAAA;AAAA,KAClC,CAAA;AAED,IAAM,MAAA,aAAA,GAAgB,eAAe,cAAc,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -12,8 +12,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
12
12
  __name: "ToggleGroupItem",
13
13
  props: {
14
14
  value: {},
15
- defaultValue: { type: Boolean },
16
- modelValue: { type: [Boolean, null] },
17
15
  disabled: { type: Boolean },
18
16
  asChild: { type: Boolean },
19
17
  as: { default: "button" }
@@ -37,8 +35,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
37
35
  "model-value": pressed.value,
38
36
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(rootContext).changeModelValue(_ctx.value))
39
37
  }), {
40
- default: vue.withCtx(() => [
41
- vue.renderSlot(_ctx.$slots, "default")
38
+ default: vue.withCtx((slotProps) => [
39
+ vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(slotProps)))
42
40
  ]),
43
41
  _: 3
44
42
  }, 16, ["disabled", "model-value"])
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleGroupItem.cjs","sources":["../../src/ToggleGroup/ToggleGroupItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ToggleProps } from '@/Toggle'\nimport { isValueEqualOrExist, useForwardExpose } from '@/shared'\nimport type { AcceptableValue } from '@/shared/types'\n\nexport interface ToggleGroupItemProps extends Omit<ToggleProps, 'name' | 'required'> {\n /**\n * A string value for the toggle group item. All items within a toggle group should use a unique value.\n */\n value: AcceptableValue\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { injectToggleGroupRootContext } from './ToggleGroupRoot.vue'\nimport { Toggle } from '@/Toggle'\nimport { RovingFocusItem } from '@/RovingFocus'\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<ToggleGroupItemProps>(), {\n as: 'button',\n})\n\nconst rootContext = injectToggleGroupRootContext()\nconst disabled = computed(() => rootContext.disabled?.value || props.disabled)\nconst pressed = computed(() => isValueEqualOrExist(rootContext.modelValue.value, props.value))\n\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <component\n :is=\"rootContext.rovingFocus.value ? RovingFocusItem : Primitive\"\n as-child\n :focusable=\"!disabled\"\n :active=\"pressed\"\n >\n <Toggle\n v-bind=\"props\"\n :ref=\"forwardRef\"\n :disabled=\"disabled\"\n :model-value=\"pressed\"\n @update:model-value=\"rootContext.changeModelValue(value)\"\n >\n <slot />\n </Toggle>\n </component>\n</template>\n"],"names":["injectToggleGroupRootContext","computed","isValueEqualOrExist","useForwardExpose"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAoBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,cAAcA,wDAA6B,EAAA;AACjD,IAAA,MAAM,WAAWC,YAAS,CAAA,MAAM,YAAY,QAAU,EAAA,KAAA,IAAS,MAAM,QAAQ,CAAA;AAC7E,IAAM,MAAA,OAAA,GAAUA,aAAS,MAAMC,8CAAA,CAAoB,YAAY,UAAW,CAAA,KAAA,EAAO,KAAM,CAAA,KAAK,CAAC,CAAA;AAE7F,IAAM,MAAA,EAAE,UAAW,EAAA,GAAIC,wCAAiB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ToggleGroupItem.cjs","sources":["../../src/ToggleGroup/ToggleGroupItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ToggleProps } from '@/Toggle'\nimport { isValueEqualOrExist, useForwardExpose } from '@/shared'\nimport type { AcceptableValue } from '@/shared/types'\n\nexport interface ToggleGroupItemProps extends Omit<ToggleProps, 'name' | 'required' | 'modelValue' | 'defaultValue'> {\n /**\n * A string value for the toggle group item. All items within a toggle group should use a unique value.\n */\n value: AcceptableValue\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { injectToggleGroupRootContext } from './ToggleGroupRoot.vue'\nimport { Toggle } from '@/Toggle'\nimport { RovingFocusItem } from '@/RovingFocus'\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<ToggleGroupItemProps>(), {\n as: 'button',\n})\n\nconst rootContext = injectToggleGroupRootContext()\nconst disabled = computed(() => rootContext.disabled?.value || props.disabled)\nconst pressed = computed(() => isValueEqualOrExist(rootContext.modelValue.value, props.value))\n\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <component\n :is=\"rootContext.rovingFocus.value ? RovingFocusItem : Primitive\"\n as-child\n :focusable=\"!disabled\"\n :active=\"pressed\"\n >\n <Toggle\n v-bind=\"props\"\n :ref=\"forwardRef\"\n v-slot=\"slotProps\"\n :disabled=\"disabled\"\n :model-value=\"pressed\"\n @update:model-value=\"rootContext.changeModelValue(value)\"\n >\n <slot v-bind=\"slotProps\" />\n </Toggle>\n </component>\n</template>\n"],"names":["injectToggleGroupRootContext","computed","isValueEqualOrExist","useForwardExpose"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,cAAcA,wDAA6B,EAAA;AACjD,IAAA,MAAM,WAAWC,YAAS,CAAA,MAAM,YAAY,QAAU,EAAA,KAAA,IAAS,MAAM,QAAQ,CAAA;AAC7E,IAAM,MAAA,OAAA,GAAUA,aAAS,MAAMC,8CAAA,CAAoB,YAAY,UAAW,CAAA,KAAA,EAAO,KAAM,CAAA,KAAK,CAAC,CAAA;AAE7F,IAAM,MAAA,EAAE,UAAW,EAAA,GAAIC,wCAAiB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, unref, withCtx, createVNode, mergeProps, renderSlot } from 'vue';
1
+ import { defineComponent, computed, openBlock, createBlock, resolveDynamicComponent, unref, withCtx, createVNode, mergeProps, renderSlot, normalizeProps, guardReactiveProps } from 'vue';
2
2
  import { _ as _sfc_main$1 } from '../RovingFocus/RovingFocusItem.js';
3
3
  import { i as isValueEqualOrExist } from '../shared/isValueEqualOrExist.js';
4
4
  import { u as useForwardExpose } from '../shared/useForwardExpose.js';
@@ -10,8 +10,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
10
10
  __name: "ToggleGroupItem",
11
11
  props: {
12
12
  value: {},
13
- defaultValue: { type: Boolean },
14
- modelValue: { type: [Boolean, null] },
15
13
  disabled: { type: Boolean },
16
14
  asChild: { type: Boolean },
17
15
  as: { default: "button" }
@@ -35,8 +33,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
35
33
  "model-value": pressed.value,
36
34
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(rootContext).changeModelValue(_ctx.value))
37
35
  }), {
38
- default: withCtx(() => [
39
- renderSlot(_ctx.$slots, "default")
36
+ default: withCtx((slotProps) => [
37
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(slotProps)))
40
38
  ]),
41
39
  _: 3
42
40
  }, 16, ["disabled", "model-value"])
@@ -1 +1 @@
1
- {"version":3,"file":"ToggleGroupItem.js","sources":["../../src/ToggleGroup/ToggleGroupItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ToggleProps } from '@/Toggle'\nimport { isValueEqualOrExist, useForwardExpose } from '@/shared'\nimport type { AcceptableValue } from '@/shared/types'\n\nexport interface ToggleGroupItemProps extends Omit<ToggleProps, 'name' | 'required'> {\n /**\n * A string value for the toggle group item. All items within a toggle group should use a unique value.\n */\n value: AcceptableValue\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { injectToggleGroupRootContext } from './ToggleGroupRoot.vue'\nimport { Toggle } from '@/Toggle'\nimport { RovingFocusItem } from '@/RovingFocus'\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<ToggleGroupItemProps>(), {\n as: 'button',\n})\n\nconst rootContext = injectToggleGroupRootContext()\nconst disabled = computed(() => rootContext.disabled?.value || props.disabled)\nconst pressed = computed(() => isValueEqualOrExist(rootContext.modelValue.value, props.value))\n\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <component\n :is=\"rootContext.rovingFocus.value ? RovingFocusItem : Primitive\"\n as-child\n :focusable=\"!disabled\"\n :active=\"pressed\"\n >\n <Toggle\n v-bind=\"props\"\n :ref=\"forwardRef\"\n :disabled=\"disabled\"\n :model-value=\"pressed\"\n @update:model-value=\"rootContext.changeModelValue(value)\"\n >\n <slot />\n </Toggle>\n </component>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,cAAc,4BAA6B,EAAA;AACjD,IAAA,MAAM,WAAW,QAAS,CAAA,MAAM,YAAY,QAAU,EAAA,KAAA,IAAS,MAAM,QAAQ,CAAA;AAC7E,IAAM,MAAA,OAAA,GAAU,SAAS,MAAM,mBAAA,CAAoB,YAAY,UAAW,CAAA,KAAA,EAAO,KAAM,CAAA,KAAK,CAAC,CAAA;AAE7F,IAAM,MAAA,EAAE,UAAW,EAAA,GAAI,gBAAiB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ToggleGroupItem.js","sources":["../../src/ToggleGroup/ToggleGroupItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ToggleProps } from '@/Toggle'\nimport { isValueEqualOrExist, useForwardExpose } from '@/shared'\nimport type { AcceptableValue } from '@/shared/types'\n\nexport interface ToggleGroupItemProps extends Omit<ToggleProps, 'name' | 'required' | 'modelValue' | 'defaultValue'> {\n /**\n * A string value for the toggle group item. All items within a toggle group should use a unique value.\n */\n value: AcceptableValue\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { computed } from 'vue'\nimport { injectToggleGroupRootContext } from './ToggleGroupRoot.vue'\nimport { Toggle } from '@/Toggle'\nimport { RovingFocusItem } from '@/RovingFocus'\nimport { Primitive } from '@/Primitive'\n\nconst props = withDefaults(defineProps<ToggleGroupItemProps>(), {\n as: 'button',\n})\n\nconst rootContext = injectToggleGroupRootContext()\nconst disabled = computed(() => rootContext.disabled?.value || props.disabled)\nconst pressed = computed(() => isValueEqualOrExist(rootContext.modelValue.value, props.value))\n\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <component\n :is=\"rootContext.rovingFocus.value ? RovingFocusItem : Primitive\"\n as-child\n :focusable=\"!disabled\"\n :active=\"pressed\"\n >\n <Toggle\n v-bind=\"props\"\n :ref=\"forwardRef\"\n v-slot=\"slotProps\"\n :disabled=\"disabled\"\n :model-value=\"pressed\"\n @update:model-value=\"rootContext.changeModelValue(value)\"\n >\n <slot v-bind=\"slotProps\" />\n </Toggle>\n </component>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAoBA,IAAA,MAAM,KAAQ,GAAA,OAAA;AAId,IAAA,MAAM,cAAc,4BAA6B,EAAA;AACjD,IAAA,MAAM,WAAW,QAAS,CAAA,MAAM,YAAY,QAAU,EAAA,KAAA,IAAS,MAAM,QAAQ,CAAA;AAC7E,IAAM,MAAA,OAAA,GAAU,SAAS,MAAM,mBAAA,CAAoB,YAAY,UAAW,CAAA,KAAA,EAAO,KAAM,CAAA,KAAK,CAAC,CAAA;AAE7F,IAAM,MAAA,EAAE,UAAW,EAAA,GAAI,gBAAiB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -9,8 +9,6 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
9
9
  __name: "ToolbarToggleItem",
10
10
  props: {
11
11
  value: {},
12
- defaultValue: { type: Boolean },
13
- modelValue: { type: [Boolean, null] },
14
12
  disabled: { type: Boolean },
15
13
  asChild: { type: Boolean },
16
14
  as: {}
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarToggleItem.cjs","sources":["../../src/Toolbar/ToolbarToggleItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ToggleGroupItemProps } from '@/ToggleGroup'\nimport { useForwardExpose } from '@/shared'\n\nexport interface ToolbarToggleItemProps extends ToggleGroupItemProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport ToolbarButton from './ToolbarButton.vue'\nimport { ToggleGroupItem } from '@/ToggleGroup'\n\nconst props = defineProps<ToolbarToggleItemProps>()\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <ToolbarButton as-child>\n <ToggleGroupItem\n v-bind=\"props\"\n :ref=\"forwardRef\"\n >\n <slot />\n </ToggleGroupItem>\n </ToolbarButton>\n</template>\n"],"names":["useForwardExpose"],"mappings":";;;;;;;;;;;;;;;;;;AAWA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAM,MAAA,EAAE,UAAW,EAAA,GAAIA,wCAAiB,EAAA;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ToolbarToggleItem.cjs","sources":["../../src/Toolbar/ToolbarToggleItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ToggleGroupItemProps } from '@/ToggleGroup'\nimport { useForwardExpose } from '@/shared'\n\nexport interface ToolbarToggleItemProps extends ToggleGroupItemProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport ToolbarButton from './ToolbarButton.vue'\nimport { ToggleGroupItem } from '@/ToggleGroup'\n\nconst props = defineProps<ToolbarToggleItemProps>()\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <ToolbarButton as-child>\n <ToggleGroupItem\n v-bind=\"props\"\n :ref=\"forwardRef\"\n >\n <slot />\n </ToggleGroupItem>\n </ToolbarButton>\n</template>\n"],"names":["useForwardExpose"],"mappings":";;;;;;;;;;;;;;;;AAWA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAM,MAAA,EAAE,UAAW,EAAA,GAAIA,wCAAiB,EAAA;;;;;;;;;;;;;;;;;;;"}
@@ -7,8 +7,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
7
7
  __name: "ToolbarToggleItem",
8
8
  props: {
9
9
  value: {},
10
- defaultValue: { type: Boolean },
11
- modelValue: { type: [Boolean, null] },
12
10
  disabled: { type: Boolean },
13
11
  asChild: { type: Boolean },
14
12
  as: {}
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarToggleItem.js","sources":["../../src/Toolbar/ToolbarToggleItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ToggleGroupItemProps } from '@/ToggleGroup'\nimport { useForwardExpose } from '@/shared'\n\nexport interface ToolbarToggleItemProps extends ToggleGroupItemProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport ToolbarButton from './ToolbarButton.vue'\nimport { ToggleGroupItem } from '@/ToggleGroup'\n\nconst props = defineProps<ToolbarToggleItemProps>()\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <ToolbarButton as-child>\n <ToggleGroupItem\n v-bind=\"props\"\n :ref=\"forwardRef\"\n >\n <slot />\n </ToggleGroupItem>\n </ToolbarButton>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAWA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAM,MAAA,EAAE,UAAW,EAAA,GAAI,gBAAiB,EAAA;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"ToolbarToggleItem.js","sources":["../../src/Toolbar/ToolbarToggleItem.vue"],"sourcesContent":["<script lang=\"ts\">\nimport type { ToggleGroupItemProps } from '@/ToggleGroup'\nimport { useForwardExpose } from '@/shared'\n\nexport interface ToolbarToggleItemProps extends ToggleGroupItemProps {}\n</script>\n\n<script setup lang=\"ts\">\nimport ToolbarButton from './ToolbarButton.vue'\nimport { ToggleGroupItem } from '@/ToggleGroup'\n\nconst props = defineProps<ToolbarToggleItemProps>()\nconst { forwardRef } = useForwardExpose()\n</script>\n\n<template>\n <ToolbarButton as-child>\n <ToggleGroupItem\n v-bind=\"props\"\n :ref=\"forwardRef\"\n >\n <slot />\n </ToggleGroupItem>\n </ToolbarButton>\n</template>\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAWA,IAAA,MAAM,KAAQ,GAAA,OAAA;AACd,IAAM,MAAA,EAAE,UAAW,EAAA,GAAI,gBAAiB,EAAA;;;;;;;;;;;;;;;;;;;"}
package/dist/date.d.ts CHANGED
@@ -48,6 +48,8 @@ declare type DateRange = {
48
48
  end: DateValue | undefined;
49
49
  };
50
50
 
51
+ export { DateValue }
52
+
51
53
  export declare function endOfDecade(dateObj: DateValue): DateValue;
52
54
 
53
55
  /**