eco-vue-js 0.5.17 → 0.5.19

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.
@@ -38,13 +38,20 @@ declare const _default: <Item extends string | number = string>(__VLS_props: {
38
38
  allowCreate?: boolean | undefined;
39
39
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: {
40
40
  attrs: any;
41
- slots: {
42
- option?(_: {
43
- option: string;
41
+ slots: Readonly<{
42
+ option?: ((props: {
43
+ option: Item | string;
44
44
  selected: boolean;
45
45
  model: boolean;
46
- }): any;
47
- right?(_: {}): any;
46
+ }) => void) | undefined;
47
+ right?: (() => void) | undefined;
48
+ }> & {
49
+ option?: ((props: {
50
+ option: Item | string;
51
+ selected: boolean;
52
+ model: boolean;
53
+ }) => void) | undefined;
54
+ right?: (() => void) | undefined;
48
55
  };
49
56
  emit: {
50
57
  (e: 'select', item: Item): void;
@@ -101,13 +108,20 @@ declare const _default: <Item extends string | number = string>(__VLS_props: {
101
108
  blur: () => void;
102
109
  }>): void;
103
110
  attrs: any;
104
- slots: {
105
- option?(_: {
106
- option: string;
111
+ slots: Readonly<{
112
+ option?: ((props: {
113
+ option: Item | string;
114
+ selected: boolean;
115
+ model: boolean;
116
+ }) => void) | undefined;
117
+ right?: (() => void) | undefined;
118
+ }> & {
119
+ option?: ((props: {
120
+ option: Item | string;
107
121
  selected: boolean;
108
122
  model: boolean;
109
- }): any;
110
- right?(_: {}): any;
123
+ }) => void) | undefined;
124
+ right?: (() => void) | undefined;
111
125
  };
112
126
  emit: {
113
127
  (e: 'select', item: Item): void;
@@ -164,13 +178,20 @@ declare const _default: <Item extends string | number = string>(__VLS_props: {
164
178
  blur: () => void;
165
179
  }>): void;
166
180
  attrs: any;
167
- slots: {
168
- option?(_: {
169
- option: string;
181
+ slots: Readonly<{
182
+ option?: ((props: {
183
+ option: Item | string;
184
+ selected: boolean;
185
+ model: boolean;
186
+ }) => void) | undefined;
187
+ right?: (() => void) | undefined;
188
+ }> & {
189
+ option?: ((props: {
190
+ option: Item | string;
170
191
  selected: boolean;
171
192
  model: boolean;
172
- }): any;
173
- right?(_: {}): any;
193
+ }) => void) | undefined;
194
+ right?: (() => void) | undefined;
174
195
  };
175
196
  emit: {
176
197
  (e: 'select', item: Item): void;
@@ -1 +1 @@
1
- {"version":3,"file":"WSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Select/WSelect.vue"],"names":[],"mappings":"AA2KA;AAEA,OAAO,EAAwC,KAAK,SAAS,EAAC,MAAM,KAAK,CAAA;;;YA2nB/D,MAAM;;;;;;;;gBADF,IAAI,EAAE;;;;;;;;;;;;;;;aAET,IAAI,EAAE;;;gBAOsB,IAAI;;;;;;;;;;WAwBpC,GAAG;;;;;;YAtEoB,GAAG;uBACL,GAAG;;;YA1iBzB,QAAQ,QAAQ,IAAI,GAAG,IAAI;YAC3B,UAAU,QAAQ,IAAI,GAAG,IAAI;YAC7B,eAAe,SAAS,MAAM,GAAG,IAAI;YACrC,eAAe,SAAS,MAAM,GAAG,IAAI;YACrC,OAAO,SAAS,UAAU,GAAG,IAAI;YACjC,MAAM,SAAS,UAAU,GAAG,IAAI;;;;;OAymBiC,IAAI;;;gBA/BjE,MAAM;;;;;;;;oBADF,IAAI,EAAE;;;;;;;;;;;;;;;iBAET,IAAI,EAAE;;;oBAOsB,IAAI;;;;;;;;;;;;;SAuB4B,IAAI;WACpE,GAAG;;;;;;YAtEoB,GAAG;uBACL,GAAG;;;YA1iBzB,QAAQ,QAAQ,IAAI,GAAG,IAAI;YAC3B,UAAU,QAAQ,IAAI,GAAG,IAAI;YAC7B,eAAe,SAAS,MAAM,GAAG,IAAI;YACrC,eAAe,SAAS,MAAM,GAAG,IAAI;YACrC,OAAO,SAAS,UAAU,GAAG,IAAI;YACjC,MAAM,SAAS,UAAU,GAAG,IAAI;;;;;;;;oBA0kB5B,MAAM;;;;;;;;wBADF,IAAI,EAAE;;;;;;;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U,GAAG,IAAI;;;;AAzCtC,wBAskB2E"}
@@ -1,18 +1,16 @@
1
- import { defineComponent, ref, computed, watch, toRef, nextTick, openBlock, createBlock, unref, withModifiers, createSlots, withCtx, createElementBlock, Fragment, renderList, normalizeClass, renderSlot, resolveDynamicComponent, createVNode, createCommentVNode, createElementVNode, toDisplayString } from 'vue';
2
- import _sfc_main$2 from './components/SelectOption.vue.js';
3
- import IconCancel from '../../assets/icons/default/IconCancel.svg.js';
1
+ import { defineComponent, ref, computed, watch, toRef, nextTick, openBlock, createBlock, unref, withModifiers, createSlots, withCtx, createElementBlock, Fragment, renderList, renderSlot, createCommentVNode, createElementVNode, toDisplayString, resolveDynamicComponent } from 'vue';
2
+ import _sfc_main$3 from './components/SelectOption.vue.js';
3
+ import _sfc_main$2 from './components/SelectOptionPrefix.vue.js';
4
4
  import { getIsMobile } from '../../utils/mobile.js';
5
5
  import { debounce } from '../../utils/utils.js';
6
6
  import _sfc_main$1 from '../Input/WInputSuggest.vue.js';
7
7
 
8
- const _hoisted_1 = ["onClick"];
9
- const _hoisted_2 = ["onClick"];
10
- const _hoisted_3 = {
8
+ const _hoisted_1 = {
11
9
  key: 0,
12
10
  class: "py-2 px-[1.0625rem] first:pt-4 last:pb-4"
13
11
  };
14
- const _hoisted_4 = { class: "select-none cursor-default w-select-field sm-not:px-3" };
15
- const _hoisted_5 = /* @__PURE__ */ createElementVNode("span", { class: "w-select-field pr-2 sm-not:px-3" }, " Create: ", -1);
12
+ const _hoisted_2 = { class: "select-none cursor-default w-select-field sm-not:px-3" };
13
+ const _hoisted_3 = /* @__PURE__ */ createElementVNode("span", { class: "w-select-field pr-2 sm-not:px-3" }, " Create: ", -1);
16
14
  const _sfc_main = /* @__PURE__ */ defineComponent({
17
15
  __name: "WSelect",
18
16
  props: {
@@ -173,85 +171,53 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
173
171
  icon: _ctx.icon,
174
172
  mono: _ctx.mono,
175
173
  autofocus: _ctx.autofocus,
176
- "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => !_ctx.loading && _ctx.$emit("update:search", $event ?? "")),
174
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => !_ctx.loading && _ctx.$emit("update:search", $event ?? "")),
177
175
  "onKeypress:enter": withModifiers(selectCursor, ["stop", "prevent"]),
178
176
  "onKeypress:up": withModifiers(cursorUp, ["prevent"]),
179
177
  "onKeypress:down": withModifiers(cursorDown, ["prevent"]),
180
178
  "onKeypress:delete": captureDoubleDelete,
181
- onOpen: _cache[5] || (_cache[5] = ($event) => isOpen.value = true),
182
- onClose: _cache[6] || (_cache[6] = ($event) => {
179
+ onOpen: _cache[3] || (_cache[3] = ($event) => isOpen.value = true),
180
+ onClose: _cache[4] || (_cache[4] = ($event) => {
183
181
  close();
184
182
  _ctx.$emit("update:search", "");
185
183
  }),
186
- onFocus: _cache[7] || (_cache[7] = ($event) => {
184
+ onFocus: _cache[5] || (_cache[5] = ($event) => {
187
185
  focused.value = true;
188
186
  _ctx.$emit("focus", $event);
189
187
  }),
190
- onBlur: _cache[8] || (_cache[8] = ($event) => {
188
+ onBlur: _cache[6] || (_cache[6] = ($event) => {
191
189
  focused.value = false;
192
190
  _ctx.$emit("blur", $event);
193
191
  })
194
192
  }, createSlots({
195
193
  prefix: withCtx(({ unclickable }) => [
196
194
  (_ctx.hidePrefix ? unref(isMobile) ? unclickable || !focused.value : !isOpen.value : true) ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(_ctx.modelValue, (option) => {
197
- return openBlock(), createElementBlock("div", {
195
+ return openBlock(), createBlock(_sfc_main$2, {
198
196
  key: option,
199
- class: normalizeClass(["relative flex overflow-hidden items-center text-description group/model", {
200
- "cursor-pointer": !_ctx.disabled,
201
- "cursor-not-allowed opacity-50": _ctx.disabled
202
- }])
203
- }, [
204
- renderSlot(_ctx.$slots, "option", {
205
- option,
206
- selected: true,
207
- model: true
208
- }, () => [
209
- _ctx.optionComponent ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.optionComponent), {
210
- key: 0,
197
+ option,
198
+ "option-component": _ctx.optionComponent,
199
+ loading: _ctx.loading,
200
+ disabled: _ctx.disabled,
201
+ "disable-clear": _ctx.disableClear,
202
+ onUnselect: ($event) => unselect(option)
203
+ }, {
204
+ option: withCtx(() => [
205
+ renderSlot(_ctx.$slots, "option", {
211
206
  option,
212
207
  selected: true,
213
208
  model: true
214
- }, {
215
- default: withCtx(() => [
216
- !_ctx.disableClear ? (openBlock(), createElementBlock("button", {
217
- key: 0,
218
- class: normalizeClass(["relative flex square-5 rounded-full -my-1 -mr-2 ml-1 items-center justify-center outline-none", {
219
- "cursor-not-allowed": _ctx.disabled,
220
- "cursor-progress": _ctx.loading,
221
- "cursor-pointer w-ripple w-ripple-hover ": !_ctx.loading && !_ctx.disabled
222
- }]),
223
- onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
224
- }, ["stop", "prevent"])),
225
- onClick: withModifiers(($event) => !_ctx.loading && unselect(option), ["stop", "prevent"])
226
- }, [
227
- createVNode(unref(IconCancel), { class: "square-3" })
228
- ], 42, _hoisted_1)) : createCommentVNode("", true)
229
- ]),
230
- _: 2
231
- }, 1032, ["option"])) : createCommentVNode("", true)
209
+ })
232
210
  ]),
233
- !_ctx.optionComponent && !_ctx.disableClear ? (openBlock(), createElementBlock("button", {
234
- key: 0,
235
- class: normalizeClass(["relative flex square-5 rounded-full items-center justify-center outline-none", {
236
- "cursor-not-allowed": _ctx.disabled,
237
- "cursor-progress": _ctx.loading,
238
- "cursor-pointer w-ripple w-ripple-hover ": !_ctx.loading && !_ctx.disabled
239
- }]),
240
- onMousedown: _cache[1] || (_cache[1] = withModifiers(() => {
241
- }, ["stop", "prevent"])),
242
- onClick: withModifiers(($event) => !_ctx.loading && unselect(option), ["stop", "prevent"])
243
- }, [
244
- createVNode(unref(IconCancel), { class: "square-3" })
245
- ], 42, _hoisted_2)) : createCommentVNode("", true)
246
- ], 2);
211
+ _: 2
212
+ }, 1032, ["option", "option-component", "loading", "disabled", "disable-clear", "onUnselect"]);
247
213
  }), 128)) : createCommentVNode("", true)
248
214
  ]),
249
215
  content: withCtx(() => [
250
- !_ctx.options.length ? (openBlock(), createElementBlock("div", _hoisted_3, [
251
- createElementVNode("div", _hoisted_4, toDisplayString(_ctx.emptyStub ?? "No match"), 1)
216
+ !_ctx.options.length ? (openBlock(), createElementBlock("div", _hoisted_1, [
217
+ createElementVNode("div", _hoisted_2, toDisplayString(_ctx.emptyStub ?? "No match"), 1)
252
218
  ])) : createCommentVNode("", true),
253
219
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.options, (option, index) => {
254
- return openBlock(), createBlock(_sfc_main$2, {
220
+ return openBlock(), createBlock(_sfc_main$3, {
255
221
  key: option,
256
222
  "is-selected": _ctx.modelValue.includes(option),
257
223
  "is-cursor": index === cursor.value,
@@ -285,7 +251,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
285
251
  _: 2
286
252
  }, 1032, ["is-selected", "is-cursor", "loading", "scroll", "hide-option-icon", "onSelect", "onUnselect", "onMouseenter"]);
287
253
  }), 128)),
288
- _ctx.allowCreate && _ctx.search !== "" ? (openBlock(), createBlock(_sfc_main$2, {
254
+ _ctx.allowCreate && _ctx.search !== "" ? (openBlock(), createBlock(_sfc_main$3, {
289
255
  key: 1,
290
256
  "is-selected": false,
291
257
  "is-cursor": cursor.value === _ctx.options.length,
@@ -293,11 +259,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
293
259
  scroll: isCursorLocked.value,
294
260
  "hide-option-icon": _ctx.hideOptionIcon,
295
261
  class: "first:pt-4 last:pb-4",
296
- onSelect: _cache[2] || (_cache[2] = ($event) => createOption(_ctx.search)),
297
- onMouseenter: _cache[3] || (_cache[3] = ($event) => setCursor(_ctx.options.length))
262
+ onSelect: _cache[0] || (_cache[0] = ($event) => createOption(_ctx.search)),
263
+ onMouseenter: _cache[1] || (_cache[1] = ($event) => setCursor(_ctx.options.length))
298
264
  }, {
299
265
  default: withCtx(() => [
300
- _hoisted_5,
266
+ _hoisted_3,
301
267
  renderSlot(_ctx.$slots, "option", {
302
268
  option: _ctx.search,
303
269
  selected: false,
@@ -37,7 +37,7 @@ declare const _default: <Item extends string | number, AllowClear extends boolea
37
37
  attrs: any;
38
38
  slots: {
39
39
  option?(_: {
40
- option: string;
40
+ option: string | Item;
41
41
  selected: boolean;
42
42
  model: boolean;
43
43
  }): any;
@@ -92,7 +92,7 @@ declare const _default: <Item extends string | number, AllowClear extends boolea
92
92
  attrs: any;
93
93
  slots: {
94
94
  option?(_: {
95
- option: string;
95
+ option: string | Item;
96
96
  selected: boolean;
97
97
  model: boolean;
98
98
  }): any;
@@ -148,7 +148,7 @@ declare const _default: <Item extends string | number, AllowClear extends boolea
148
148
  attrs: any;
149
149
  slots: {
150
150
  option?(_: {
151
- option: string;
151
+ option: string | Item;
152
152
  selected: boolean;
153
153
  model: boolean;
154
154
  }): any;
@@ -0,0 +1,63 @@
1
+ import type { Component } from 'vue';
2
+ declare const _default: <Item extends string | number = string>(__VLS_props: {
3
+ option: Item;
4
+ disabled?: boolean | undefined;
5
+ loading?: boolean | undefined;
6
+ onUnselect?: (() => any) | undefined;
7
+ optionComponent?: Component<{
8
+ option: Item;
9
+ selected?: boolean | undefined;
10
+ model?: boolean | undefined;
11
+ }> | undefined;
12
+ disableClear?: boolean | undefined;
13
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, __VLS_ctx?: {
14
+ attrs: any;
15
+ slots: {
16
+ option?(_: {}): any;
17
+ };
18
+ emit: (e: 'unselect') => void;
19
+ } | undefined, __VLS_expose?: ((exposed: import('vue').ShallowUnwrapRef<{}>) => void) | undefined, __VLS_setup?: Promise<{
20
+ props: {
21
+ option: Item;
22
+ disabled?: boolean | undefined;
23
+ loading?: boolean | undefined;
24
+ onUnselect?: (() => any) | undefined;
25
+ optionComponent?: Component<{
26
+ option: Item;
27
+ selected?: boolean | undefined;
28
+ model?: boolean | undefined;
29
+ }> | undefined;
30
+ disableClear?: boolean | undefined;
31
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
32
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
33
+ attrs: any;
34
+ slots: {
35
+ option?(_: {}): any;
36
+ };
37
+ emit: (e: 'unselect') => void;
38
+ }>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
39
+ [key: string]: any;
40
+ }> & {
41
+ __ctx?: {
42
+ props: {
43
+ option: Item;
44
+ disabled?: boolean | undefined;
45
+ loading?: boolean | undefined;
46
+ onUnselect?: (() => any) | undefined;
47
+ optionComponent?: Component<{
48
+ option: Item;
49
+ selected?: boolean | undefined;
50
+ model?: boolean | undefined;
51
+ }> | undefined;
52
+ disableClear?: boolean | undefined;
53
+ } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps;
54
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
55
+ attrs: any;
56
+ slots: {
57
+ option?(_: {}): any;
58
+ };
59
+ emit: (e: 'unselect') => void;
60
+ } | undefined;
61
+ };
62
+ export default _default;
63
+ //# sourceMappingURL=SelectOptionPrefix.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectOptionPrefix.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/components/SelectOptionPrefix.vue"],"names":[],"mappings":"AAgDA;AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,KAAK,CAAA;;YAwLxB,IAAI;;;;;gBACyB,IAAI;;;;;;WAWpC,GAAG;;wBA7BkB,GAAG;;cApJzB,UAAU,KAAG,IAAI;yCAgLP,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,KAAG,IAAI;;gBAX/C,IAAI;;;;;oBACyB,IAAI;;;;;;oBAU3B,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;wBA7BkB,GAAG;;cApJzB,UAAU,KAAG,IAAI;;;;;;oBAqKb,IAAI;;;;;wBACyB,IAAI;;;;;;wBAU3B,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;eAClD,GAAG;;4BA7BkB,GAAG;;kBApJzB,UAAU,KAAG,IAAI;;;AAfvB,wBAqM2E"}
@@ -0,0 +1,65 @@
1
+ import { defineComponent, openBlock, createElementBlock, normalizeClass, renderSlot, createBlock, resolveDynamicComponent, withCtx, withModifiers, createVNode, unref, createCommentVNode } from 'vue';
2
+ import IconCancel from '../../../assets/icons/default/IconCancel.svg.js';
3
+
4
+ const _sfc_main = /* @__PURE__ */ defineComponent({
5
+ __name: "SelectOptionPrefix",
6
+ props: {
7
+ option: {},
8
+ optionComponent: {},
9
+ disabled: { type: Boolean },
10
+ loading: { type: Boolean },
11
+ disableClear: { type: Boolean }
12
+ },
13
+ emits: ["unselect"],
14
+ setup(__props) {
15
+ return (_ctx, _cache) => {
16
+ return openBlock(), createElementBlock("div", {
17
+ class: normalizeClass(["relative grid grid-cols-[1fr,auto] items-center text-description group/model", {
18
+ "cursor-pointer": !_ctx.disabled,
19
+ "cursor-not-allowed opacity-50": _ctx.disabled
20
+ }])
21
+ }, [
22
+ renderSlot(_ctx.$slots, "option", {}, () => [
23
+ _ctx.optionComponent ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.optionComponent), {
24
+ key: 0,
25
+ option: _ctx.option,
26
+ selected: true,
27
+ model: true
28
+ }, {
29
+ default: withCtx(() => [
30
+ !_ctx.disableClear ? (openBlock(), createElementBlock("button", {
31
+ key: 0,
32
+ class: normalizeClass(["relative flex square-5 rounded-full -my-1 -mr-2 ml-1 items-center justify-center outline-none", {
33
+ "cursor-not-allowed": _ctx.disabled,
34
+ "cursor-progress": _ctx.loading,
35
+ "cursor-pointer w-ripple w-ripple-hover ": !_ctx.loading && !_ctx.disabled
36
+ }]),
37
+ onMousedown: _cache[0] || (_cache[0] = withModifiers(() => {
38
+ }, ["stop", "prevent"])),
39
+ onClick: _cache[1] || (_cache[1] = withModifiers(($event) => !_ctx.loading && _ctx.$emit("unselect"), ["stop", "prevent"]))
40
+ }, [
41
+ createVNode(unref(IconCancel), { class: "square-3" })
42
+ ], 34)) : createCommentVNode("", true)
43
+ ]),
44
+ _: 1
45
+ }, 8, ["option"])) : createCommentVNode("", true)
46
+ ]),
47
+ !_ctx.optionComponent && !_ctx.disableClear ? (openBlock(), createElementBlock("button", {
48
+ key: 0,
49
+ class: normalizeClass(["relative flex square-5 rounded-full items-center justify-center outline-none", {
50
+ "cursor-not-allowed": _ctx.disabled,
51
+ "cursor-progress": _ctx.loading,
52
+ "cursor-pointer w-ripple w-ripple-hover ": !_ctx.loading && !_ctx.disabled
53
+ }]),
54
+ onMousedown: _cache[2] || (_cache[2] = withModifiers(() => {
55
+ }, ["stop", "prevent"])),
56
+ onClick: _cache[3] || (_cache[3] = withModifiers(($event) => !_ctx.loading && _ctx.$emit("unselect"), ["stop", "prevent"]))
57
+ }, [
58
+ createVNode(unref(IconCancel), { class: "square-3" })
59
+ ], 34)) : createCommentVNode("", true)
60
+ ], 2);
61
+ };
62
+ }
63
+ });
64
+
65
+ export { _sfc_main as default };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from './SelectOptionPrefix.vue.js';
2
+
3
+
4
+
5
+ export { _sfc_main as default };
@@ -1,6 +1,7 @@
1
1
  import { type VNode } from 'vue';
2
2
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimeProps<{
3
3
  names?: string[] | undefined;
4
+ icons?: SVGComponent[] | Record<number, SVGComponent> | undefined;
4
5
  slots?: VNode<import("vue").RendererNode, import("vue").RendererElement, {
5
6
  [key: string]: any;
6
7
  }>[] | undefined;
@@ -20,6 +21,7 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToRuntimePr
20
21
  "update:has-changes": (value: boolean) => void;
21
22
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
22
23
  names?: string[] | undefined;
24
+ icons?: SVGComponent[] | Record<number, SVGComponent> | undefined;
23
25
  slots?: VNode<import("vue").RendererNode, import("vue").RendererElement, {
24
26
  [key: string]: any;
25
27
  }>[] | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"WTabs.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/WTabs.vue"],"names":[],"mappings":"AAkFA;AAEA,OAAO,EAAkC,KAAK,KAAK,EAAoD,MAAM,KAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwYlH,wBAaG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC"}
1
+ {"version":3,"file":"WTabs.vue.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/WTabs.vue"],"names":[],"mappings":"AA2FA;AAEA,OAAO,EAAkC,KAAK,KAAK,EAAoD,MAAM,KAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwZlH,wBAcG;AACH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AACjE,KAAK,6BAA6B,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAAG;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { defineComponent, useSlots, computed, ref, reactive, inject, watch, onMounted, onUnmounted, openBlock, createElementBlock, Fragment, renderList, normalizeClass, unref, createElementVNode, createTextVNode, toDisplayString, createVNode, Transition, withCtx, createCommentVNode, normalizeStyle, TransitionGroup, createBlock, resolveDynamicComponent, nextTick } from 'vue';
1
+ import { defineComponent, useSlots, computed, ref, reactive, inject, watch, onMounted, onUnmounted, openBlock, createElementBlock, Fragment, renderList, normalizeClass, unref, createElementVNode, createBlock, resolveDynamicComponent, createCommentVNode, createTextVNode, toDisplayString, createVNode, Transition, withCtx, normalizeStyle, TransitionGroup, nextTick } from 'vue';
2
2
  import _sfc_main$1 from './components/TabItem.vue.js';
3
3
  import _sfc_main$2 from '../Form/WForm.vue.js';
4
4
  import { throttle, debounce } from '../../utils/utils.js';
@@ -7,14 +7,15 @@ import { wTabItemListener, wTabItemUnlistener } from './models/injection.js';
7
7
  const _hoisted_1 = { class: "mb-8" };
8
8
  const _hoisted_2 = {
9
9
  key: 0,
10
- class: "relative flex mb-4 sm-not:-px--inner-margin"
10
+ class: "relative flex mb-4 sm-not:-px--inner-margin overflow-x-auto overscroll-x-contain no-scrollbar snap-x snap-always snap-mandatory"
11
11
  };
12
12
  const _hoisted_3 = ["onClick"];
13
- const _hoisted_4 = { class: "relative" };
13
+ const _hoisted_4 = { class: "relative whitespace-nowrap px-4" };
14
14
  const _sfc_main = /* @__PURE__ */ defineComponent({
15
15
  __name: "WTabs",
16
16
  props: {
17
17
  names: {},
18
+ icons: {},
18
19
  slots: {},
19
20
  lessTransitions: { type: Boolean },
20
21
  initTab: {}
@@ -102,6 +103,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
102
103
  watch(current, (value) => {
103
104
  emit("update:current", value);
104
105
  updateIndicator();
106
+ button.value[value]?.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" });
105
107
  }, { immediate: true });
106
108
  watch(hasChanges, (value) => {
107
109
  emit("update:has-changes", value);
@@ -130,7 +132,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
130
132
  ref_key: "button",
131
133
  ref: button,
132
134
  key: index,
133
- class: normalizeClass(["flex-1 font-semibold flex items-center justify-center h-10 cursor-pointer relative w-ripple w-ripple-hover select-none transition-colors duration-500 outline-none", {
135
+ class: normalizeClass(["flex-1 font-semibold flex items-center justify-center h-10 cursor-pointer snap-center relative w-ripple w-ripple-hover select-none transition-colors duration-500 outline-none", {
134
136
  "text-description": current.value !== index && isValidMap[index] !== false,
135
137
  "text-primary-default dark:text-primary-dark": current.value === index && isValidMap[index] !== false,
136
138
  "text-negative dark:text-negative-dark": isValidMap[index] === false
@@ -138,7 +140,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
138
140
  onClick: ($event) => unref(switchTab)(index)
139
141
  }, [
140
142
  createElementVNode("div", _hoisted_4, [
141
- createTextVNode(toDisplayString(_ctx.names[index]) + " ", 1),
143
+ _ctx.icons?.[index] ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icons?.[index]), {
144
+ key: 0,
145
+ class: "inline -mt-1"
146
+ })) : createCommentVNode("", true),
147
+ createTextVNode(" " + toDisplayString(_ctx.names[index]) + " ", 1),
142
148
  createVNode(Transition, {
143
149
  "enter-active-class": "transition-opacity",
144
150
  "leave-active-class": "transition-opacity",
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "type": "git",
5
5
  "url": "https://github.com/rsmple/eco-vue-js.git"
6
6
  },
7
- "version": "0.5.17",
7
+ "version": "0.5.19",
8
8
  "scripts": {
9
9
  "dev": "vite",
10
10
  "build": "run-p type-check build-only",