@nexxtmove/ui 0.0.23 → 0.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/index.d.ts CHANGED
@@ -6,6 +6,10 @@ import { PublicProps } from 'vue';
6
6
 
7
7
  declare const __VLS_component: DefineComponent<NexxtButtonProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<NexxtButtonProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLButtonElement>;
8
8
 
9
+ declare const __VLS_component_2: DefineComponent<NexxtHeaderProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<NexxtHeaderProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
10
+
11
+ declare const __VLS_component_3: DefineComponent<NexxtStepperHeaderProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<NexxtStepperHeaderProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLDivElement>;
12
+
9
13
  declare type __VLS_Props = {
10
14
  value: number;
11
15
  duration?: number;
@@ -21,14 +25,49 @@ declare function __VLS_template(): {
21
25
  rootEl: HTMLButtonElement;
22
26
  };
23
27
 
28
+ declare function __VLS_template_2(): {
29
+ attrs: Partial<{}>;
30
+ slots: {
31
+ center?(_: {}): any;
32
+ right?(_: {}): any;
33
+ };
34
+ refs: {};
35
+ rootEl: HTMLDivElement;
36
+ };
37
+
38
+ declare function __VLS_template_3(): {
39
+ attrs: Partial<{}>;
40
+ slots: {
41
+ default?(_: {}): any;
42
+ };
43
+ refs: {};
44
+ rootEl: HTMLDivElement;
45
+ };
46
+
24
47
  declare type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
25
48
 
49
+ declare type __VLS_TemplateResult_2 = ReturnType<typeof __VLS_template_2>;
50
+
51
+ declare type __VLS_TemplateResult_3 = ReturnType<typeof __VLS_template_3>;
52
+
26
53
  declare type __VLS_WithTemplateSlots<T, S> = T & {
27
54
  new (): {
28
55
  $slots: S;
29
56
  };
30
57
  };
31
58
 
59
+ declare type __VLS_WithTemplateSlots_2<T, S> = T & {
60
+ new (): {
61
+ $slots: S;
62
+ };
63
+ };
64
+
65
+ declare type __VLS_WithTemplateSlots_3<T, S> = T & {
66
+ new (): {
67
+ $slots: S;
68
+ };
69
+ };
70
+
32
71
  declare type EasingFunction = 'ease-linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
33
72
 
34
73
  declare type IconType = 'regular' | 'solid' | 'light' | 'duotone' | 'brands';
@@ -46,6 +85,14 @@ declare interface NexxtButtonProps {
46
85
  buttonType?: 'button' | 'submit' | 'reset';
47
86
  }
48
87
 
88
+ export declare const NexxtHeader: __VLS_WithTemplateSlots_2<typeof __VLS_component_2, __VLS_TemplateResult_2["slots"]>;
89
+
90
+ declare interface NexxtHeaderProps {
91
+ title: string;
92
+ backButtonText?: string;
93
+ backButtonAction?: () => void;
94
+ }
95
+
49
96
  export declare const NexxtIcon: DefineComponent<NexxtIconProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<NexxtIconProps> & Readonly<{}>, {}, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLElement>;
50
97
 
51
98
  declare interface NexxtIconProps {
@@ -62,4 +109,14 @@ declare interface NexxtProgressBarProps {
62
109
  stepTitles?: string[];
63
110
  }
64
111
 
112
+ export declare const NexxtStepperHeader: __VLS_WithTemplateSlots_3<typeof __VLS_component_3, __VLS_TemplateResult_3["slots"]>;
113
+
114
+ declare interface NexxtStepperHeaderProps {
115
+ title: string;
116
+ currentStep: InstanceType<typeof NexxtProgressBar>['currentStep'];
117
+ steps: InstanceType<typeof NexxtProgressBar>['stepTitles'];
118
+ backButtonText?: InstanceType<typeof NexxtHeader>['backButtonText'];
119
+ backButtonAction: InstanceType<typeof NexxtHeader>['backButtonAction'];
120
+ }
121
+
65
122
  export { }
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { defineComponent as f, ref as T, computed as r, watch as B, createBlock as $, openBlock as a, TransitionGroup as N, withCtx as h, createElementBlock as l, Fragment as p, renderList as w, createVNode as v, Transition as k, toDisplayString as g, normalizeClass as o, createCommentVNode as u, renderSlot as S, watchEffect as j, createElementVNode as d, normalizeStyle as P } from "vue";
2
- const C = /* @__PURE__ */ f({
1
+ import { defineComponent as v, ref as T, computed as u, watch as N, createBlock as g, openBlock as a, TransitionGroup as S, withCtx as d, createElementBlock as s, Fragment as p, renderList as B, createVNode as f, Transition as w, toDisplayString as m, normalizeClass as n, createCommentVNode as o, renderSlot as y, createElementVNode as r, createTextVNode as j, watchEffect as A, normalizeStyle as C, createSlots as H } from "vue";
2
+ const P = /* @__PURE__ */ v({
3
3
  __name: "AnimatedNumber",
4
4
  props: {
5
5
  value: {},
@@ -7,39 +7,39 @@ const C = /* @__PURE__ */ f({
7
7
  easing: { default: "ease-out" }
8
8
  },
9
9
  setup(e) {
10
- const t = T("up"), s = r(() => String(e.value).split("")), n = r(() => `duration-${e.duration}`);
11
- return B(
10
+ const t = T("up"), l = u(() => String(e.value).split("")), i = u(() => `duration-${e.duration}`);
11
+ return N(
12
12
  () => e.value,
13
- (i, m) => {
14
- t.value = i > m ? "up" : "down";
13
+ (c, b) => {
14
+ t.value = c > b ? "up" : "down";
15
15
  }
16
- ), (i, m) => (a(), $(N, {
16
+ ), (c, b) => (a(), g(S, {
17
17
  tag: "div",
18
18
  class: "relative flex shrink-0 items-center tabular-nums",
19
19
  "aria-label": e.value,
20
- "enter-active-class": `transition-all ${n.value} ${e.easing}`,
21
- "leave-active-class": `absolute transition-all ${n.value} ${e.easing}`,
20
+ "enter-active-class": `transition-all ${i.value} ${e.easing}`,
21
+ "leave-active-class": `absolute transition-all ${i.value} ${e.easing}`,
22
22
  "enter-from-class": t.value === "up" ? "translate-y-full opacity-0" : "-translate-y-full opacity-0",
23
23
  "leave-to-class": t.value === "up" ? "-translate-y-full opacity-0" : "translate-y-full opacity-0",
24
24
  "move-class": "transition-all duration-500 ease-in-out"
25
25
  }, {
26
- default: h(() => [
27
- (a(!0), l(p, null, w(s.value, (y, c) => (a(), l("div", {
28
- key: c,
26
+ default: d(() => [
27
+ (a(!0), s(p, null, B(l.value, (x, h) => (a(), s("div", {
28
+ key: h,
29
29
  class: "relative inline-flex h-[1.5em] w-[1ch] items-center justify-center overflow-hidden",
30
30
  "aria-hidden": "true"
31
31
  }, [
32
- v(k, {
33
- "enter-active-class": `transition-transform ${n.value} ${e.easing}`,
34
- "leave-active-class": `absolute inset-0 transition-transform ${n.value} ${e.easing}`,
32
+ f(w, {
33
+ "enter-active-class": `transition-transform ${i.value} ${e.easing}`,
34
+ "leave-active-class": `absolute inset-0 transition-transform ${i.value} ${e.easing}`,
35
35
  "enter-from-class": t.value === "up" ? "translate-y-full" : "-translate-y-full",
36
36
  "leave-to-class": t.value === "up" ? "-translate-y-full" : "translate-y-full"
37
37
  }, {
38
- default: h(() => [
39
- (a(), l("span", {
40
- key: y,
38
+ default: d(() => [
39
+ (a(), s("span", {
40
+ key: x,
41
41
  class: "flex h-full w-full items-center justify-center"
42
- }, g(y), 1))
42
+ }, m(x), 1))
43
43
  ]),
44
44
  _: 2
45
45
  }, 1032, ["enter-active-class", "leave-active-class", "enter-from-class", "leave-to-class"])
@@ -48,7 +48,7 @@ const C = /* @__PURE__ */ f({
48
48
  _: 1
49
49
  }, 8, ["aria-label", "enter-active-class", "leave-active-class", "enter-from-class", "leave-to-class"]));
50
50
  }
51
- }), b = /* @__PURE__ */ f({
51
+ }), k = /* @__PURE__ */ v({
52
52
  name: "NexxtIcon",
53
53
  __name: "Icon",
54
54
  props: {
@@ -56,14 +56,14 @@ const C = /* @__PURE__ */ f({
56
56
  type: { default: "light" }
57
57
  },
58
58
  setup(e) {
59
- return (t, s) => (a(), l("i", {
60
- class: o([`fa-${e.type}`, `fa-${e.name}`, "items-center", "justify-center"])
59
+ return (t, l) => (a(), s("i", {
60
+ class: n([`fa-${e.type}`, `fa-${e.name}`, "items-center", "justify-center"])
61
61
  }, null, 2));
62
62
  }
63
- }), M = ["type", "disabled", "data-variant"], V = {
63
+ }), V = ["type", "disabled", "data-variant"], M = {
64
64
  key: 0,
65
- class: /* @__PURE__ */ o(["absolute inset-0 flex items-center justify-center rounded-lg"])
66
- }, q = /* @__PURE__ */ f({
65
+ class: /* @__PURE__ */ n(["absolute inset-0 flex items-center justify-center rounded-lg"])
66
+ }, E = /* @__PURE__ */ v({
67
67
  name: "NexxtButton",
68
68
  __name: "Button",
69
69
  props: {
@@ -75,10 +75,10 @@ const C = /* @__PURE__ */ f({
75
75
  buttonType: { default: "button" }
76
76
  },
77
77
  setup(e) {
78
- return (t, s) => (a(), l("button", {
78
+ return (t, l) => (a(), s("button", {
79
79
  type: e.buttonType,
80
80
  disabled: e.disabled,
81
- class: o([
81
+ class: n([
82
82
  "button relative flex h-10 cursor-pointer items-center justify-center overflow-hidden rounded-lg transition-colors duration-200 focus-visible:outline-3 disabled:cursor-not-allowed",
83
83
  `button-${e.variant}`,
84
84
  t.$slots.default ?? "w-10",
@@ -87,23 +87,23 @@ const C = /* @__PURE__ */ f({
87
87
  ]),
88
88
  "data-variant": e.variant
89
89
  }, [
90
- e.icon ? (a(), $(b, {
90
+ e.icon ? (a(), g(k, {
91
91
  key: 0,
92
92
  name: e.icon,
93
- class: o(["transition-all duration-200", { "order-last": e.iconRight, "opacity-0": e.loading }])
94
- }, null, 8, ["name", "class"])) : u("", !0),
95
- t.$slots.default ? (a(), l("span", {
93
+ class: n(["transition-all duration-200", { "order-last": e.iconRight, "opacity-0": e.loading }])
94
+ }, null, 8, ["name", "class"])) : o("", !0),
95
+ t.$slots.default ? (a(), s("span", {
96
96
  key: 1,
97
- class: o([
97
+ class: n([
98
98
  "inline-block transition-all duration-200",
99
99
  { "opacity-0": e.loading },
100
100
  e.variant === "link" ? "underline underline-offset-1" : "",
101
101
  e.variant === "link" && !e.loading && !e.disabled ? "hover:underline-offset-2" : ""
102
102
  ])
103
103
  }, [
104
- S(t.$slots, "default")
105
- ], 2)) : u("", !0),
106
- v(k, {
104
+ y(t.$slots, "default")
105
+ ], 2)) : o("", !0),
106
+ f(w, {
107
107
  "enter-active-class": "transition-opacity duration-200",
108
108
  "enter-from-class": "opacity-0",
109
109
  "enter-to-class": "opacity-100",
@@ -111,28 +111,69 @@ const C = /* @__PURE__ */ f({
111
111
  "leave-from-class": "opacity-100",
112
112
  "leave-to-class": "opacity-0"
113
113
  }, {
114
- default: h(() => [
115
- e.loading ? (a(), l("div", V, [
116
- v(b, {
114
+ default: d(() => [
115
+ e.loading ? (a(), s("div", M, [
116
+ f(k, {
117
117
  name: "spinner-third",
118
118
  type: "light",
119
119
  class: "fa-spin absolute text-sm"
120
120
  })
121
- ])) : u("", !0)
121
+ ])) : o("", !0)
122
122
  ]),
123
123
  _: 1
124
124
  })
125
- ], 10, M));
125
+ ], 10, V));
126
126
  }
127
- }), E = { class: "@container flex flex-col gap-2" }, I = { class: "flex items-center justify-between gap-2" }, L = ["aria-label", "aria-valuenow", "aria-valuetext"], z = {
127
+ }), I = { class: "flex max-w-full items-center justify-start gap-4" }, L = { class: "block truncate text-lg font-semibold text-sapphire-500" }, z = {
128
+ key: 0,
129
+ class: "col-span-1 col-start-2 flex justify-center"
130
+ }, D = /* @__PURE__ */ v({
131
+ name: "NexxtHeader",
132
+ __name: "Header",
133
+ props: {
134
+ title: {},
135
+ backButtonText: { default: "Back" },
136
+ backButtonAction: { type: Function, default: () => {
137
+ window.history.back();
138
+ } }
139
+ },
140
+ setup(e) {
141
+ return (t, l) => (a(), s("div", {
142
+ class: n(["header flex items-center", t.$slots.center ? "grid grid-cols-3" : ""])
143
+ }, [
144
+ r("div", I, [
145
+ f(E, {
146
+ class: "shrink-0",
147
+ variant: "secondary",
148
+ onClick: e.backButtonAction
149
+ }, {
150
+ default: d(() => [
151
+ j(m(e.backButtonText), 1)
152
+ ]),
153
+ _: 1
154
+ }, 8, ["onClick"]),
155
+ r("span", L, m(e.title), 1)
156
+ ]),
157
+ t.$slots.center ? (a(), s("div", z, [
158
+ y(t.$slots, "center")
159
+ ])) : o("", !0),
160
+ t.$slots.right ? (a(), s("div", {
161
+ key: 1,
162
+ class: n(t.$slots.center ? "col-span-1 col-start-3 flex justify-end" : "ml-auto")
163
+ }, [
164
+ y(t.$slots, "right")
165
+ ], 2)) : o("", !0)
166
+ ], 2));
167
+ }
168
+ }), F = { class: "@container" }, R = { class: "flex flex-col @md:gap-2" }, q = { class: "flex items-center justify-between gap-2" }, G = ["aria-label", "aria-valuenow", "aria-valuetext"], J = {
128
169
  key: 0,
129
170
  class: "flex items-center tabular-nums @md:hidden",
130
171
  "aria-hidden": "true"
131
- }, A = {
172
+ }, K = {
132
173
  key: 0,
133
174
  class: "flex justify-between @max-md:order-first @max-md:justify-center",
134
175
  "aria-label": "Progress steps"
135
- }, D = ["aria-current"], F = /* @__PURE__ */ f({
176
+ }, O = ["aria-current"], Q = /* @__PURE__ */ v({
136
177
  name: "NexxtProgressBar",
137
178
  __name: "ProgressBar",
138
179
  props: {
@@ -142,46 +183,87 @@ const C = /* @__PURE__ */ f({
142
183
  stepTitles: {}
143
184
  },
144
185
  setup(e) {
145
- const t = r(() => Math.min(Math.max(0, e.currentStep), Math.max(0, e.steps - 1))), s = r(() => e.steps > 0 ? t.value + 1 : 0), n = r(() => e.steps <= 1 ? e.steps === 1 ? 100 : 0 : t.value / (e.steps - 1) * 100), i = r(() => !!e.stepTitles?.length);
146
- return j(() => {
186
+ const t = u(() => Math.min(Math.max(0, e.currentStep), Math.max(0, e.steps - 1))), l = u(() => e.steps > 0 ? t.value + 1 : 0), i = u(() => e.steps <= 1 ? e.steps === 1 ? 100 : 0 : t.value / (e.steps - 1) * 100), c = u(() => !!e.stepTitles?.length);
187
+ return A(() => {
147
188
  e.stepTitles && e.stepTitles.length !== e.steps && console.warn(
148
189
  `[NexxtProgressBar] The "stepTitles" array length (${e.stepTitles.length}) must match the "steps" prop (${e.steps}).`
149
190
  );
150
- }), (m, y) => (a(), l("div", E, [
151
- d("div", I, [
152
- d("div", {
153
- class: "progress-bar progress-bar-bar h-2 w-full overflow-hidden rounded-full",
154
- role: "progressbar",
155
- "aria-label": e.progressLabel,
156
- "aria-valuemin": "0",
157
- "aria-valuemax": "100",
158
- "aria-valuenow": Math.round(n.value),
159
- "aria-valuetext": i.value && e.stepTitles?.[t.value] ? `Step ${s.value} of ${e.steps}: ${e.stepTitles[t.value]}` : `Step ${s.value} of ${e.steps}`
160
- }, [
161
- d("div", {
162
- class: "progress-bar-progress h-full transition-all duration-500 ease-out",
163
- style: P({ width: `${n.value}%` }),
164
- "aria-hidden": !0
165
- }, null, 4)
166
- ], 8, L),
167
- i.value ? (a(), l("div", z, [
168
- v(C, { value: s.value }, null, 8, ["value"]),
169
- d("span", null, "/" + g(e.steps), 1)
170
- ])) : u("", !0)
171
- ]),
172
- i.value ? (a(), l("ol", A, [
173
- (a(!0), l(p, null, w(e.stepTitles, (c, x) => (a(), l("li", {
174
- key: c,
175
- class: o(["transition-colors duration-500 @max-md:hidden", x === t.value ? "font-medium text-sapphire-500 @max-md:inline" : ""]),
176
- "aria-current": x === t.value ? "step" : void 0
177
- }, g(c), 11, D))), 128))
178
- ])) : u("", !0)
191
+ }), (b, x) => (a(), s("div", F, [
192
+ r("div", R, [
193
+ r("div", q, [
194
+ r("div", {
195
+ class: "progress-bar progress-bar-bar h-2 w-full overflow-hidden rounded-full",
196
+ role: "progressbar",
197
+ "aria-label": e.progressLabel,
198
+ "aria-valuemin": "0",
199
+ "aria-valuemax": "100",
200
+ "aria-valuenow": Math.round(i.value),
201
+ "aria-valuetext": c.value && e.stepTitles?.[t.value] ? `Step ${l.value} of ${e.steps}: ${e.stepTitles[t.value]}` : `Step ${l.value} of ${e.steps}`
202
+ }, [
203
+ r("div", {
204
+ class: "progress-bar-progress h-full transition-all duration-500 ease-out",
205
+ style: C({ width: `${i.value}%` }),
206
+ "aria-hidden": !0
207
+ }, null, 4)
208
+ ], 8, G),
209
+ c.value ? (a(), s("div", J, [
210
+ f(P, { value: l.value }, null, 8, ["value"]),
211
+ r("span", null, "/" + m(e.steps), 1)
212
+ ])) : o("", !0)
213
+ ]),
214
+ c.value ? (a(), s("ol", K, [
215
+ (a(!0), s(p, null, B(e.stepTitles, (h, $) => (a(), s("li", {
216
+ key: h,
217
+ class: n(["transition-colors duration-500 @max-md:hidden", $ === t.value ? "font-medium text-sapphire-500 @max-md:inline" : ""]),
218
+ "aria-current": $ === t.value ? "step" : void 0
219
+ }, m(h), 11, O))), 128))
220
+ ])) : o("", !0)
221
+ ])
179
222
  ]));
180
223
  }
224
+ }), W = /* @__PURE__ */ v({
225
+ name: "NexxtStepperHeader",
226
+ __name: "StepperHeader",
227
+ props: {
228
+ title: {},
229
+ currentStep: {},
230
+ steps: {},
231
+ backButtonText: {},
232
+ backButtonAction: {}
233
+ },
234
+ setup(e) {
235
+ return (t, l) => (a(), g(D, {
236
+ title: e.title,
237
+ "back-button-action": e.backButtonAction,
238
+ "back-button-text": e.backButtonText
239
+ }, H({ _: 2 }, [
240
+ e.steps ? {
241
+ name: "center",
242
+ fn: d(() => [
243
+ f(Q, {
244
+ class: "w-full",
245
+ steps: e.steps.length,
246
+ "step-titles": e.steps,
247
+ "current-step": e.currentStep
248
+ }, null, 8, ["steps", "step-titles", "current-step"])
249
+ ]),
250
+ key: "0"
251
+ } : void 0,
252
+ t.$slots.default ? {
253
+ name: "right",
254
+ fn: d(() => [
255
+ y(t.$slots, "default")
256
+ ]),
257
+ key: "1"
258
+ } : void 0
259
+ ]), 1032, ["title", "back-button-action", "back-button-text"]));
260
+ }
181
261
  });
182
262
  export {
183
- C as NexxtAnimatedNumber,
184
- q as NexxtButton,
185
- b as NexxtIcon,
186
- F as NexxtProgressBar
263
+ P as NexxtAnimatedNumber,
264
+ E as NexxtButton,
265
+ D as NexxtHeader,
266
+ k as NexxtIcon,
267
+ Q as NexxtProgressBar,
268
+ W as NexxtStepperHeader
187
269
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nexxtmove/ui",
3
3
  "type": "module",
4
- "version": "0.0.23",
4
+ "version": "0.1.0",
5
5
  "exports": {
6
6
  ".": {
7
7
  "types": "./dist/index.d.ts",