reka-ui 2.0.2 → 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.
- package/dist/AlertDialog/AlertDialogRoot.cjs +2 -2
- package/dist/AlertDialog/AlertDialogRoot.cjs.map +1 -1
- package/dist/AlertDialog/AlertDialogRoot.js +3 -3
- package/dist/AlertDialog/AlertDialogRoot.js.map +1 -1
- package/dist/Combobox/ComboboxRoot.cjs +9 -1
- package/dist/Combobox/ComboboxRoot.cjs.map +1 -1
- package/dist/Combobox/ComboboxRoot.js +10 -2
- package/dist/Combobox/ComboboxRoot.js.map +1 -1
- package/dist/NavigationMenu/NavigationMenuViewport.cjs +1 -2
- package/dist/NavigationMenu/NavigationMenuViewport.cjs.map +1 -1
- package/dist/NavigationMenu/NavigationMenuViewport.js +1 -2
- package/dist/NavigationMenu/NavigationMenuViewport.js.map +1 -1
- package/dist/NumberField/NumberFieldInput.cjs +2 -0
- package/dist/NumberField/NumberFieldInput.cjs.map +1 -1
- package/dist/NumberField/NumberFieldInput.js +2 -0
- package/dist/NumberField/NumberFieldInput.js.map +1 -1
- package/dist/NumberField/NumberFieldRoot.cjs +5 -2
- package/dist/NumberField/NumberFieldRoot.cjs.map +1 -1
- package/dist/NumberField/NumberFieldRoot.js +5 -2
- package/dist/NumberField/NumberFieldRoot.js.map +1 -1
- package/dist/Slider/SliderHorizontal.cjs +19 -9
- package/dist/Slider/SliderHorizontal.cjs.map +1 -1
- package/dist/Slider/SliderHorizontal.js +20 -10
- package/dist/Slider/SliderHorizontal.js.map +1 -1
- package/dist/Slider/SliderRoot.cjs +4 -2
- package/dist/Slider/SliderRoot.cjs.map +1 -1
- package/dist/Slider/SliderRoot.js +4 -2
- package/dist/Slider/SliderRoot.js.map +1 -1
- package/dist/Slider/SliderThumb.cjs +1 -1
- package/dist/Slider/SliderThumb.cjs.map +1 -1
- package/dist/Slider/SliderThumb.js +1 -1
- package/dist/Slider/SliderThumb.js.map +1 -1
- package/dist/Slider/SliderThumbImpl.cjs +7 -1
- package/dist/Slider/SliderThumbImpl.cjs.map +1 -1
- package/dist/Slider/SliderThumbImpl.js +7 -1
- package/dist/Slider/SliderThumbImpl.js.map +1 -1
- package/dist/Slider/SliderVertical.cjs +19 -9
- package/dist/Slider/SliderVertical.cjs.map +1 -1
- package/dist/Slider/SliderVertical.js +20 -10
- package/dist/Slider/SliderVertical.js.map +1 -1
- package/dist/Toggle/Toggle.cjs +6 -1
- package/dist/Toggle/Toggle.cjs.map +1 -1
- package/dist/Toggle/Toggle.js +6 -1
- package/dist/Toggle/Toggle.js.map +1 -1
- package/dist/ToggleGroup/ToggleGroupItem.cjs +2 -2
- package/dist/ToggleGroup/ToggleGroupItem.cjs.map +1 -1
- package/dist/ToggleGroup/ToggleGroupItem.js +3 -3
- package/dist/ToggleGroup/ToggleGroupItem.js.map +1 -1
- package/dist/date.d.ts +2 -0
- package/dist/index.d.ts +50 -6
- package/package.json +1 -1
|
@@ -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
|
|
26
|
+
function getValueFromPointerEvent(event, slideStart) {
|
|
24
27
|
const rect = rectRef.value || sliderElement.value.getBoundingClientRect();
|
|
25
|
-
const
|
|
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(
|
|
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 =
|
|
54
|
+
const value = getValueFromPointerEvent(event, true);
|
|
46
55
|
emits("slideStart", value);
|
|
47
56
|
}),
|
|
48
57
|
onSlideMove: _cache[1] || (_cache[1] = (event) => {
|
|
49
|
-
const value =
|
|
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
|
-
},
|
|
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
|
|
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
|
|
24
|
+
function getValueFromPointerEvent(event, slideStart) {
|
|
22
25
|
const rect = rectRef.value || sliderElement.value.getBoundingClientRect();
|
|
23
|
-
const
|
|
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(
|
|
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 =
|
|
52
|
+
const value = getValueFromPointerEvent(event, true);
|
|
44
53
|
emits("slideStart", value);
|
|
45
54
|
}),
|
|
46
55
|
onSlideMove: _cache[1] || (_cache[1] = (event) => {
|
|
47
|
-
const value =
|
|
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
|
-
},
|
|
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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Toggle/Toggle.cjs
CHANGED
|
@@ -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", {
|
|
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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/Toggle/Toggle.js
CHANGED
|
@@ -47,7 +47,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
47
47
|
onClick: togglePressed
|
|
48
48
|
}, {
|
|
49
49
|
default: withCtx(() => [
|
|
50
|
-
renderSlot(_ctx.$slots, "default", {
|
|
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
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -35,8 +35,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
35
35
|
"model-value": pressed.value,
|
|
36
36
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => vue.unref(rootContext).changeModelValue(_ctx.value))
|
|
37
37
|
}), {
|
|
38
|
-
default: vue.withCtx(() => [
|
|
39
|
-
vue.renderSlot(_ctx.$slots, "default")
|
|
38
|
+
default: vue.withCtx((slotProps) => [
|
|
39
|
+
vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(slotProps)))
|
|
40
40
|
]),
|
|
41
41
|
_: 3
|
|
42
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' | '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 :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';
|
|
@@ -33,8 +33,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
33
33
|
"model-value": pressed.value,
|
|
34
34
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(rootContext).changeModelValue(_ctx.value))
|
|
35
35
|
}), {
|
|
36
|
-
default: withCtx(() => [
|
|
37
|
-
renderSlot(_ctx.$slots, "default")
|
|
36
|
+
default: withCtx((slotProps) => [
|
|
37
|
+
renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(slotProps)))
|
|
38
38
|
]),
|
|
39
39
|
_: 3
|
|
40
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' | '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 :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;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/date.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -2057,7 +2057,9 @@ export declare const AlertDialogRoot: __VLS_WithTemplateSlots_6<DefineComponent<
|
|
|
2057
2057
|
}, string, PublicProps, Readonly<AlertDialogProps> & Readonly<{
|
|
2058
2058
|
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
2059
2059
|
}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, {
|
|
2060
|
-
default?(_: {
|
|
2060
|
+
default?(_: {
|
|
2061
|
+
open: boolean;
|
|
2062
|
+
}): any;
|
|
2061
2063
|
}>;
|
|
2062
2064
|
|
|
2063
2065
|
export declare const AlertDialogTitle: __VLS_WithTemplateSlots_12<DefineComponent<AlertDialogTitleProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<AlertDialogTitleProps> & Readonly<{}>, {
|
|
@@ -2620,6 +2622,10 @@ onContentFound?: ((args_0?: void | undefined) => any) | undefined;
|
|
|
2620
2622
|
default?(_: {}): any;
|
|
2621
2623
|
}>;
|
|
2622
2624
|
|
|
2625
|
+
export declare type CollapsibleContentEmits = {
|
|
2626
|
+
contentFound: [void];
|
|
2627
|
+
};
|
|
2628
|
+
|
|
2623
2629
|
export declare interface CollapsibleContentProps extends PrimitiveProps {
|
|
2624
2630
|
/**
|
|
2625
2631
|
* Used to force mounting when more control is needed. Useful when
|
|
@@ -3493,6 +3499,8 @@ export declare function createContext<ContextValue>(providerComponentName: strin
|
|
|
3493
3499
|
|
|
3494
3500
|
declare type DataOrientation = 'vertical' | 'horizontal';
|
|
3495
3501
|
|
|
3502
|
+
declare type DataState = 'on' | 'off';
|
|
3503
|
+
|
|
3496
3504
|
declare const DATE_SEGMENT_PARTS: readonly ["day", "month", "year"];
|
|
3497
3505
|
|
|
3498
3506
|
declare type DateAndTimeSegmentObj = DateSegmentObj & TimeSegmentObj;
|
|
@@ -4201,6 +4209,8 @@ declare type DateSegmentObj = {
|
|
|
4201
4209
|
|
|
4202
4210
|
declare type DateSegmentPart = (typeof DATE_SEGMENT_PARTS)[number];
|
|
4203
4211
|
|
|
4212
|
+
export { DateValue }
|
|
4213
|
+
|
|
4204
4214
|
declare type DayPeriod = 'AM' | 'PM' | null;
|
|
4205
4215
|
|
|
4206
4216
|
export declare const DialogClose: __VLS_WithTemplateSlots_114<DefineComponent<DialogCloseProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<DialogCloseProps> & Readonly<{}>, {
|
|
@@ -6060,7 +6070,7 @@ declare interface MountingOptions<Props> {
|
|
|
6060
6070
|
attrs?: Record<string, unknown>;
|
|
6061
6071
|
}
|
|
6062
6072
|
|
|
6063
|
-
declare interface MultipleCalendarRootProps extends BaseCalendarRootProps {
|
|
6073
|
+
export declare interface MultipleCalendarRootProps extends BaseCalendarRootProps {
|
|
6064
6074
|
/** The controlled checked state of the calendar. Can be bound as `v-model`. */
|
|
6065
6075
|
modelValue?: DateValue[] | undefined;
|
|
6066
6076
|
/** Whether or not multiple dates can be selected */
|
|
@@ -6385,6 +6395,7 @@ export declare const NumberFieldRoot: __VLS_WithTemplateSlots_177<DefineComponen
|
|
|
6385
6395
|
defaultValue: number;
|
|
6386
6396
|
as: AsTag | Component;
|
|
6387
6397
|
step: number;
|
|
6398
|
+
stepSnapping: boolean;
|
|
6388
6399
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, {
|
|
6389
6400
|
default?(_: {
|
|
6390
6401
|
modelValue: number;
|
|
@@ -6404,6 +6415,7 @@ declare interface NumberFieldRootContext {
|
|
|
6404
6415
|
validate: (val: string) => boolean;
|
|
6405
6416
|
applyInputValue: (val: string) => void;
|
|
6406
6417
|
disabled: Ref<boolean>;
|
|
6418
|
+
disableWheelChange: Ref<boolean>;
|
|
6407
6419
|
max: Ref<number | undefined>;
|
|
6408
6420
|
min: Ref<number | undefined>;
|
|
6409
6421
|
isDecreaseDisabled: Ref<boolean>;
|
|
@@ -6424,12 +6436,16 @@ export declare interface NumberFieldRootProps extends PrimitiveProps, FormFieldP
|
|
|
6424
6436
|
max?: number;
|
|
6425
6437
|
/** The amount that the input value changes with each increment or decrement "tick". */
|
|
6426
6438
|
step?: number;
|
|
6439
|
+
/** When `false`, prevents the value from snapping to the nearest increment of the step value */
|
|
6440
|
+
stepSnapping?: boolean;
|
|
6427
6441
|
/** Formatting options for the value displayed in the number field. This also affects what characters are allowed to be typed by the user. */
|
|
6428
6442
|
formatOptions?: Intl.NumberFormatOptions;
|
|
6429
6443
|
/** The locale to use for formatting dates */
|
|
6430
6444
|
locale?: string;
|
|
6431
6445
|
/** When `true`, prevents the user from interacting with the Number Field. */
|
|
6432
6446
|
disabled?: boolean;
|
|
6447
|
+
/** When `true`, prevents the value from changing on wheel scroll. */
|
|
6448
|
+
disableWheelChange?: boolean;
|
|
6433
6449
|
/** Id of the element */
|
|
6434
6450
|
id?: string;
|
|
6435
6451
|
}
|
|
@@ -8133,7 +8149,7 @@ declare type Side = (typeof SIDE_OPTIONS)[number];
|
|
|
8133
8149
|
|
|
8134
8150
|
declare const SIDE_OPTIONS: readonly ["top", "right", "bottom", "left"];
|
|
8135
8151
|
|
|
8136
|
-
declare interface SingleCalendarRootProps extends BaseCalendarRootProps {
|
|
8152
|
+
export declare interface SingleCalendarRootProps extends BaseCalendarRootProps {
|
|
8137
8153
|
/** The controlled checked state of the calendar. Can be bound as `v-model`. */
|
|
8138
8154
|
modelValue?: DateValue | undefined;
|
|
8139
8155
|
/** Whether or not multiple dates can be selected */
|
|
@@ -8187,6 +8203,7 @@ min: number;
|
|
|
8187
8203
|
max: number;
|
|
8188
8204
|
inverted: boolean;
|
|
8189
8205
|
minStepsBetweenThumbs: number;
|
|
8206
|
+
thumbAlignment: ThumbAlignment;
|
|
8190
8207
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, Readonly<{
|
|
8191
8208
|
default: (props: {
|
|
8192
8209
|
/** Current slider values */
|
|
@@ -8208,6 +8225,7 @@ declare interface SliderRootContext {
|
|
|
8208
8225
|
currentModelValue: ComputedRef<number[]>;
|
|
8209
8226
|
valueIndexToChangeRef: Ref<number>;
|
|
8210
8227
|
thumbElements: Ref<HTMLElement[]>;
|
|
8228
|
+
thumbAlignment: Ref<ThumbAlignment>;
|
|
8211
8229
|
}
|
|
8212
8230
|
|
|
8213
8231
|
export declare type SliderRootEmits = {
|
|
@@ -8244,6 +8262,13 @@ export declare interface SliderRootProps extends PrimitiveProps, FormFieldProps
|
|
|
8244
8262
|
step?: number;
|
|
8245
8263
|
/** The minimum permitted steps between multiple thumbs. */
|
|
8246
8264
|
minStepsBetweenThumbs?: number;
|
|
8265
|
+
/**
|
|
8266
|
+
* The alignment of the slider thumb.
|
|
8267
|
+
* - `contain`: thumbs will be contained within the bounds of the track.
|
|
8268
|
+
* - `overflow`: thumbs will not be bound by the track. No extra offset will be added.
|
|
8269
|
+
* @defaultValue 'contain'
|
|
8270
|
+
*/
|
|
8271
|
+
thumbAlignment?: ThumbAlignment;
|
|
8247
8272
|
}
|
|
8248
8273
|
|
|
8249
8274
|
export declare const SliderThumb: __VLS_WithTemplateSlots_236<DefineComponent<SliderThumbProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<SliderThumbProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, {
|
|
@@ -9071,6 +9096,8 @@ declare interface TeleportProps {
|
|
|
9071
9096
|
forceMount?: boolean;
|
|
9072
9097
|
}
|
|
9073
9098
|
|
|
9099
|
+
declare type ThumbAlignment = 'contain' | 'overflow';
|
|
9100
|
+
|
|
9074
9101
|
declare const TIME_SEGMENT_PARTS: readonly ["hour", "minute", "second", "dayPeriod"];
|
|
9075
9102
|
|
|
9076
9103
|
export declare const TimeFieldInput: __VLS_WithTemplateSlots_260<DefineComponent<TimeFieldInputProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<TimeFieldInputProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, {
|
|
@@ -9404,13 +9431,25 @@ as: AsTag | Component;
|
|
|
9404
9431
|
modelValue: boolean | null;
|
|
9405
9432
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, Readonly<{
|
|
9406
9433
|
default: (props: {
|
|
9407
|
-
/** Current
|
|
9434
|
+
/** Current value */
|
|
9408
9435
|
modelValue: boolean;
|
|
9436
|
+
/** Current state */
|
|
9437
|
+
state: DataState;
|
|
9438
|
+
/** Current pressed state */
|
|
9439
|
+
pressed: boolean;
|
|
9440
|
+
/** Current disabled state */
|
|
9441
|
+
disabled: boolean;
|
|
9409
9442
|
}) => any;
|
|
9410
9443
|
}> & {
|
|
9411
9444
|
default: (props: {
|
|
9412
|
-
/** Current
|
|
9445
|
+
/** Current value */
|
|
9413
9446
|
modelValue: boolean;
|
|
9447
|
+
/** Current state */
|
|
9448
|
+
state: DataState;
|
|
9449
|
+
/** Current pressed state */
|
|
9450
|
+
pressed: boolean;
|
|
9451
|
+
/** Current disabled state */
|
|
9452
|
+
disabled: boolean;
|
|
9414
9453
|
}) => any;
|
|
9415
9454
|
}>;
|
|
9416
9455
|
|
|
@@ -9422,7 +9461,12 @@ export declare type ToggleEmits = {
|
|
|
9422
9461
|
export declare const ToggleGroupItem: __VLS_WithTemplateSlots_272<DefineComponent<ToggleGroupItemProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ToggleGroupItemProps> & Readonly<{}>, {
|
|
9423
9462
|
as: AsTag | Component;
|
|
9424
9463
|
}, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>, {
|
|
9425
|
-
default?(_: {
|
|
9464
|
+
default?(_: {
|
|
9465
|
+
modelValue: boolean;
|
|
9466
|
+
state: DataState;
|
|
9467
|
+
pressed: boolean;
|
|
9468
|
+
disabled: boolean;
|
|
9469
|
+
}): any;
|
|
9426
9470
|
}>;
|
|
9427
9471
|
|
|
9428
9472
|
export declare interface ToggleGroupItemProps extends Omit<ToggleProps, 'name' | 'required' | 'modelValue' | 'defaultValue'> {
|