@varlet/ui 3.2.4 → 3.2.6-alpha.1713858357643

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.
@@ -231,6 +231,7 @@ const __sfc__ = defineComponent({
231
231
  let timer = -1;
232
232
  const swipeProvider = {
233
233
  size,
234
+ currentIndex: index,
234
235
  vertical
235
236
  };
236
237
  bindSwipeItems(swipeProvider);
@@ -2,31 +2,29 @@ import { defineComponent, ref } from "vue";
2
2
  import { useSwipe } from "./provide.mjs";
3
3
  import { createNamespace } from "../utils/components.mjs";
4
4
  const { name, n } = createNamespace("swipe-item");
5
- import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock } from "vue";
5
+ import { renderSlot as _renderSlot, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
6
+ const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
7
+ const _hoisted_1 = ["aria-hidden"];
6
8
  function __render__(_ctx, _cache) {
7
- return _openBlock(), _createElementBlock(
8
- "div",
9
- {
10
- class: _normalizeClass(_ctx.n()),
11
- style: _normalizeStyle({
12
- width: !_ctx.vertical ? `${_ctx.size}px` : void 0,
13
- height: _ctx.vertical ? `${_ctx.size}px` : void 0,
14
- transform: `translate${_ctx.vertical ? "Y" : "X"}(${_ctx.translate}px)`
15
- })
16
- },
17
- [
18
- _renderSlot(_ctx.$slots, "default")
19
- ],
20
- 6
21
- /* CLASS, STYLE */
22
- );
9
+ return _openBlock(), _createElementBlock("div", {
10
+ class: _normalizeClass(_ctx.n()),
11
+ style: _normalizeStyle({
12
+ width: !_ctx.vertical ? `${_ctx.size}px` : void 0,
13
+ height: _ctx.vertical ? `${_ctx.size}px` : void 0,
14
+ transform: `translate${_ctx.vertical ? "Y" : "X"}(${_ctx.translate}px)`
15
+ }),
16
+ tabindex: "-1",
17
+ "aria-hidden": _ctx.currentIndex === _ctx.index ? "false" : "true"
18
+ }, [
19
+ _renderSlot(_ctx.$slots, "default")
20
+ ], 14, _hoisted_1);
23
21
  }
24
22
  const __sfc__ = defineComponent({
25
23
  name,
26
24
  setup() {
27
25
  const translate = ref(0);
28
26
  const { swipe, bindSwipe, index } = useSwipe();
29
- const { size, vertical } = swipe;
27
+ const { size, currentIndex, vertical } = swipe;
30
28
  const swipeItemProvider = {
31
29
  index,
32
30
  setTranslate
@@ -38,6 +36,8 @@ const __sfc__ = defineComponent({
38
36
  return {
39
37
  n,
40
38
  size,
39
+ index,
40
+ currentIndex,
41
41
  vertical,
42
42
  translate
43
43
  };
@@ -12,8 +12,9 @@ import { useEventListener } from "@varlet/use";
12
12
  const { name, n, classes } = createNamespace("switch");
13
13
  import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, createVNode as _createVNode, resolveDirective as _resolveDirective, withDirectives as _withDirectives, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
14
14
  const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
15
- const _hoisted_1 = ["tabindex"];
16
- const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ _createElementVNode(
15
+ const _hoisted_1 = ["aria-checked"];
16
+ const _hoisted_2 = ["tabindex"];
17
+ const _hoisted_3 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ _createElementVNode(
17
18
  "svg",
18
19
  { viewBox: "25 25 50 50" },
19
20
  [
@@ -27,97 +28,93 @@ const _hoisted_2 = /* @__PURE__ */ _withScopeId(() => /* @__PURE__ */ _createEle
27
28
  -1
28
29
  /* HOISTED */
29
30
  ));
30
- const _hoisted_3 = [
31
- _hoisted_2
31
+ const _hoisted_4 = [
32
+ _hoisted_3
32
33
  ];
33
34
  function __render__(_ctx, _cache) {
34
35
  const _component_var_hover_overlay = _resolveComponent("var-hover-overlay");
35
36
  const _component_var_form_details = _resolveComponent("var-form-details");
36
37
  const _directive_ripple = _resolveDirective("ripple");
37
38
  const _directive_hover = _resolveDirective("hover");
38
- return _withDirectives((_openBlock(), _createElementBlock(
39
- "div",
40
- {
41
- class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.variant, _ctx.n("--variant")]))
42
- },
43
- [
44
- _createElementVNode(
45
- "div",
46
- {
47
- ref: "switchRef",
48
- class: _normalizeClass(_ctx.classes(_ctx.n("block"), [_ctx.disabled || _ctx.formDisabled, _ctx.n("--disabled")], [_ctx.isActive, _ctx.n("block--active")])),
49
- style: _normalizeStyle(_ctx.styleComputed.switch),
50
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.switchActive && _ctx.switchActive(...args))
51
- },
52
- [
39
+ return _withDirectives((_openBlock(), _createElementBlock("div", {
40
+ class: _normalizeClass(_ctx.classes(_ctx.n(), [_ctx.variant, _ctx.n("--variant")])),
41
+ role: "switch",
42
+ "aria-checked": _ctx.modelValue
43
+ }, [
44
+ _createElementVNode(
45
+ "div",
46
+ {
47
+ ref: "switchRef",
48
+ class: _normalizeClass(_ctx.classes(_ctx.n("block"), [_ctx.disabled || _ctx.formDisabled, _ctx.n("--disabled")], [_ctx.isActive, _ctx.n("block--active")])),
49
+ style: _normalizeStyle(_ctx.styleComputed.switch),
50
+ onClick: _cache[2] || (_cache[2] = (...args) => _ctx.switchActive && _ctx.switchActive(...args))
51
+ },
52
+ [
53
+ _createElementVNode(
54
+ "div",
55
+ {
56
+ style: _normalizeStyle(_ctx.styleComputed.track),
57
+ class: _normalizeClass(_ctx.classes(_ctx.n("track"), [_ctx.isActive, _ctx.n("track--active")], [_ctx.errorMessage && !_ctx.variant, _ctx.n("track--error")]))
58
+ },
59
+ null,
60
+ 6
61
+ /* CLASS, STYLE */
62
+ ),
63
+ _withDirectives((_openBlock(), _createElementBlock("div", {
64
+ class: _normalizeClass(_ctx.classes(_ctx.n("ripple"), [_ctx.isActive, _ctx.n("ripple--active")])),
65
+ style: _normalizeStyle(_ctx.styleComputed.ripple),
66
+ tabindex: _ctx.disabled || _ctx.formDisabled ? void 0 : "0",
67
+ onFocus: _cache[0] || (_cache[0] = ($event) => _ctx.isFocusing = true),
68
+ onBlur: _cache[1] || (_cache[1] = ($event) => _ctx.isFocusing = false)
69
+ }, [
53
70
  _createElementVNode(
54
71
  "div",
55
72
  {
56
- style: _normalizeStyle(_ctx.styleComputed.track),
57
- class: _normalizeClass(_ctx.classes(_ctx.n("track"), [_ctx.isActive, _ctx.n("track--active")], [_ctx.errorMessage && !_ctx.variant, _ctx.n("track--error")]))
73
+ style: _normalizeStyle(_ctx.styleComputed.handle),
74
+ class: _normalizeClass(
75
+ _ctx.classes(
76
+ _ctx.n("handle"),
77
+ _ctx.n("$-elevation--2"),
78
+ [_ctx.isActive, _ctx.n("handle--active")],
79
+ [_ctx.errorMessage && !_ctx.variant, _ctx.n("handle--error")],
80
+ [_ctx.hovering, _ctx.n("handle--hover")]
81
+ )
82
+ )
58
83
  },
59
- null,
84
+ [
85
+ _ctx.loading ? (_openBlock(), _createElementBlock(
86
+ "span",
87
+ {
88
+ key: 0,
89
+ class: _normalizeClass(_ctx.n("loading")),
90
+ style: _normalizeStyle({
91
+ width: _ctx.radius,
92
+ height: _ctx.radius
93
+ })
94
+ },
95
+ [..._hoisted_4],
96
+ 6
97
+ /* CLASS, STYLE */
98
+ )) : _createCommentVNode("v-if", true)
99
+ ],
60
100
  6
61
101
  /* CLASS, STYLE */
62
102
  ),
63
- _withDirectives((_openBlock(), _createElementBlock("div", {
64
- class: _normalizeClass(_ctx.classes(_ctx.n("ripple"), [_ctx.isActive, _ctx.n("ripple--active")])),
65
- style: _normalizeStyle(_ctx.styleComputed.ripple),
66
- tabindex: _ctx.disabled || _ctx.formDisabled ? void 0 : "0",
67
- onFocus: _cache[0] || (_cache[0] = ($event) => _ctx.isFocusing = true),
68
- onBlur: _cache[1] || (_cache[1] = ($event) => _ctx.isFocusing = false)
69
- }, [
70
- _createElementVNode(
71
- "div",
72
- {
73
- style: _normalizeStyle(_ctx.styleComputed.handle),
74
- class: _normalizeClass(
75
- _ctx.classes(
76
- _ctx.n("handle"),
77
- _ctx.n("$-elevation--2"),
78
- [_ctx.isActive, _ctx.n("handle--active")],
79
- [_ctx.errorMessage && !_ctx.variant, _ctx.n("handle--error")],
80
- [_ctx.hovering, _ctx.n("handle--hover")]
81
- )
82
- )
83
- },
84
- [
85
- _ctx.loading ? (_openBlock(), _createElementBlock(
86
- "span",
87
- {
88
- key: 0,
89
- class: _normalizeClass(_ctx.n("loading")),
90
- style: _normalizeStyle({
91
- width: _ctx.radius,
92
- height: _ctx.radius
93
- })
94
- },
95
- [..._hoisted_3],
96
- 6
97
- /* CLASS, STYLE */
98
- )) : _createCommentVNode("v-if", true)
99
- ],
100
- 6
101
- /* CLASS, STYLE */
102
- ),
103
- _createVNode(_component_var_hover_overlay, {
104
- hovering: _ctx.hovering && !_ctx.disabled && !_ctx.formDisabled,
105
- focusing: _ctx.isFocusing && !_ctx.disabled && !_ctx.formDisabled
106
- }, null, 8, ["hovering", "focusing"])
107
- ], 46, _hoisted_1)), [
108
- [_directive_ripple, {
109
- disabled: !_ctx.ripple || _ctx.disabled || _ctx.loading || _ctx.formDisabled || _ctx.readonly || _ctx.formReadonly
110
- }]
111
- ])
112
- ],
113
- 6
114
- /* CLASS, STYLE */
115
- ),
116
- _createVNode(_component_var_form_details, { "error-message": _ctx.errorMessage }, null, 8, ["error-message"])
117
- ],
118
- 2
119
- /* CLASS */
120
- )), [
103
+ _createVNode(_component_var_hover_overlay, {
104
+ hovering: _ctx.hovering && !_ctx.disabled && !_ctx.formDisabled,
105
+ focusing: _ctx.isFocusing && !_ctx.disabled && !_ctx.formDisabled
106
+ }, null, 8, ["hovering", "focusing"])
107
+ ], 46, _hoisted_2)), [
108
+ [_directive_ripple, {
109
+ disabled: !_ctx.ripple || _ctx.disabled || _ctx.loading || _ctx.formDisabled || _ctx.readonly || _ctx.formReadonly
110
+ }]
111
+ ])
112
+ ],
113
+ 6
114
+ /* CLASS, STYLE */
115
+ ),
116
+ _createVNode(_component_var_form_details, { "error-message": _ctx.errorMessage }, null, 8, ["error-message"])
117
+ ], 10, _hoisted_1)), [
121
118
  [_directive_hover, _ctx.hover, "desktop"]
122
119
  ]);
123
120
  }
@@ -44,7 +44,8 @@ function __render__(_ctx, _cache) {
44
44
  "div",
45
45
  {
46
46
  style: _normalizeStyle({ background: _ctx.color, width: _ctx.sameWidth ? _ctx.toSizeUnit(Math.ceil(_ctx.hostSize.width)) : void 0 }),
47
- class: _normalizeClass(_ctx.classes(_ctx.n("content-container"), _ctx.n(`--${_ctx.type}`)))
47
+ class: _normalizeClass(_ctx.classes(_ctx.n("content-container"), _ctx.n(`--${_ctx.type}`))),
48
+ role: "tooltip"
48
49
  },
49
50
  [
50
51
  _renderSlot(_ctx.$slots, "content", {}, () => [