eco-vue-js 0.9.8 → 0.9.10

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,6 +1,18 @@
1
- import { defineComponent, useTemplateRef, watch, nextTick, onMounted, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot, createBlock, Suspense, withCtx, resolveDynamicComponent, createCommentVNode, createTextVNode, toDisplayString, createVNode, Transition } from 'vue';
1
+ import { defineComponent, useTemplateRef, watch, nextTick, onMounted, openBlock, createElementBlock, normalizeClass, createElementVNode, createBlock, unref, createCommentVNode, renderSlot, normalizeProps, mergeProps, Suspense, withCtx, resolveDynamicComponent, createTextVNode, toDisplayString, guardReactiveProps, createVNode, Transition } from 'vue';
2
+ import IconCheckCircle from '../../../assets/icons/sax/IconCheckCircle.svg.js';
3
+ import IconClose from '../../../assets/icons/sax/IconClose.svg.js';
4
+ import IconNegativeInfo from '../../../assets/icons/sax/IconNegativeInfo.svg.js';
2
5
 
3
- const _hoisted_1 = { class: "whitespace-nowrap px-4" };
6
+ const _hoisted_1 = ["disabled"];
7
+ const _hoisted_2 = {
8
+ key: 0,
9
+ class: "p-8"
10
+ };
11
+ const _hoisted_3 = { class: "whitespace-nowrap px-4" };
12
+ const _hoisted_4 = {
13
+ key: 2,
14
+ class: "absolute bottom-0 h-1 w-full rounded-sm bg-current"
15
+ };
4
16
  const _sfc_main = /* @__PURE__ */ defineComponent({
5
17
  __name: "TabTitleButton",
6
18
  props: {
@@ -8,29 +20,36 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
8
20
  index: {},
9
21
  hasError: { type: Boolean },
10
22
  hasChanges: { type: Boolean },
23
+ hasValue: { type: Boolean },
11
24
  title: {},
12
25
  icon: {},
26
+ first: { type: Boolean },
27
+ last: { type: Boolean },
28
+ disabled: { type: Boolean },
29
+ stepper: { type: Boolean },
30
+ showHasValue: { type: Boolean },
31
+ noIndicator: { type: Boolean },
13
32
  side: { type: Boolean }
14
33
  },
15
34
  emits: ["click", "update:indicator-style", "update:scroll-position"],
16
35
  setup(__props, { expose: __expose, emit: __emit }) {
17
36
  const props = __props;
18
37
  const emit = __emit;
19
- const buttonRef = useTemplateRef("button");
38
+ const containerRef = useTemplateRef("container");
20
39
  const updateIndicator = () => {
21
- if (!props.active) return;
22
- if (!buttonRef.value || !buttonRef.value.offsetWidth) return;
40
+ if (!props.active || props.noIndicator) return;
41
+ if (!containerRef.value || !containerRef.value.offsetWidth) return;
23
42
  if (props.side) {
24
43
  emit("update:indicator-style", {
25
- height: buttonRef.value.offsetHeight + "px",
26
- top: buttonRef.value.offsetTop + "px",
44
+ height: containerRef.value.offsetHeight + "px",
45
+ top: containerRef.value.offsetTop + "px",
27
46
  left: "0",
28
47
  width: "0.25rem"
29
48
  });
30
49
  } else {
31
50
  emit("update:indicator-style", {
32
- width: buttonRef.value.offsetWidth + "px",
33
- left: buttonRef.value.offsetLeft + "px",
51
+ width: containerRef.value.offsetWidth + "px",
52
+ left: containerRef.value.offsetLeft + "px",
34
53
  bottom: "0",
35
54
  height: "0.25rem"
36
55
  });
@@ -38,11 +57,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
38
57
  };
39
58
  const updateScrollPosition = () => {
40
59
  if (!props.active) return;
41
- if (!buttonRef.value || !buttonRef.value.offsetWidth) return;
60
+ if (!containerRef.value || !containerRef.value.offsetWidth) return;
42
61
  if (props.side) {
43
- emit("update:scroll-position", { top: buttonRef.value.offsetTop });
62
+ emit("update:scroll-position", { top: containerRef.value.offsetTop + containerRef.value.offsetHeight / 2 });
44
63
  } else {
45
- emit("update:scroll-position", { left: buttonRef.value.offsetLeft });
64
+ emit("update:scroll-position", { left: containerRef.value.offsetLeft + containerRef.value.offsetWidth / 2 });
46
65
  }
47
66
  };
48
67
  const update = () => {
@@ -64,60 +83,97 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
64
83
  update
65
84
  });
66
85
  return (_ctx, _cache) => {
67
- return openBlock(), createElementBlock("button", {
68
- ref: "button",
69
- class: "text-description grid cursor-pointer select-none snap-center font-semibold outline-none transition-colors duration-500",
70
- onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
86
+ return openBlock(), createElementBlock("div", {
87
+ ref: "container",
88
+ class: normalizeClass(["relative grid", {
89
+ "col-span-2 grid grid-cols-subgrid": _ctx.side,
90
+ "grid-cols-[1fr,auto]": !_ctx.side
91
+ }])
71
92
  }, [
72
- createElementVNode("div", {
73
- class: normalizeClass(["w-ripple w-ripple-hover relative", {
74
- "text-primary-default dark:text-primary-dark": _ctx.active && !_ctx.hasError,
75
- "text-negative dark:text-negative-dark": _ctx.hasError
76
- }])
93
+ createElementVNode("button", {
94
+ disabled: _ctx.disabled,
95
+ class: normalizeClass(["w-ripple-trigger grid select-none snap-center grid-cols-[auto,1fr] font-semibold outline-none transition-colors duration-500", {
96
+ "text-primary-default dark:text-primary-dark": !_ctx.hasError && _ctx.active,
97
+ "text-negative dark:text-negative-dark": _ctx.hasError,
98
+ "text-positive dark:text-positive-dark": _ctx.showHasValue && !_ctx.active && !_ctx.hasError && _ctx.hasValue,
99
+ "text-description": !_ctx.active && !_ctx.hasError && (_ctx.showHasValue ? !_ctx.hasValue : true),
100
+ "cursor-not-allowed opacity-50": _ctx.disabled,
101
+ "cursor-pointer": !_ctx.disabled
102
+ }]),
103
+ onClick: _cache[0] || (_cache[0] = ($event) => !_ctx.disabled && _ctx.$emit("click", $event))
77
104
  }, [
78
- _ctx.$slots.title ? renderSlot(_ctx.$slots, "title", { key: 0 }) : (openBlock(), createElementBlock("div", {
79
- key: 1,
80
- class: normalizeClass(["flex items-center", {
81
- "h-10 justify-center text-center": !_ctx.side,
82
- "py-3 text-start": _ctx.side
105
+ _ctx.stepper ? (openBlock(), createElementBlock("div", _hoisted_2, [
106
+ createElementVNode("div", {
107
+ class: normalizeClass(["text-default dark:text-default-dark rounded-full bg-[inherit] bg-opacity-100 p-1 outline transition-[outline-width] duration-500", {
108
+ "bg-negative dark:bg-negative-dark outline-negative/10 dark:outline-negative-dark/10": _ctx.hasError,
109
+ "bg-positive dark:bg-positive-dark outline-positive/10 dark:outline-positive-dark/10": !_ctx.hasError && _ctx.hasValue,
110
+ "bg-gray-400 outline-gray-400/10 dark:bg-gray-600 dark:outline-gray-600/10": !_ctx.hasError && !_ctx.hasValue,
111
+ "outline-[1.5rem]": _ctx.active
112
+ }])
113
+ }, [
114
+ _ctx.hasError ? (openBlock(), createBlock(unref(IconNegativeInfo), {
115
+ key: 0,
116
+ class: "size-8"
117
+ })) : _ctx.hasValue ? (openBlock(), createBlock(unref(IconCheckCircle), {
118
+ key: 1,
119
+ class: "size-8"
120
+ })) : (openBlock(), createBlock(unref(IconClose), {
121
+ key: 2,
122
+ class: "size-8"
123
+ }))
124
+ ], 2)
125
+ ])) : createCommentVNode("", true),
126
+ createElementVNode("div", {
127
+ class: normalizeClass(["relative col-start-2", {
128
+ "mt-3": _ctx.stepper,
129
+ "w-ripple w-ripple-hover": !_ctx.disabled
83
130
  }])
84
131
  }, [
85
- createElementVNode("div", _hoisted_1, [
86
- _ctx.icon !== void 0 ? (openBlock(), createBlock(Suspense, { key: 0 }, {
87
- fallback: withCtx(() => _cache[1] || (_cache[1] = [
88
- createElementVNode("svg", { class: "square-5 -mt-1 inline" }, [
89
- createElementVNode("g")
90
- ], -1)
91
- ])),
92
- default: withCtx(() => [
93
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { class: "square-5 -mt-1 inline" }))
94
- ]),
95
- _: 1
96
- })) : createCommentVNode("", true),
97
- createTextVNode(" " + toDisplayString(_ctx.title), 1)
98
- ]),
99
- renderSlot(_ctx.$slots, "suffix")
100
- ], 2)),
101
- createVNode(Transition, {
102
- "enter-active-class": "transition-opacity",
103
- "leave-active-class": "transition-opacity",
104
- "enter-from-class": "opacity-0",
105
- "leave-to-class": "opacity-0"
106
- }, {
107
- default: withCtx(() => [
108
- _ctx.hasChanges ? (openBlock(), createElementBlock("div", {
109
- key: 0,
110
- class: normalizeClass(["square-2 absolute right-0 top-0 rounded-full transition-colors duration-500", {
111
- "bg-info dark:bg-info-dark": !_ctx.hasError,
112
- "bg-negative dark:bg-negative-dark": _ctx.hasError
113
- }])
114
- }, null, 2)) : createCommentVNode("", true)
115
- ]),
116
- _: 1
117
- })
118
- ], 2),
119
- renderSlot(_ctx.$slots, "right")
120
- ], 512);
132
+ _ctx.$slots.title ? renderSlot(_ctx.$slots, "title", normalizeProps(mergeProps({ key: 0 }, { hasChanges: _ctx.hasChanges, hasError: _ctx.hasError, hasValue: _ctx.hasValue }))) : (openBlock(), createElementBlock("div", {
133
+ key: 1,
134
+ class: normalizeClass(["flex items-center", {
135
+ "h-10 justify-center text-center": !_ctx.side,
136
+ "py-3 text-start": _ctx.side
137
+ }])
138
+ }, [
139
+ createElementVNode("div", _hoisted_3, [
140
+ _ctx.icon !== void 0 ? (openBlock(), createBlock(Suspense, { key: 0 }, {
141
+ fallback: withCtx(() => _cache[1] || (_cache[1] = [
142
+ createElementVNode("svg", { class: "square-5 -mt-1 inline" }, [
143
+ createElementVNode("g")
144
+ ], -1)
145
+ ])),
146
+ default: withCtx(() => [
147
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { class: "square-5 -mt-1 inline" }))
148
+ ]),
149
+ _: 1
150
+ })) : createCommentVNode("", true),
151
+ createTextVNode(" " + toDisplayString(_ctx.title), 1)
152
+ ]),
153
+ renderSlot(_ctx.$slots, "suffix", normalizeProps(guardReactiveProps({ hasChanges: _ctx.hasChanges, hasError: _ctx.hasError, hasValue: _ctx.hasValue })))
154
+ ], 2)),
155
+ createVNode(Transition, {
156
+ "enter-active-class": "transition-opacity",
157
+ "leave-active-class": "transition-opacity",
158
+ "enter-from-class": "opacity-0",
159
+ "leave-to-class": "opacity-0"
160
+ }, {
161
+ default: withCtx(() => [
162
+ _ctx.hasChanges ? (openBlock(), createElementBlock("div", {
163
+ key: 0,
164
+ class: normalizeClass(["square-2 absolute right-0 top-0 rounded-full transition-colors duration-500", {
165
+ "bg-info dark:bg-info-dark": !_ctx.hasError,
166
+ "bg-negative dark:bg-negative-dark": _ctx.hasError
167
+ }])
168
+ }, null, 2)) : createCommentVNode("", true)
169
+ ]),
170
+ _: 1
171
+ }),
172
+ _ctx.stepper ? (openBlock(), createElementBlock("div", _hoisted_4)) : createCommentVNode("", true)
173
+ ], 2)
174
+ ], 10, _hoisted_1),
175
+ renderSlot(_ctx.$slots, "right", normalizeProps(guardReactiveProps({ hasChanges: _ctx.hasChanges, hasError: _ctx.hasError, hasValue: _ctx.hasValue })))
176
+ ], 2);
121
177
  };
122
178
  }
123
179
  });
@@ -8,8 +8,11 @@ export interface TabsProps {
8
8
  disableMinHeight?: boolean;
9
9
  noHeader?: boolean;
10
10
  switchToNew?: boolean;
11
+ noIndicator?: boolean;
12
+ stepper?: boolean;
13
+ showHasValue?: boolean;
11
14
  }
12
- export type TabsStepperProps = Omit<TabsProps, 'switchToNew' | 'noHeader' | 'side'>;
15
+ export type TabsStepperProps = Omit<TabsProps, 'switchToNew' | 'noIndicator' | 'side'>;
13
16
  export type TabsItemScopedProps = {
14
17
  hasError: boolean;
15
18
  hasChanges: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,KAAK,CAAA;AAE9B,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,EAAE,KAAK,EAAE,CAAA;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,GAAG,UAAU,GAAG,MAAM,CAAC,CAAA;AAEnF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,KAAK,CAAA;AAE9B,MAAM,WAAW,SAAS;IACxB,WAAW,CAAC,EAAE,KAAK,EAAE,CAAA;IACrB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,YAAY,CAAC,EAAE,OAAO,CAAA;CACvB;AAED,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa,GAAG,MAAM,CAAC,CAAA;AAEtF,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,OAAO,CAAA;IACnB,QAAQ,EAAE,OAAO,CAAA;CAClB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"useDefaultQuery.d.ts","sourceRoot":"","sources":["../../src/utils/useDefaultQuery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,KAAK,kBAAkB,EAA2B,MAAM,qBAAqB,CAAA;AAGtH,OAAO,EAAC,QAAQ,EAA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G,OAAO,IAAI,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,WAAW,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAEhI,KAAK,yBAAyB,CAAC,YAAY,GAAG,OAAO,EAAE,KAAK,GAAG,YAAY,IAAI,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG;IACnH,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,CAAA;CAC/B,CAAA;AAED,eAAO,MAAM,eAAe,GAC1B,YAAY,YACZ,KAAK,iBACL,SAAS,SAAS,QAAQ;;;+EACuD,yBAAyB,CAAC,YAAY,EAAE,KAAK,CAO/H,CAAA;AAED,eAAO,MAAM,WAAW,KAAK,CAAA;AAE7B,eAAO,MAAM,kBAAkB,GAAI,IAAI,EAAE,WAAW,SAAS;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC,OAAO,MAAM,UAAU,CAAC,WAAW,EAAE,WAAW,KAAK,IAAI,EAAE,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,IAAI,0BAA6B,iBAAiB,CAAC,IAAI,EAAE,WAAW,CAsDvO,CAAA"}
@@ -31,6 +31,7 @@ const makeQueryPaginated = (key, getter, setter, pageLength = PAGE_LENGTH) => {
31
31
  },
32
32
  ...options
33
33
  });
34
+ const setDataOld = query.setData;
34
35
  query.setData = (data, options2) => {
35
36
  if (setter && unref(options2)?.index !== void 0) {
36
37
  const index = unref(unref(options2)?.index);
@@ -48,7 +49,7 @@ const makeQueryPaginated = (key, getter, setter, pageLength = PAGE_LENGTH) => {
48
49
  }
49
50
  }
50
51
  }
51
- return query.setData(data, options2);
52
+ return setDataOld(data, options2);
52
53
  };
53
54
  return query;
54
55
  };
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.9.8",
7
+ "version": "0.9.10",
8
8
  "scripts": {
9
9
  "build": "run-p type-check \"build-only {@}\" --",
10
10
  "preview": "vite preview",