@raxium/vue-addons-swiper 0.1.3 → 0.1.5

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.
@@ -1,31 +1,47 @@
1
- import { computed, createElementBlock, defineComponent, guardReactiveProps, normalizeProps, openBlock, renderSlot, unref } from "vue";
1
+ import { computed, createBlock, defineComponent, guardReactiveProps, normalizeProps, openBlock, renderSlot, unref, withCtx } from "vue";
2
+ import { Primitive } from "@raxium/vue-addons-shared";
2
3
  import { useSwiper } from "swiper/vue";
3
4
  import { useSwiperToggleEnabled } from "./utils.js";
4
- const _hoisted_1 = [
5
- "data-disabled"
6
- ];
7
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
6
  __name: "SwiperNext",
9
7
  props: {
8
+ asChild: {
9
+ type: Boolean,
10
+ default: false
11
+ },
12
+ as: {
13
+ default: "div"
14
+ },
10
15
  swiper: {}
11
16
  },
12
17
  setup (__props) {
13
18
  const effectiveSwiper = computed(()=>__props.swiper ?? useSwiper()?.value);
14
- const { isCanNext } = useSwiperToggleEnabled(effectiveSwiper);
19
+ const { isCanPrev, isCanNext } = useSwiperToggleEnabled(effectiveSwiper);
15
20
  function onClick() {
16
21
  isCanNext.value && effectiveSwiper.value?.slideNext();
17
22
  }
18
- return (_ctx, _cache)=>(openBlock(), createElementBlock("div", {
23
+ return (_ctx, _cache)=>(openBlock(), createBlock(unref(Primitive), {
24
+ "as-child": __props.asChild,
25
+ as: __props.as,
19
26
  class: "rui-swiper-next",
20
27
  "data-disabled": unref(isCanNext) ? void 0 : "",
21
28
  "data-scope": "swiper",
22
29
  "data-part": "next",
23
30
  onClick
24
- }, [
25
- renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
26
- disabled: !unref(isCanNext)
27
- })))
28
- ], 8, _hoisted_1));
31
+ }, {
32
+ default: withCtx(()=>[
33
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
34
+ disabled: !unref(isCanNext),
35
+ canPrev: unref(isCanPrev),
36
+ canNext: unref(isCanNext)
37
+ })))
38
+ ]),
39
+ _: 3
40
+ }, 8, [
41
+ "as-child",
42
+ "as",
43
+ "data-disabled"
44
+ ]));
29
45
  }
30
46
  });
31
47
  const SwiperNext = _sfc_main;
@@ -1,5 +1,6 @@
1
+ import type { PrimitiveProps } from '@raxium/vue-addons-shared';
1
2
  import type { Swiper as SwiperInstance } from 'swiper/types';
2
- type __VLS_Props = {
3
+ type __VLS_Props = PrimitiveProps & {
3
4
  swiper?: SwiperInstance;
4
5
  };
5
6
  type __VLS_Slots = {
@@ -1,31 +1,47 @@
1
- import { computed, createElementBlock, defineComponent, guardReactiveProps, normalizeProps, openBlock, renderSlot, unref } from "vue";
1
+ import { computed, createBlock, defineComponent, guardReactiveProps, normalizeProps, openBlock, renderSlot, unref, withCtx } from "vue";
2
+ import { Primitive } from "@raxium/vue-addons-shared";
2
3
  import { useSwiper } from "swiper/vue";
3
4
  import { useSwiperToggleEnabled } from "./utils.js";
4
- const _hoisted_1 = [
5
- "data-disabled"
6
- ];
7
5
  const _sfc_main = /* @__PURE__ */ defineComponent({
8
6
  __name: "SwiperPrev",
9
7
  props: {
8
+ asChild: {
9
+ type: Boolean,
10
+ default: false
11
+ },
12
+ as: {
13
+ default: "div"
14
+ },
10
15
  swiper: {}
11
16
  },
12
17
  setup (__props) {
13
18
  const effectiveSwiper = computed(()=>__props.swiper ?? useSwiper()?.value);
14
- const { isCanPrev } = useSwiperToggleEnabled(effectiveSwiper);
19
+ const { isCanPrev, isCanNext } = useSwiperToggleEnabled(effectiveSwiper);
15
20
  function onClick() {
16
21
  isCanPrev.value && effectiveSwiper.value?.slidePrev();
17
22
  }
18
- return (_ctx, _cache)=>(openBlock(), createElementBlock("div", {
23
+ return (_ctx, _cache)=>(openBlock(), createBlock(unref(Primitive), {
24
+ "as-child": __props.asChild,
25
+ as: __props.as,
19
26
  class: "rui-swiper-prev",
20
27
  "data-disabled": unref(isCanPrev) ? void 0 : "",
21
28
  "data-scope": "swiper",
22
29
  "data-part": "prev",
23
30
  onClick
24
- }, [
25
- renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
26
- disabled: !unref(isCanPrev)
27
- })))
28
- ], 8, _hoisted_1));
31
+ }, {
32
+ default: withCtx(()=>[
33
+ renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps({
34
+ disabled: !unref(isCanPrev),
35
+ canPrev: unref(isCanPrev),
36
+ canNext: unref(isCanNext)
37
+ })))
38
+ ]),
39
+ _: 3
40
+ }, 8, [
41
+ "as-child",
42
+ "as",
43
+ "data-disabled"
44
+ ]));
29
45
  }
30
46
  });
31
47
  const SwiperPrev = _sfc_main;
@@ -1,5 +1,6 @@
1
+ import type { PrimitiveProps } from '@raxium/vue-addons-shared';
1
2
  import type { Swiper as SwiperInstance } from 'swiper/types';
2
- type __VLS_Props = {
3
+ type __VLS_Props = PrimitiveProps & {
3
4
  swiper?: SwiperInstance;
4
5
  };
5
6
  type __VLS_Slots = {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@raxium/vue-addons-swiper",
3
3
  "type": "module",
4
- "version": "0.1.3",
4
+ "version": "0.1.5",
5
5
  "description": "Swiper components for Raxium",
6
6
  "author": {
7
7
  "name": "Hwacc",
@@ -32,10 +32,10 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "es-toolkit": "^1.44.0",
35
- "lucide-vue-next": "^0.563.0",
35
+ "lucide-vue-next": "^1.0.0",
36
36
  "swiper": "^12.1.2",
37
37
  "@raxium/shared": "0.1.1",
38
- "@raxium/vue-addons-shared": "0.1.2"
38
+ "@raxium/vue-addons-shared": "0.1.3"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@rsbuild/plugin-babel": "^1.0.6",