iryx-ui 0.6.0 → 0.8.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.
Files changed (46) hide show
  1. package/README.md +201 -2
  2. package/dist/component-names.d.ts +1 -1
  3. package/dist/components/DatePicker.vue.d.ts +52 -0
  4. package/dist/components/DateRangePicker.vue.d.ts +60 -0
  5. package/dist/components/FileUpload.vue.d.ts +64 -0
  6. package/dist/components/Input.vue.d.ts +39 -1
  7. package/dist/components/Pagination.vue.d.ts +1 -1
  8. package/dist/components/PasswordInput.vue.d.ts +54 -0
  9. package/dist/components/Textarea.vue.d.ts +16 -1
  10. package/dist/components/index.d.ts +4 -0
  11. package/dist/composables/date.d.ts +21 -0
  12. package/dist/index.d.ts +5 -0
  13. package/dist/index.js +53 -44
  14. package/dist/node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js +170 -8
  15. package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/CalendarDate.js +122 -0
  16. package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/DateFormatter.js +84 -0
  17. package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/calendars/GregorianCalendar.js +91 -0
  18. package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/conversion.js +107 -0
  19. package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/manipulation.js +159 -0
  20. package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/queries.js +29 -0
  21. package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/string.js +37 -0
  22. package/dist/node_modules/.pnpm/@internationalized_date@3.12.3/node_modules/@internationalized/date/dist/private/utils.js +6 -0
  23. package/dist/packages/iryx-ui/src/component-names.js +1 -1
  24. package/dist/packages/iryx-ui/src/components/DatePicker.js +5 -0
  25. package/dist/packages/iryx-ui/src/components/DatePicker.vue_vue_type_script_setup_true_lang.js +186 -0
  26. package/dist/packages/iryx-ui/src/components/DateRangePicker.js +5 -0
  27. package/dist/packages/iryx-ui/src/components/DateRangePicker.vue_vue_type_script_setup_true_lang.js +210 -0
  28. package/dist/packages/iryx-ui/src/components/FileUpload.js +5 -0
  29. package/dist/packages/iryx-ui/src/components/FileUpload.vue_vue_type_script_setup_true_lang.js +209 -0
  30. package/dist/packages/iryx-ui/src/components/Input.vue_vue_type_script_setup_true_lang.js +94 -25
  31. package/dist/packages/iryx-ui/src/components/PasswordInput.js +5 -0
  32. package/dist/packages/iryx-ui/src/components/PasswordInput.vue_vue_type_script_setup_true_lang.js +113 -0
  33. package/dist/packages/iryx-ui/src/components/Textarea.vue_vue_type_script_setup_true_lang.js +47 -21
  34. package/dist/packages/iryx-ui/src/components/index.js +52 -44
  35. package/dist/packages/iryx-ui/src/composables/date.js +25 -0
  36. package/dist/packages/iryx-ui/src/theme/date-picker.js +45 -0
  37. package/dist/packages/iryx-ui/src/theme/file-upload.js +29 -0
  38. package/dist/packages/iryx-ui/src/theme/input.js +22 -6
  39. package/dist/packages/iryx-ui/src/theme/password-input.js +23 -0
  40. package/dist/theme/date-picker.d.ts +254 -0
  41. package/dist/theme/file-upload.d.ts +143 -0
  42. package/dist/theme/form.d.ts +3 -3
  43. package/dist/theme/index.d.ts +3 -0
  44. package/dist/theme/input.d.ts +94 -15
  45. package/dist/theme/password-input.d.ts +97 -0
  46. package/package.json +2 -1
@@ -0,0 +1,210 @@
1
+ import { ArrowLeft01Icon as e, ArrowRight01Icon as t, Calendar03Icon as n } from "../../../../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
2
+ import { useIryxUiConfig as r } from "../config.js";
3
+ import i from "./Icon.js";
4
+ import { useFormField as a } from "../composables/form.js";
5
+ import { formatIsoDate as o, toCalendarDate as s, toIsoDate as c } from "../composables/date.js";
6
+ import { datePickerTheme as ee } from "../theme/date-picker.js";
7
+ import { Fragment as l, computed as u, createBlock as d, createCommentVNode as te, createElementBlock as f, createElementVNode as p, createTextVNode as m, createVNode as h, defineComponent as g, mergeModels as _, normalizeClass as v, openBlock as y, ref as b, renderList as x, shallowRef as S, toDisplayString as C, unref as w, useModel as ne, watch as T, withCtx as E } from "vue";
8
+ import { PopoverContent as D, PopoverPortal as O, PopoverRoot as k, PopoverTrigger as A, RangeCalendarCell as re, RangeCalendarCellTrigger as j, RangeCalendarGrid as M, RangeCalendarGridBody as N, RangeCalendarGridHead as P, RangeCalendarGridRow as F, RangeCalendarHeadCell as I, RangeCalendarHeader as L, RangeCalendarHeading as R, RangeCalendarNext as z, RangeCalendarPrev as B, RangeCalendarRoot as V } from "reka-ui";
9
+ //#region src/components/DateRangePicker.vue?vue&type=script&setup=true&lang.ts
10
+ var H = [
11
+ "id",
12
+ "disabled",
13
+ "aria-invalid",
14
+ "aria-describedby"
15
+ ], U = { key: 0 }, W = /*@__PURE__*/ g({
16
+ __name: "DateRangePicker",
17
+ props: /*@__PURE__*/ _({
18
+ size: {},
19
+ placeholder: { default: "Pick a date range" },
20
+ disabled: { type: Boolean },
21
+ invalid: {
22
+ type: Boolean,
23
+ default: void 0
24
+ },
25
+ id: {},
26
+ min: {},
27
+ max: {},
28
+ locale: {},
29
+ format: {},
30
+ weekStartsOn: {},
31
+ months: { default: 2 },
32
+ clearable: { type: Boolean },
33
+ separator: { default: " – " },
34
+ clearLabel: { default: "Clear" },
35
+ previousLabel: { default: "Previous month" },
36
+ nextLabel: { default: "Next month" },
37
+ unstyled: {
38
+ type: Boolean,
39
+ default: void 0
40
+ },
41
+ class: {},
42
+ ui: {}
43
+ }, {
44
+ modelValue: { default: () => ({
45
+ start: null,
46
+ end: null
47
+ }) },
48
+ modelModifiers: {}
49
+ }),
50
+ emits: ["update:modelValue"],
51
+ setup(g) {
52
+ let _ = g, W = ne(g, "modelValue"), G = b(!1), K = a(), q = u(() => _.id ?? K?.id.value), J = u(() => _.invalid ?? K?.invalid.value ?? !1), Y = r(), ie = u(() => _.unstyled ?? Y.unstyled), X = S({
53
+ start: s(W.value?.start),
54
+ end: s(W.value?.end)
55
+ });
56
+ function Z(e) {
57
+ return c(e.start) === (W.value?.start ?? null) && c(e.end) === (W.value?.end ?? null);
58
+ }
59
+ T(W, () => {
60
+ Z(X.value) || (X.value = {
61
+ start: s(W.value?.start),
62
+ end: s(W.value?.end)
63
+ });
64
+ }, { deep: !0 }), T(X, (e) => {
65
+ Z(e) || (W.value = {
66
+ start: c(e.start),
67
+ end: c(e.end)
68
+ });
69
+ });
70
+ let ae = u(() => s(_.min)), oe = u(() => s(_.max)), Q = u(() => {
71
+ let e = o(W.value?.start, _.locale, _.format), t = o(W.value?.end, _.locale, _.format);
72
+ return !e && !t ? "" : t ? `${e}${_.separator}${t}` : e;
73
+ });
74
+ T(W, (e) => {
75
+ G.value && e?.start && e?.end && (G.value = !1);
76
+ }, { deep: !0 });
77
+ function se() {
78
+ W.value = {
79
+ start: null,
80
+ end: null
81
+ }, G.value = !1;
82
+ }
83
+ let ce = u(() => ee({
84
+ size: _.size,
85
+ invalid: J.value,
86
+ range: !0
87
+ }));
88
+ function $(e, t) {
89
+ let n = _.ui?.[e];
90
+ return ie.value ? [n, t] : ce.value[e]({ class: [n, t] });
91
+ }
92
+ return (r, a) => (y(), d(w(k), {
93
+ open: G.value,
94
+ "onUpdate:open": a[1] ||= (e) => G.value = e
95
+ }, {
96
+ default: E(() => [h(w(A), { "as-child": "" }, {
97
+ default: E(() => [p("button", {
98
+ id: q.value,
99
+ type: "button",
100
+ disabled: _.disabled,
101
+ "aria-invalid": J.value || void 0,
102
+ "aria-describedby": w(K)?.describedBy.value,
103
+ class: v($("trigger", _.class))
104
+ }, [Q.value ? (y(), f("span", U, C(Q.value), 1)) : (y(), f("span", {
105
+ key: 1,
106
+ class: v($("placeholder"))
107
+ }, C(_.placeholder), 3)), h(i, { icon: w(n) }, null, 8, ["icon"])], 10, H)]),
108
+ _: 1
109
+ }), h(w(O), null, {
110
+ default: E(() => [h(w(D), {
111
+ class: v($("content")),
112
+ "side-offset": 4,
113
+ align: "start"
114
+ }, {
115
+ default: E(() => [h(w(V), {
116
+ modelValue: X.value,
117
+ "onUpdate:modelValue": a[0] ||= (e) => X.value = e,
118
+ "min-value": ae.value,
119
+ "max-value": oe.value,
120
+ locale: _.locale,
121
+ "week-starts-on": _.weekStartsOn,
122
+ "number-of-months": _.months,
123
+ "fixed-weeks": "",
124
+ "initial-focus": ""
125
+ }, {
126
+ default: E(({ grid: n, weekDays: r }) => [h(w(L), { class: v($("header")) }, {
127
+ default: E(() => [
128
+ h(w(B), {
129
+ "aria-label": _.previousLabel,
130
+ class: v($("nav"))
131
+ }, {
132
+ default: E(() => [h(i, { icon: w(e) }, null, 8, ["icon"])]),
133
+ _: 1
134
+ }, 8, ["aria-label", "class"]),
135
+ h(w(R), { class: v($("heading")) }, null, 8, ["class"]),
136
+ h(w(z), {
137
+ "aria-label": _.nextLabel,
138
+ class: v($("nav"))
139
+ }, {
140
+ default: E(() => [h(i, { icon: w(t) }, null, 8, ["icon"])]),
141
+ _: 1
142
+ }, 8, ["aria-label", "class"])
143
+ ]),
144
+ _: 1
145
+ }, 8, ["class"]), p("div", { class: v($("months")) }, [(y(!0), f(l, null, x(n, (e) => (y(), d(w(M), {
146
+ key: e.value.toString(),
147
+ class: v($("grid"))
148
+ }, {
149
+ default: E(() => [h(w(P), null, {
150
+ default: E(() => [h(w(F), null, {
151
+ default: E(() => [(y(!0), f(l, null, x(r, (e) => (y(), d(w(I), {
152
+ key: e,
153
+ class: v($("headCell"))
154
+ }, {
155
+ default: E(() => [m(C(e), 1)]),
156
+ _: 2
157
+ }, 1032, ["class"]))), 128))]),
158
+ _: 2
159
+ }, 1024)]),
160
+ _: 2
161
+ }, 1024), h(w(N), null, {
162
+ default: E(() => [(y(!0), f(l, null, x(e.rows, (t, n) => (y(), d(w(F), { key: `week-${n}` }, {
163
+ default: E(() => [(y(!0), f(l, null, x(t, (t) => (y(), d(w(re), {
164
+ key: t.toString(),
165
+ date: t,
166
+ class: v($("cell"))
167
+ }, {
168
+ default: E(() => [h(w(j), {
169
+ day: t,
170
+ month: e.value,
171
+ class: v($("cellTrigger"))
172
+ }, null, 8, [
173
+ "day",
174
+ "month",
175
+ "class"
176
+ ])]),
177
+ _: 2
178
+ }, 1032, ["date", "class"]))), 128))]),
179
+ _: 2
180
+ }, 1024))), 128))]),
181
+ _: 2
182
+ }, 1024)]),
183
+ _: 2
184
+ }, 1032, ["class"]))), 128))], 2)]),
185
+ _: 1
186
+ }, 8, [
187
+ "modelValue",
188
+ "min-value",
189
+ "max-value",
190
+ "locale",
191
+ "week-starts-on",
192
+ "number-of-months"
193
+ ]), _.clearable ? (y(), f("div", {
194
+ key: 0,
195
+ class: v($("footer"))
196
+ }, [p("button", {
197
+ type: "button",
198
+ class: v($("action")),
199
+ onClick: se
200
+ }, C(_.clearLabel), 3)], 2)) : te("", !0)]),
201
+ _: 1
202
+ }, 8, ["class"])]),
203
+ _: 1
204
+ })]),
205
+ _: 1
206
+ }, 8, ["open"]));
207
+ }
208
+ });
209
+ //#endregion
210
+ export { W as default };
@@ -0,0 +1,5 @@
1
+ import e from "./FileUpload.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/FileUpload.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -0,0 +1,209 @@
1
+ import { Delete02Icon as e, File01Icon as t, Upload05Icon as n } from "../../../../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
2
+ import { useIryxUiConfig as r } from "../config.js";
3
+ import i from "./Icon.js";
4
+ import a from "./Button.js";
5
+ import { useFormField as o } from "../composables/form.js";
6
+ import { fileUploadTheme as s } from "../theme/file-upload.js";
7
+ import { Fragment as c, computed as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, mergeModels as g, normalizeClass as _, onBeforeUnmount as v, openBlock as y, ref as b, renderList as x, toDisplayString as S, unref as C, useModel as w, watch as T, withCtx as E, withModifiers as D } from "vue";
8
+ //#region src/components/FileUpload.vue?vue&type=script&setup=true&lang.ts
9
+ var O = [
10
+ "id",
11
+ "multiple",
12
+ "accept",
13
+ "disabled",
14
+ "aria-invalid",
15
+ "aria-describedby"
16
+ ], k = ["src"], A = [
17
+ "aria-label",
18
+ "disabled",
19
+ "onClick"
20
+ ], j = /*@__PURE__*/ h({
21
+ __name: "FileUpload",
22
+ props: /*@__PURE__*/ g({
23
+ multiple: { type: Boolean },
24
+ accept: {},
25
+ maxSize: {},
26
+ maxFiles: {},
27
+ disabled: { type: Boolean },
28
+ invalid: {
29
+ type: Boolean,
30
+ default: void 0
31
+ },
32
+ id: {},
33
+ label: { default: "Drag and drop a file here" },
34
+ hint: {},
35
+ browseLabel: { default: "Browse files" },
36
+ removeLabel: { default: "Remove" },
37
+ tooLargeText: { default: "is too large" },
38
+ wrongTypeText: { default: "is not an accepted type" },
39
+ tooManyText: { default: "exceeds the file limit" },
40
+ unstyled: {
41
+ type: Boolean,
42
+ default: void 0
43
+ },
44
+ class: {},
45
+ ui: {}
46
+ }, {
47
+ modelValue: { default: () => [] },
48
+ modelModifiers: {}
49
+ }),
50
+ emits: /*@__PURE__*/ g(["reject"], ["update:modelValue"]),
51
+ setup(h, { emit: g }) {
52
+ let j = h, ee = g, M = w(h, "modelValue"), N = o(), P = l(() => j.id ?? N?.id.value), F = l(() => j.invalid ?? N?.invalid.value ?? !1), I = r(), L = l(() => j.unstyled ?? I.unstyled), R = b([]);
53
+ function z(e) {
54
+ if (!j.accept) return !0;
55
+ let t = e.name.toLowerCase(), n = e.type.toLowerCase();
56
+ return j.accept.split(",").map((e) => e.trim().toLowerCase()).filter(Boolean).some((e) => e.startsWith(".") ? t.endsWith(e) : e.endsWith("/*") ? n.startsWith(e.slice(0, -1)) : n === e);
57
+ }
58
+ function B(e) {
59
+ let t = [], n = [], r = j.multiple ? M.value : [];
60
+ for (let i of e) {
61
+ if (!z(i)) {
62
+ n.push({
63
+ file: i,
64
+ reason: "type"
65
+ });
66
+ continue;
67
+ }
68
+ if (j.maxSize != null && i.size > j.maxSize) {
69
+ n.push({
70
+ file: i,
71
+ reason: "size"
72
+ });
73
+ continue;
74
+ }
75
+ let e = j.multiple ? j.maxFiles : 1;
76
+ if (e != null && r.length + t.length >= e) {
77
+ n.push({
78
+ file: i,
79
+ reason: "count"
80
+ });
81
+ continue;
82
+ }
83
+ t.push(i);
84
+ }
85
+ R.value = n, n.length && ee("reject", n), t.length && (M.value = [...r, ...t]);
86
+ }
87
+ let V = b();
88
+ function H(e) {
89
+ let t = e.target;
90
+ B([...t.files ?? []]), t.value = "";
91
+ }
92
+ function U(e) {
93
+ M.value = M.value.filter((t, n) => n !== e);
94
+ }
95
+ let W = b(0), G = l(() => W.value > 0);
96
+ function K() {
97
+ j.disabled || W.value++;
98
+ }
99
+ function q() {
100
+ W.value > 0 && W.value--;
101
+ }
102
+ function J(e) {
103
+ W.value = 0, !j.disabled && B([...e.dataTransfer?.files ?? []]);
104
+ }
105
+ let Y = b(/* @__PURE__ */ new Map());
106
+ T(M, (e) => {
107
+ for (let [t, n] of Y.value) e.includes(t) || (URL.revokeObjectURL(n), Y.value.delete(t));
108
+ for (let t of e) t.type.startsWith("image/") && !Y.value.has(t) && Y.value.set(t, URL.createObjectURL(t));
109
+ }, {
110
+ immediate: !0,
111
+ deep: !0
112
+ }), v(() => {
113
+ for (let e of Y.value.values()) URL.revokeObjectURL(e);
114
+ });
115
+ function X(e) {
116
+ let t = [
117
+ "B",
118
+ "kB",
119
+ "MB",
120
+ "GB"
121
+ ], n = e, r = 0;
122
+ for (; n >= 1024 && r < t.length - 1;) n /= 1024, r++;
123
+ return `${r === 0 ? n : Math.round(n * 10) / 10} ${t[r]}`;
124
+ }
125
+ function Z(e) {
126
+ let t = e.reason === "size" ? j.tooLargeText : e.reason === "type" ? j.wrongTypeText : j.tooManyText;
127
+ return `${e.file.name} ${t}`;
128
+ }
129
+ let Q = l(() => s({
130
+ dragging: G.value,
131
+ invalid: F.value,
132
+ disabled: j.disabled
133
+ }));
134
+ function $(e, t) {
135
+ let n = j.ui?.[e];
136
+ return L.value ? [n, t] : Q.value[e]({ class: [n, t] });
137
+ }
138
+ let te = l(() => L.value ? j.ui?.browse : Q.value.browse({ class: j.ui?.browse }));
139
+ return (r, o) => (y(), d("div", { class: _($("root", j.class)) }, [
140
+ f("label", {
141
+ class: _($("dropzone")),
142
+ onDragenter: D(K, ["prevent"]),
143
+ onDragover: o[0] ||= D(() => {}, ["prevent"]),
144
+ onDragleave: D(q, ["prevent"]),
145
+ onDrop: D(J, ["prevent"])
146
+ }, [
147
+ f("input", {
148
+ id: P.value,
149
+ ref_key: "inputEl",
150
+ ref: V,
151
+ type: "file",
152
+ multiple: j.multiple,
153
+ accept: j.accept,
154
+ disabled: j.disabled,
155
+ "aria-invalid": F.value || void 0,
156
+ "aria-describedby": C(N)?.describedBy.value,
157
+ class: _($("input")),
158
+ onChange: H
159
+ }, null, 42, O),
160
+ f("span", { class: _($("icon")) }, [m(i, { icon: C(n) }, null, 8, ["icon"])], 2),
161
+ f("span", { class: _($("label")) }, S(j.label), 3),
162
+ j.hint ? (y(), d("span", {
163
+ key: 0,
164
+ class: _($("hint"))
165
+ }, S(j.hint), 3)) : u("", !0),
166
+ m(a, {
167
+ as: "span",
168
+ variant: "outline",
169
+ size: "sm",
170
+ class: _(te.value)
171
+ }, {
172
+ default: E(() => [p(S(j.browseLabel), 1)]),
173
+ _: 1
174
+ }, 8, ["class"])
175
+ ], 34),
176
+ (y(!0), d(c, null, x(R.value, (e) => (y(), d("p", {
177
+ key: e.file.name,
178
+ class: _($("error"))
179
+ }, S(Z(e)), 3))), 128)),
180
+ M.value.length ? (y(), d("ul", {
181
+ key: 0,
182
+ class: _($("list"))
183
+ }, [(y(!0), d(c, null, x(M.value, (n, r) => (y(), d("li", {
184
+ key: `${n.name}-${r}`,
185
+ class: _($("item"))
186
+ }, [
187
+ Y.value.get(n) ? (y(), d("img", {
188
+ key: 0,
189
+ src: Y.value.get(n),
190
+ alt: "",
191
+ class: _($("thumbnail"))
192
+ }, null, 10, k)) : (y(), d("span", {
193
+ key: 1,
194
+ class: _($("placeholder"))
195
+ }, [m(i, { icon: C(t) }, null, 8, ["icon"])], 2)),
196
+ f("span", { class: _($("details")) }, [f("span", { class: _($("name")) }, S(n.name), 3), f("span", { class: _($("meta")) }, S(X(n.size)), 3)], 2),
197
+ f("button", {
198
+ type: "button",
199
+ "aria-label": `${j.removeLabel} ${n.name}`,
200
+ disabled: j.disabled,
201
+ class: _($("remove")),
202
+ onClick: (e) => U(r)
203
+ }, [m(i, { icon: C(e) }, null, 8, ["icon"])], 10, A)
204
+ ], 2))), 128))], 2)) : u("", !0)
205
+ ], 2));
206
+ }
207
+ });
208
+ //#endregion
209
+ export { j as default };
@@ -1,19 +1,23 @@
1
- import { useIryxUiConfig as e } from "../config.js";
2
- import { useFormField as t } from "../composables/form.js";
3
- import { inputTheme as n } from "../theme/input.js";
4
- import { computed as r, createElementBlock as i, defineComponent as a, mergeModels as o, normalizeClass as s, openBlock as c, unref as l, useModel as u, vModelDynamic as d, withDirectives as f } from "vue";
1
+ import { Cancel01Icon as e, Loading03Icon as t } from "../../../../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
2
+ import { useIryxUiConfig as n } from "../config.js";
3
+ import r from "./Icon.js";
4
+ import { useFormField as i } from "../composables/form.js";
5
+ import { inputTheme as a } from "../theme/input.js";
6
+ import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createVNode as d, defineComponent as f, mergeModels as p, mergeProps as m, normalizeClass as h, onBeforeUnmount as g, openBlock as _, ref as v, renderSlot as y, unref as b, useModel as x, useSlots as S, watch as C, withKeys as w } from "vue";
5
7
  //#region src/components/Input.vue?vue&type=script&setup=true&lang.ts
6
- var p = [
8
+ var T = [
7
9
  "id",
10
+ "value",
8
11
  "type",
9
12
  "placeholder",
10
13
  "disabled",
11
14
  "required",
12
15
  "aria-invalid",
13
16
  "aria-describedby"
14
- ], m = /*@__PURE__*/ a({
17
+ ], E = ["aria-label"], D = /*@__PURE__*/ f({
18
+ inheritAttrs: !1,
15
19
  __name: "Input",
16
- props: /*@__PURE__*/ o({
20
+ props: /*@__PURE__*/ p({
17
21
  type: { default: "text" },
18
22
  size: {},
19
23
  placeholder: {},
@@ -24,34 +28,99 @@ var p = [
24
28
  default: void 0
25
29
  },
26
30
  id: {},
31
+ clearable: { type: Boolean },
32
+ loading: { type: Boolean },
33
+ debounce: { default: 0 },
34
+ clearLabel: { default: "Clear" },
27
35
  unstyled: {
28
36
  type: Boolean,
29
37
  default: void 0
30
38
  },
31
- class: {}
39
+ class: {},
40
+ ui: {}
32
41
  }, {
33
42
  modelValue: {},
34
43
  modelModifiers: {}
35
44
  }),
36
45
  emits: ["update:modelValue"],
37
- setup(a) {
38
- let o = a, m = u(a, "modelValue"), h = t(), g = r(() => o.id ?? h?.id.value), _ = r(() => o.invalid ?? h?.invalid.value ?? !1), v = e(), y = r(() => o.unstyled ?? v.unstyled), b = r(() => y.value ? o.class : n({
39
- size: o.size,
40
- invalid: _.value,
41
- class: o.class
46
+ setup(f, { expose: p }) {
47
+ let D = f, O = x(f, "modelValue"), k = S(), A = i(), j = o(() => D.id ?? A?.id.value), M = o(() => D.invalid ?? A?.invalid.value ?? !1), N = n(), P = o(() => D.unstyled ?? N.unstyled), F = v(O.value), I;
48
+ function L() {
49
+ I !== void 0 && (clearTimeout(I), I = void 0);
50
+ }
51
+ C(O, (e) => {
52
+ L(), F.value = e;
53
+ });
54
+ function R(e) {
55
+ let t = e.target.value;
56
+ if (F.value = t, L(), !D.debounce) {
57
+ O.value = t;
58
+ return;
59
+ }
60
+ I = setTimeout(() => {
61
+ I = void 0, O.value = t;
62
+ }, D.debounce);
63
+ }
64
+ function z() {
65
+ I !== void 0 && (L(), O.value = F.value);
66
+ }
67
+ g(L);
68
+ let B = v();
69
+ function V() {
70
+ L(), F.value = "", O.value = "", B.value?.focus();
71
+ }
72
+ p({ input: B });
73
+ let H = o(() => F.value !== "" && F.value != null), U = o(() => D.clearable && H.value && !D.disabled), W = o(() => D.loading || U.value || !!k.trailing), G = o(() => a({
74
+ size: D.size,
75
+ invalid: M.value
42
76
  }));
43
- return (e, t) => f((c(), i("input", {
44
- id: g.value,
45
- "onUpdate:modelValue": t[0] ||= (e) => m.value = e,
46
- type: o.type,
47
- placeholder: o.placeholder,
48
- disabled: o.disabled,
49
- required: o.required,
50
- "aria-invalid": _.value || void 0,
51
- "aria-describedby": l(h)?.describedBy.value,
52
- class: s(b.value)
53
- }, null, 10, p)), [[d, m.value]]);
77
+ function K(e, t) {
78
+ let n = D.ui?.[e];
79
+ return P.value ? [n, t] : G.value[e]({ class: [n, t] });
80
+ }
81
+ return (n, i) => (_(), l("div", { class: h(K("root", D.class)) }, [
82
+ b(k).leading ? (_(), l("span", {
83
+ key: 0,
84
+ class: h(K("leading"))
85
+ }, [y(n.$slots, "leading")], 2)) : c("", !0),
86
+ u("input", m({
87
+ id: j.value,
88
+ ref_key: "inputEl",
89
+ ref: B,
90
+ value: F.value,
91
+ type: D.type,
92
+ placeholder: D.placeholder,
93
+ disabled: D.disabled,
94
+ required: D.required,
95
+ "aria-invalid": M.value || void 0,
96
+ "aria-describedby": b(A)?.describedBy.value,
97
+ class: K("input")
98
+ }, n.$attrs, {
99
+ onInput: R,
100
+ onBlur: z,
101
+ onKeydown: w(z, ["enter"])
102
+ }), null, 16, T),
103
+ W.value ? (_(), l("span", {
104
+ key: 1,
105
+ class: h(K("trailing"))
106
+ }, [
107
+ y(n.$slots, "trailing"),
108
+ U.value ? (_(), l("button", {
109
+ key: 0,
110
+ type: "button",
111
+ tabindex: "-1",
112
+ "aria-label": D.clearLabel,
113
+ class: h(K("clear")),
114
+ onClick: V
115
+ }, [d(r, { icon: b(e) }, null, 8, ["icon"])], 10, E)) : c("", !0),
116
+ D.loading ? (_(), s(r, {
117
+ key: 1,
118
+ icon: b(t),
119
+ class: "animate-spin"
120
+ }, null, 8, ["icon"])) : c("", !0)
121
+ ], 2)) : c("", !0)
122
+ ], 2));
54
123
  }
55
124
  });
56
125
  //#endregion
57
- export { m as default };
126
+ export { D as default };
@@ -0,0 +1,5 @@
1
+ import e from "./PasswordInput.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/PasswordInput.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -0,0 +1,113 @@
1
+ import { ViewIcon as e, ViewOffIcon as t } from "../../../../node_modules/.pnpm/@hugeicons_core-free-icons@4.2.3/node_modules/@hugeicons/core-free-icons/dist/esm/index.js";
2
+ import { useIryxUiConfig as n } from "../config.js";
3
+ import r from "./Icon.js";
4
+ import i from "./Input.js";
5
+ import { passwordInputTheme as a } from "../theme/password-input.js";
6
+ import { Fragment as o, computed as s, createCommentVNode as c, createElementBlock as l, createElementVNode as u, createSlots as d, createVNode as f, defineComponent as p, mergeModels as m, mergeProps as h, normalizeClass as g, openBlock as _, ref as v, renderList as y, toDisplayString as b, unref as x, useModel as S, withCtx as C } from "vue";
7
+ //#region src/components/PasswordInput.vue?vue&type=script&setup=true&lang.ts
8
+ var w = [
9
+ "aria-label",
10
+ "aria-pressed",
11
+ "disabled"
12
+ ], T = ["data-filled"], E = /*@__PURE__*/ p({
13
+ inheritAttrs: !1,
14
+ __name: "PasswordInput",
15
+ props: /*@__PURE__*/ m({
16
+ size: {},
17
+ placeholder: {},
18
+ disabled: { type: Boolean },
19
+ required: { type: Boolean },
20
+ invalid: {
21
+ type: Boolean,
22
+ default: void 0
23
+ },
24
+ id: {},
25
+ toggle: {
26
+ type: Boolean,
27
+ default: !0
28
+ },
29
+ strength: { type: Boolean },
30
+ showLabel: { default: "Show password" },
31
+ hideLabel: { default: "Hide password" },
32
+ strengthLabels: { default: () => [
33
+ "Weak",
34
+ "Fair",
35
+ "Good",
36
+ "Strong"
37
+ ] },
38
+ unstyled: {
39
+ type: Boolean,
40
+ default: void 0
41
+ },
42
+ class: {},
43
+ ui: {}
44
+ }, {
45
+ modelValue: { default: "" },
46
+ modelModifiers: {}
47
+ }),
48
+ emits: ["update:modelValue"],
49
+ setup(p) {
50
+ let m = p, E = S(p, "modelValue"), D = n(), O = s(() => m.unstyled ?? D.unstyled), k = v(!1), A = s(() => {
51
+ let e = E.value;
52
+ if (!e) return 0;
53
+ let t = 0;
54
+ return e.length >= 8 && t++, e.length >= 12 && t++, /[a-z]/.test(e) && /[A-Z]/.test(e) && t++, /\d/.test(e) && t++, /[^\w\s]/.test(e) && t++, Math.max(1, Math.min(t, 4));
55
+ }), j = s(() => m.strength && E.value.length > 0), M = s(() => a({ score: A.value })), N = s(() => O.value ? m.ui?.input : M.value.input({ class: m.ui?.input }));
56
+ function P(e, t) {
57
+ let n = m.ui?.[e];
58
+ return O.value ? [n, t] : M.value[e]({ class: [n, t] });
59
+ }
60
+ return (n, a) => (_(), l("div", { class: g(P("root", m.class)) }, [f(i, h({
61
+ id: m.id,
62
+ modelValue: E.value,
63
+ "onUpdate:modelValue": a[1] ||= (e) => E.value = e,
64
+ type: k.value ? "text" : "password",
65
+ size: m.size,
66
+ placeholder: m.placeholder,
67
+ disabled: m.disabled,
68
+ required: m.required,
69
+ invalid: m.invalid,
70
+ unstyled: m.unstyled,
71
+ ui: { input: N.value },
72
+ autocomplete: "current-password"
73
+ }, n.$attrs), d({ _: 2 }, [m.toggle ? {
74
+ name: "trailing",
75
+ fn: C(() => [u("button", {
76
+ type: "button",
77
+ tabindex: "-1",
78
+ "aria-label": k.value ? m.hideLabel : m.showLabel,
79
+ "aria-pressed": k.value,
80
+ disabled: m.disabled,
81
+ class: g(P("toggle")),
82
+ onClick: a[0] ||= (e) => k.value = !k.value
83
+ }, [f(r, { icon: k.value ? x(t) : x(e) }, null, 8, ["icon"])], 10, w)]),
84
+ key: "0"
85
+ } : void 0]), 1040, [
86
+ "id",
87
+ "modelValue",
88
+ "type",
89
+ "size",
90
+ "placeholder",
91
+ "disabled",
92
+ "required",
93
+ "invalid",
94
+ "unstyled",
95
+ "ui"
96
+ ]), j.value ? (_(), l("div", {
97
+ key: 0,
98
+ class: g(P("meter"))
99
+ }, [u("div", {
100
+ class: g(P("track")),
101
+ "aria-hidden": "true"
102
+ }, [(_(), l(o, null, y(4, (e) => u("span", {
103
+ key: e,
104
+ "data-filled": e <= A.value ? "" : void 0,
105
+ class: g(P("segment"))
106
+ }, null, 10, T)), 64))], 2), u("span", {
107
+ class: g(P("label")),
108
+ role: "status"
109
+ }, b(m.strengthLabels[A.value - 1]), 3)], 2)) : c("", !0)], 2));
110
+ }
111
+ });
112
+ //#endregion
113
+ export { E as default };