iryx-ui 0.18.2 → 0.18.3

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.
@@ -7,6 +7,8 @@ export interface CheckboxProps extends CheckboxRootProps {
7
7
  description?: string;
8
8
  size?: 'sm' | 'md' | 'lg';
9
9
  id?: string;
10
+ /** Mark as failing validation. Taken from the enclosing `IFormField` when omitted. */
11
+ invalid?: boolean;
10
12
  /** Skip built-in classes; you take over styling entirely. */
11
13
  unstyled?: boolean;
12
14
  class?: ClassValue;
@@ -36,6 +38,7 @@ declare const __VLS_base: import("vue").DefineComponent<CheckboxProps, {}, {}, {
36
38
  "onUpdate:modelValue"?: ((value: boolean | "indeterminate") => any) | undefined;
37
39
  }>, {
38
40
  unstyled: boolean;
41
+ invalid: boolean;
39
42
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
40
43
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
41
44
  declare const _default: typeof __VLS_export;
@@ -1,11 +1,12 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
2
  import t from "./Icon.js";
3
- import { checkboxTheme as n } from "../theme/checkbox.js";
4
- import { computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, mergeProps as d, normalizeClass as f, openBlock as p, renderSlot as m, toDisplayString as h, unref as g, withCtx as _ } from "vue";
5
- import { MinusSignIcon as v, Tick02Icon as y } from "@hugeicons/core-free-icons";
6
- import { CheckboxIndicator as b, CheckboxRoot as x, Label as S, useForwardPropsEmits as C, useId as w } from "reka-ui";
3
+ import { useFormField as n } from "../composables/form.js";
4
+ import { checkboxTheme as r } from "../theme/checkbox.js";
5
+ import { computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeProps as f, normalizeClass as p, openBlock as m, renderSlot as h, toDisplayString as g, unref as _, withCtx as v } from "vue";
6
+ import { MinusSignIcon as y, Tick02Icon as b } from "@hugeicons/core-free-icons";
7
+ import { CheckboxIndicator as x, CheckboxRoot as S, Label as C, useForwardPropsEmits as w, useId as T } from "reka-ui";
7
8
  //#region src/components/Checkbox.vue?vue&type=script&setup=true&lang.ts
8
- var T = ["id"], E = /*@__PURE__*/ u({
9
+ var E = ["id"], D = /*@__PURE__*/ d({
9
10
  inheritAttrs: !1,
10
11
  __name: "Checkbox",
11
12
  props: {
@@ -13,6 +14,10 @@ var T = ["id"], E = /*@__PURE__*/ u({
13
14
  description: {},
14
15
  size: {},
15
16
  id: {},
17
+ invalid: {
18
+ type: Boolean,
19
+ default: void 0
20
+ },
16
21
  unstyled: {
17
22
  type: Boolean,
18
23
  default: void 0
@@ -36,69 +41,81 @@ var T = ["id"], E = /*@__PURE__*/ u({
36
41
  required: { type: Boolean }
37
42
  },
38
43
  emits: ["update:modelValue"],
39
- setup(u, { emit: E }) {
40
- let D = u, O = E, k = C(r(() => {
41
- let { label: e, description: t, size: n, id: r, unstyled: i, class: a, ui: o, ...s } = D;
42
- return s;
43
- }), O), A = w(), j = r(() => D.id ?? A), M = r(() => !!(D.label || D.description)), N = e(), P = r(() => D.unstyled ?? N.unstyled), F = r(() => n({
44
- size: D.size,
45
- withText: M.value
46
- })), I = r(() => P.value ? D.ui?.wrapper : F.value.wrapper({ class: D.ui?.wrapper })), L = r(() => P.value ? [D.ui?.root, D.class] : F.value.root({ class: [D.ui?.root, D.class] })), R = r(() => P.value ? D.ui?.indicator : F.value.indicator({ class: D.ui?.indicator })), z = r(() => P.value ? D.ui?.content : F.value.content({ class: D.ui?.content })), B = r(() => P.value ? D.ui?.label : F.value.label({ class: D.ui?.label })), V = r(() => P.value ? D.ui?.description : F.value.description({ class: D.ui?.description }));
47
- return (e, n) => M.value ? (p(), o("div", {
44
+ setup(d, { emit: D }) {
45
+ let O = d, k = D, A = w(i(() => {
46
+ let { label: e, description: t, size: n, id: r, invalid: i, unstyled: a, class: o, ui: s, ...c } = O;
47
+ return c;
48
+ }), k), j = T(), M = n(), N = i(() => O.invalid ?? M?.invalid.value ?? !1), P = i(() => O.id ?? M?.id.value ?? j);
49
+ M && (M.id.value = P.value);
50
+ let F = i(() => !!(O.label || O.description)), I = e(), L = i(() => O.unstyled ?? I.unstyled), R = i(() => r({
51
+ size: O.size,
52
+ withText: F.value,
53
+ invalid: N.value
54
+ })), z = i(() => L.value ? O.ui?.wrapper : R.value.wrapper({ class: O.ui?.wrapper })), B = i(() => L.value ? [O.ui?.root, O.class] : R.value.root({ class: [O.ui?.root, O.class] })), V = i(() => L.value ? O.ui?.indicator : R.value.indicator({ class: O.ui?.indicator })), H = i(() => L.value ? O.ui?.content : R.value.content({ class: O.ui?.content })), U = i(() => L.value ? O.ui?.label : R.value.label({ class: O.ui?.label })), W = i(() => L.value ? O.ui?.description : R.value.description({ class: O.ui?.description }));
55
+ return (e, n) => F.value ? (m(), s("div", {
48
56
  key: 0,
49
- class: f(I.value)
50
- }, [l(g(x), d({ id: j.value }, {
51
- ...g(k),
57
+ class: p(z.value)
58
+ }, [u(_(S), f({ id: P.value }, {
59
+ ..._(A),
52
60
  ...e.$attrs
53
61
  }, {
54
- "aria-describedby": D.description ? `${j.value}-description` : void 0,
55
- class: L.value
62
+ "aria-invalid": N.value || void 0,
63
+ "aria-describedby": O.description ? `${P.value}-description` : void 0,
64
+ class: B.value
56
65
  }), {
57
- default: _(() => [l(g(b), { class: f(R.value) }, {
58
- default: _(() => [m(e.$slots, "default", {}, () => [D.modelValue === "indeterminate" ? (p(), i(t, {
66
+ default: v(() => [u(_(x), { class: p(V.value) }, {
67
+ default: v(() => [h(e.$slots, "default", {}, () => [O.modelValue === "indeterminate" ? (m(), a(t, {
59
68
  key: 0,
60
- icon: g(v)
61
- }, null, 8, ["icon"])) : (p(), i(t, {
69
+ icon: _(y)
70
+ }, null, 8, ["icon"])) : (m(), a(t, {
62
71
  key: 1,
63
- icon: g(y)
72
+ icon: _(b)
64
73
  }, null, 8, ["icon"]))])]),
65
74
  _: 3
66
75
  }, 8, ["class"])]),
67
76
  _: 3
68
77
  }, 16, [
69
78
  "id",
79
+ "aria-invalid",
70
80
  "aria-describedby",
71
81
  "class"
72
- ]), s("div", { class: f(z.value) }, [l(g(S), {
73
- for: j.value,
74
- class: f(B.value)
82
+ ]), c("div", { class: p(H.value) }, [u(_(C), {
83
+ for: P.value,
84
+ class: p(U.value)
75
85
  }, {
76
- default: _(() => [m(e.$slots, "label", {}, () => [c(h(D.label), 1)])]),
86
+ default: v(() => [h(e.$slots, "label", {}, () => [l(g(O.label), 1)])]),
77
87
  _: 3
78
- }, 8, ["for", "class"]), D.description || e.$slots.description ? (p(), o("p", {
88
+ }, 8, ["for", "class"]), O.description || e.$slots.description ? (m(), s("p", {
79
89
  key: 0,
80
- id: `${j.value}-description`,
81
- class: f(V.value)
82
- }, [m(e.$slots, "description", {}, () => [c(h(D.description), 1)])], 10, T)) : a("", !0)], 2)], 2)) : (p(), i(g(x), d({
90
+ id: `${P.value}-description`,
91
+ class: p(W.value)
92
+ }, [h(e.$slots, "description", {}, () => [l(g(O.description), 1)])], 10, E)) : o("", !0)], 2)], 2)) : (m(), a(_(S), f({
83
93
  key: 1,
84
- id: D.id
94
+ id: P.value
85
95
  }, {
86
- ...g(k),
96
+ ..._(A),
87
97
  ...e.$attrs
88
- }, { class: L.value }), {
89
- default: _(() => [l(g(b), { class: f(R.value) }, {
90
- default: _(() => [m(e.$slots, "default", {}, () => [D.modelValue === "indeterminate" ? (p(), i(t, {
98
+ }, {
99
+ "aria-invalid": N.value || void 0,
100
+ class: B.value
101
+ }), {
102
+ default: v(() => [u(_(x), { class: p(V.value) }, {
103
+ default: v(() => [h(e.$slots, "default", {}, () => [O.modelValue === "indeterminate" ? (m(), a(t, {
91
104
  key: 0,
92
- icon: g(v)
93
- }, null, 8, ["icon"])) : (p(), i(t, {
105
+ icon: _(y)
106
+ }, null, 8, ["icon"])) : (m(), a(t, {
94
107
  key: 1,
95
- icon: g(y)
108
+ icon: _(b)
96
109
  }, null, 8, ["icon"]))])]),
97
110
  _: 3
98
111
  }, 8, ["class"])]),
99
112
  _: 3
100
- }, 16, ["id", "class"]));
113
+ }, 16, [
114
+ "id",
115
+ "aria-invalid",
116
+ "class"
117
+ ]));
101
118
  }
102
119
  });
103
120
  //#endregion
104
- export { E as default };
121
+ export { D as default };
@@ -79,7 +79,8 @@ var B = /*@__PURE__*/ h({
79
79
  default: O(() => [m(T(ne), null, {
80
80
  default: O(() => [m(T(te), { class: _($("overlay")) }, null, 8, ["class"]), m(T(ee), {
81
81
  class: _(Z.value ? [B.ui?.content, B.class] : Q.value.content({ class: [B.ui?.content, B.class] })),
82
- "aria-label": B.label
82
+ "aria-label": B.label,
83
+ "aria-describedby": void 0
83
84
  }, {
84
85
  default: O(() => [
85
86
  m(T(R), null, {
@@ -2,10 +2,10 @@ import { useIryxUiConfig as e } from "../config.js";
2
2
  import { formFieldContextKey as t, getByPath as n, useForm as r } from "../composables/form.js";
3
3
  import { formFieldTheme as i } from "../theme/form.js";
4
4
  import a from "./Label.js";
5
- import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createTextVNode as u, defineComponent as d, normalizeClass as f, openBlock as p, provide as m, renderSlot as h, toDisplayString as g, unref as _, watch as v, withCtx as y } from "vue";
6
- import { useId as b } from "reka-ui";
5
+ import { computed as o, createBlock as s, createCommentVNode as c, createElementBlock as l, createTextVNode as u, defineComponent as d, normalizeClass as f, openBlock as p, provide as m, ref as h, renderSlot as g, toDisplayString as _, unref as v, watch as y, withCtx as b } from "vue";
6
+ import { useId as x } from "reka-ui";
7
7
  //#region src/components/FormField.vue?vue&type=script&setup=true&lang.ts
8
- var x = ["data-iryx-field"], S = ["id"], C = ["id"], w = ["id"], T = /*@__PURE__*/ d({
8
+ var S = ["data-iryx-field"], C = ["id"], w = ["id"], T = ["id"], E = /*@__PURE__*/ d({
9
9
  __name: "FormField",
10
10
  props: {
11
11
  name: {},
@@ -28,73 +28,76 @@ var x = ["data-iryx-field"], S = ["id"], C = ["id"], w = ["id"], T = /*@__PURE__
28
28
  ui: {}
29
29
  },
30
30
  setup(d) {
31
- let T = d, E = r(), D = b(), O = o(() => T.error ?? E?.errorFor(T.name)), k = o(() => {
31
+ let E = d, D = r(), O = x(), k = h(O), A = o(() => E.error ?? D?.errorFor(E.name)), j = o(() => {
32
32
  let e = [];
33
- return T.description && e.push(`${D}-description`), O.value ? e.push(`${D}-error`) : T.help && e.push(`${D}-help`), e.length ? e.join(" ") : void 0;
33
+ return E.description && e.push(`${O}-description`), A.value ? e.push(`${O}-error`) : E.help && e.push(`${O}-help`), e.length ? e.join(" ") : void 0;
34
34
  });
35
- v(() => T.name && E ? n(E.state.value, T.name) : void 0, () => {
36
- if (!T.name || !E) return;
37
- let e = E.validateOn.value;
38
- (e.includes("change") || e.includes("input")) && E.validateField(T.name);
35
+ y(() => E.name && D ? n(D.state.value, E.name) : void 0, () => {
36
+ if (!E.name || !D) return;
37
+ let e = D.validateOn.value;
38
+ (e.includes("change") || e.includes("input")) && D.validateField(E.name);
39
39
  });
40
- function A() {
41
- !T.name || !E || E.validateOn.value.includes("blur") && E.validateField(T.name);
40
+ function M() {
41
+ !E.name || !D || D.validateOn.value.includes("blur") && D.validateField(E.name);
42
42
  }
43
- let j = e(), M = o(() => T.unstyled ?? j.unstyled), N = i();
44
- function P(e, t) {
45
- return M.value ? t : N[e]({ class: t });
43
+ let N = e(), P = o(() => E.unstyled ?? N.unstyled), F = i();
44
+ function I(e, t) {
45
+ return P.value ? t : F[e]({ class: t });
46
46
  }
47
47
  return m(t, {
48
- id: o(() => D),
49
- name: o(() => T.name),
50
- invalid: o(() => !!O.value),
51
- describedBy: k
48
+ id: k,
49
+ labelId: o(() => E.label ? `${O}-label` : void 0),
50
+ name: o(() => E.name),
51
+ invalid: o(() => !!A.value),
52
+ describedBy: j
52
53
  }), (e, t) => (p(), l("div", {
53
- "data-iryx-field": T.name,
54
- class: f(M.value ? T.class : _(N).root({ class: [T.ui?.root, T.class] })),
55
- onFocusout: A
54
+ "data-iryx-field": E.name,
55
+ class: f(P.value ? E.class : v(F).root({ class: [E.ui?.root, E.class] })),
56
+ onFocusout: M
56
57
  }, [
57
- T.label || T.hint || e.$slots.hint ? (p(), l("div", {
58
+ E.label || E.hint || e.$slots.hint ? (p(), l("div", {
58
59
  key: 0,
59
- class: f(P("header", T.ui?.header))
60
- }, [T.label ? (p(), s(a, {
60
+ class: f(I("header", E.ui?.header))
61
+ }, [E.label ? (p(), s(a, {
61
62
  key: 0,
62
- for: _(D),
63
- required: T.required,
64
- class: f(T.ui?.label)
63
+ id: `${v(O)}-label`,
64
+ for: k.value,
65
+ required: E.required,
66
+ class: f(E.ui?.label)
65
67
  }, {
66
- default: y(() => [u(g(T.label), 1)]),
68
+ default: b(() => [u(_(E.label), 1)]),
67
69
  _: 1
68
70
  }, 8, [
71
+ "id",
69
72
  "for",
70
73
  "required",
71
74
  "class"
72
- ])) : c("", !0), T.hint || e.$slots.hint ? (p(), l("span", {
75
+ ])) : c("", !0), E.hint || e.$slots.hint ? (p(), l("span", {
73
76
  key: 1,
74
- class: f(P("hint", T.ui?.hint))
75
- }, [h(e.$slots, "hint", {}, () => [u(g(T.hint), 1)])], 2)) : c("", !0)], 2)) : c("", !0),
76
- T.description ? (p(), l("p", {
77
+ class: f(I("hint", E.ui?.hint))
78
+ }, [g(e.$slots, "hint", {}, () => [u(_(E.hint), 1)])], 2)) : c("", !0)], 2)) : c("", !0),
79
+ E.description ? (p(), l("p", {
77
80
  key: 1,
78
- id: `${_(D)}-description`,
79
- class: f(P("description", T.ui?.description))
80
- }, g(T.description), 11, S)) : c("", !0),
81
- h(e.$slots, "default", {
82
- id: _(D),
83
- error: O.value
81
+ id: `${v(O)}-description`,
82
+ class: f(I("description", E.ui?.description))
83
+ }, _(E.description), 11, C)) : c("", !0),
84
+ g(e.$slots, "default", {
85
+ id: v(O),
86
+ error: A.value
84
87
  }),
85
- O.value ? (p(), l("p", {
88
+ A.value ? (p(), l("p", {
86
89
  key: 2,
87
- id: `${_(D)}-error`,
90
+ id: `${v(O)}-error`,
88
91
  role: "alert",
89
92
  "aria-live": "polite",
90
- class: f(P("error", T.ui?.error))
91
- }, g(O.value), 11, C)) : T.help ? (p(), l("p", {
93
+ class: f(I("error", E.ui?.error))
94
+ }, _(A.value), 11, w)) : E.help ? (p(), l("p", {
92
95
  key: 3,
93
- id: `${_(D)}-help`,
94
- class: f(P("help", T.ui?.help))
95
- }, g(T.help), 11, w)) : c("", !0)
96
- ], 42, x));
96
+ id: `${v(O)}-help`,
97
+ class: f(I("help", E.ui?.help))
98
+ }, _(E.help), 11, T)) : c("", !0)
99
+ ], 42, S));
97
100
  }
98
101
  });
99
102
  //#endregion
100
- export { T as default };
103
+ export { E as default };
@@ -1,7 +1,7 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
2
  import t from "./Icon.js";
3
- import { inputTheme as n } from "../theme/input.js";
4
- import { useFormField as r } from "../composables/form.js";
3
+ import { useFormField as n } from "../composables/form.js";
4
+ import { inputTheme as r } from "../theme/input.js";
5
5
  import { computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createVNode as l, defineComponent as u, mergeModels as d, mergeProps as f, normalizeClass as p, onBeforeUnmount as m, openBlock as h, ref as g, renderSlot as _, unref as v, useModel as y, useSlots as b, watch as x, withKeys as S } from "vue";
6
6
  import { Cancel01Icon as C, Loading03Icon as w } from "@hugeicons/core-free-icons";
7
7
  //#region src/components/Input.vue?vue&type=script&setup=true&lang.ts
@@ -55,7 +55,7 @@ var T = [
55
55
  "url",
56
56
  "tel",
57
57
  "password"
58
- ].includes(D.type) ? !1 : void 0), k = y(u, "modelValue"), A = b(), j = r(), M = i(() => D.id ?? j?.id.value), N = i(() => D.invalid ?? j?.invalid.value ?? !1), P = e(), F = i(() => D.unstyled ?? P.unstyled), I = g(k.value), L;
58
+ ].includes(D.type) ? !1 : void 0), k = y(u, "modelValue"), A = b(), j = n(), M = i(() => D.id ?? j?.id.value), N = i(() => D.invalid ?? j?.invalid.value ?? !1), P = e(), F = i(() => D.unstyled ?? P.unstyled), I = g(k.value), L;
59
59
  function R() {
60
60
  L !== void 0 && (clearTimeout(L), L = void 0);
61
61
  }
@@ -81,7 +81,7 @@ var T = [
81
81
  R(), I.value = "", k.value = "", V.value?.focus();
82
82
  }
83
83
  d({ input: V });
84
- let U = i(() => I.value !== "" && I.value != null), W = i(() => D.clearable && U.value && !D.disabled), G = i(() => D.loading || W.value || !!A.trailing), K = i(() => n({
84
+ let U = i(() => I.value !== "" && I.value != null), W = i(() => D.clearable && U.value && !D.disabled), G = i(() => D.loading || W.value || !!A.trailing), K = i(() => r({
85
85
  size: D.size,
86
86
  invalid: N.value
87
87
  }));
@@ -55,6 +55,7 @@ declare const __VLS_base: import("vue").DefineComponent<PinInputProps, {}, {}, {
55
55
  length: number;
56
56
  unstyled: boolean;
57
57
  separator: string;
58
+ invalid: boolean;
58
59
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
59
60
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
60
61
  declare const _default: typeof __VLS_export;
@@ -1,9 +1,10 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
- import { pinInputTheme as t } from "../theme/pin-input.js";
3
- import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createTextVNode as s, createVNode as c, defineComponent as l, normalizeClass as u, openBlock as d, renderList as f, renderSlot as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
4
- import { PinInputInput as _, PinInputRoot as v } from "reka-ui";
2
+ import { useFormField as t } from "../composables/form.js";
3
+ import { pinInputTheme as n } from "../theme/pin-input.js";
4
+ import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createTextVNode as c, createVNode as l, defineComponent as u, normalizeClass as d, openBlock as f, renderList as p, renderSlot as m, toDisplayString as h, unref as g, withCtx as _ } from "vue";
5
+ import { PinInputInput as v, PinInputRoot as y } from "reka-ui";
5
6
  //#region src/components/PinInput.vue?vue&type=script&setup=true&lang.ts
6
- var y = /*@__PURE__*/ l({
7
+ var b = /*@__PURE__*/ u({
7
8
  __name: "PinInput",
8
9
  props: {
9
10
  modelValue: {},
@@ -15,7 +16,10 @@ var y = /*@__PURE__*/ l({
15
16
  groupSize: {},
16
17
  separator: { default: "–" },
17
18
  disabled: { type: Boolean },
18
- invalid: { type: Boolean },
19
+ invalid: {
20
+ type: Boolean,
21
+ default: void 0
22
+ },
19
23
  size: {},
20
24
  id: {},
21
25
  unstyled: {
@@ -31,43 +35,47 @@ var y = /*@__PURE__*/ l({
31
35
  ui: {}
32
36
  },
33
37
  emits: ["update:modelValue", "complete"],
34
- setup(l, { emit: y }) {
35
- let b = l, x = y, S = r(() => (b.modelValue ?? "").split("")), C = (e) => e.join(""), w = r(() => Array.from({ length: b.length }, (e, t) => t)), T = r(() => {
36
- let e = b.groupSize;
37
- return !e || e <= 0 ? /* @__PURE__ */ new Set() : new Set(w.value.filter((t) => (t + 1) % e === 0 && t !== b.length - 1));
38
- }), E = e(), D = r(() => b.unstyled ?? E.unstyled), O = r(() => t({
39
- size: b.size,
40
- invalid: b.invalid
41
- })), k = r(() => D.value ? [b.ui?.root, b.class] : O.value.root({ class: [b.ui?.root, b.class] })), A = r(() => D.value ? b.ui?.input : O.value.input({ class: b.ui?.input })), j = r(() => D.value ? b.ui?.separator : O.value.separator({ class: b.ui?.separator }));
42
- return (e, t) => (d(), i(h(v), {
43
- id: b.id,
44
- "model-value": S.value,
45
- type: b.type,
46
- mask: b.mask,
47
- otp: b.otp,
48
- placeholder: b.placeholder,
49
- disabled: b.disabled,
50
- class: u(k.value),
51
- "onUpdate:modelValue": t[0] ||= (e) => x("update:modelValue", C(e)),
52
- onComplete: t[1] ||= (e) => x("complete", C(e))
38
+ setup(u, { emit: b }) {
39
+ let x = u, S = b, C = i(() => (x.modelValue ?? "").split("")), w = (e) => e.join(""), T = i(() => Array.from({ length: x.length }, (e, t) => t)), E = i(() => {
40
+ let e = x.groupSize;
41
+ return !e || e <= 0 ? /* @__PURE__ */ new Set() : new Set(T.value.filter((t) => (t + 1) % e === 0 && t !== x.length - 1));
42
+ }), D = t(), O = i(() => x.id ?? D?.id.value);
43
+ D && x.id && (D.id.value = x.id);
44
+ let k = i(() => x.invalid ?? D?.invalid.value ?? !1), A = e(), j = i(() => x.unstyled ?? A.unstyled), M = i(() => n({
45
+ size: x.size,
46
+ invalid: k.value
47
+ })), N = i(() => j.value ? [x.ui?.root, x.class] : M.value.root({ class: [x.ui?.root, x.class] })), P = i(() => j.value ? x.ui?.input : M.value.input({ class: x.ui?.input })), F = i(() => j.value ? x.ui?.separator : M.value.separator({ class: x.ui?.separator }));
48
+ return (e, t) => (f(), a(g(y), {
49
+ "aria-describedby": g(D)?.describedBy.value,
50
+ "model-value": C.value,
51
+ type: x.type,
52
+ mask: x.mask,
53
+ otp: x.otp,
54
+ placeholder: x.placeholder,
55
+ disabled: x.disabled,
56
+ class: d(N.value),
57
+ "onUpdate:modelValue": t[0] ||= (e) => S("update:modelValue", w(e)),
58
+ onComplete: t[1] ||= (e) => S("complete", w(e))
53
59
  }, {
54
- default: g(() => [(d(!0), o(n, null, f(w.value, (t) => (d(), o(n, { key: t }, [c(h(_), {
60
+ default: _(() => [(f(!0), s(r, null, p(T.value, (t) => (f(), s(r, { key: t }, [l(g(v), {
61
+ id: t === 0 ? O.value : void 0,
55
62
  index: t,
56
63
  spellcheck: "false",
57
- "aria-invalid": b.invalid || void 0,
58
- class: u(A.value)
64
+ "aria-invalid": k.value || void 0,
65
+ class: d(P.value)
59
66
  }, null, 8, [
67
+ "id",
60
68
  "index",
61
69
  "aria-invalid",
62
70
  "class"
63
- ]), T.value.has(t) ? (d(), o("span", {
71
+ ]), E.value.has(t) ? (f(), s("span", {
64
72
  key: 0,
65
- class: u(j.value),
73
+ class: d(F.value),
66
74
  "aria-hidden": "true"
67
- }, [p(e.$slots, "separator", {}, () => [s(m(b.separator), 1)])], 2)) : a("", !0)], 64))), 128))]),
75
+ }, [m(e.$slots, "separator", {}, () => [c(h(x.separator), 1)])], 2)) : o("", !0)], 64))), 128))]),
68
76
  _: 3
69
77
  }, 8, [
70
- "id",
78
+ "aria-describedby",
71
79
  "model-value",
72
80
  "type",
73
81
  "mask",
@@ -79,4 +87,4 @@ var y = /*@__PURE__*/ l({
79
87
  }
80
88
  });
81
89
  //#endregion
82
- export { y as default };
90
+ export { b as default };
@@ -11,6 +11,8 @@ export interface RadioGroupProps extends RadioGroupRootProps {
11
11
  /** Options to render. Strings are expanded to `{ label, value }`. */
12
12
  items?: (RadioGroupItemOption | string)[];
13
13
  size?: 'sm' | 'md' | 'lg';
14
+ /** Mark as failing validation. Taken from the enclosing `IFormField` when omitted. */
15
+ invalid?: boolean;
14
16
  /** Skip built-in classes; you take over styling entirely. */
15
17
  unstyled?: boolean;
16
18
  class?: ClassValue;
@@ -31,6 +33,7 @@ declare const __VLS_base: import("vue").DefineComponent<RadioGroupProps, {}, {},
31
33
  "onUpdate:modelValue"?: ((payload: import("reka-ui").AcceptableValue) => any) | undefined;
32
34
  }>, {
33
35
  unstyled: boolean;
36
+ invalid: boolean;
34
37
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
35
38
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
36
39
  declare const _default: typeof __VLS_export;
@@ -1,13 +1,18 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
- import { radioGroupTheme as t } from "../theme/radio-group.js";
3
- import { Fragment as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, mergeProps as d, normalizeClass as f, openBlock as p, renderList as m, renderSlot as h, toDisplayString as g, unref as _, withCtx as v } from "vue";
4
- import { Label as y, RadioGroupIndicator as b, RadioGroupItem as x, RadioGroupRoot as S, useForwardPropsEmits as C, useId as w } from "reka-ui";
2
+ import { useFormField as t } from "../composables/form.js";
3
+ import { radioGroupTheme as n } from "../theme/radio-group.js";
4
+ import { Fragment as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeProps as f, normalizeClass as p, openBlock as m, renderList as h, renderSlot as g, toDisplayString as _, unref as v, withCtx as y } from "vue";
5
+ import { Label as b, RadioGroupIndicator as x, RadioGroupItem as S, RadioGroupRoot as C, useForwardPropsEmits as w, useId as T } from "reka-ui";
5
6
  //#region src/components/RadioGroup.vue?vue&type=script&setup=true&lang.ts
6
- var T = ["id"], E = /*@__PURE__*/ u({
7
+ var E = ["id"], D = /*@__PURE__*/ d({
7
8
  __name: "RadioGroup",
8
9
  props: {
9
10
  items: {},
10
11
  size: {},
12
+ invalid: {
13
+ type: Boolean,
14
+ default: void 0
15
+ },
11
16
  unstyled: {
12
17
  type: Boolean,
13
18
  default: void 0
@@ -31,29 +36,37 @@ var T = ["id"], E = /*@__PURE__*/ u({
31
36
  required: { type: Boolean }
32
37
  },
33
38
  emits: ["update:modelValue"],
34
- setup(u, { emit: E }) {
35
- let D = u, O = E, k = C(r(() => {
36
- let { items: e, size: t, unstyled: n, class: r, ui: i, ...a } = D;
37
- return a;
38
- }), O), A = r(() => (D.items ?? []).map((e) => typeof e == "string" ? {
39
+ setup(d, { emit: D }) {
40
+ let O = d, k = D, A = w(i(() => {
41
+ let { items: e, size: t, invalid: n, unstyled: r, class: i, ui: a, ...o } = O;
42
+ return o;
43
+ }), k), j = i(() => (O.items ?? []).map((e) => typeof e == "string" ? {
39
44
  label: e,
40
45
  value: e
41
- } : e)), j = w(), M = e(), N = r(() => D.unstyled ?? M.unstyled), P = r(() => t({
42
- size: D.size,
43
- orientation: D.orientation ?? "vertical"
44
- })), F = r(() => N.value ? [D.ui?.root, D.class] : P.value.root({ class: [D.ui?.root, D.class] })), I = r(() => N.value ? D.ui?.item : P.value.item({ class: D.ui?.item })), L = r(() => N.value ? D.ui?.label : P.value.label({ class: D.ui?.label })), R = r(() => N.value ? D.ui?.description : P.value.description({ class: D.ui?.description }));
45
- return (e, t) => (p(), i(_(S), d(_(k), { class: F.value }), {
46
- default: v(() => [h(e.$slots, "default", {}, () => [(p(!0), o(n, null, m(A.value, (e) => (p(), o("div", {
46
+ } : e)), M = T(), N = t();
47
+ N && (N.id.value = void 0);
48
+ let P = i(() => O.invalid ?? N?.invalid.value ?? !1), F = e(), I = i(() => O.unstyled ?? F.unstyled), L = i(() => n({
49
+ size: O.size,
50
+ orientation: O.orientation ?? "vertical",
51
+ invalid: P.value
52
+ })), R = i(() => I.value ? [O.ui?.root, O.class] : L.value.root({ class: [O.ui?.root, O.class] })), z = i(() => I.value ? O.ui?.item : L.value.item({ class: O.ui?.item })), B = i(() => I.value ? O.ui?.label : L.value.label({ class: O.ui?.label })), V = i(() => I.value ? O.ui?.description : L.value.description({ class: O.ui?.description }));
53
+ return (e, t) => (m(), a(v(C), f(v(A), {
54
+ "aria-labelledby": v(N)?.labelId.value,
55
+ "aria-invalid": P.value || void 0,
56
+ "aria-describedby": v(N)?.describedBy.value,
57
+ class: R.value
58
+ }), {
59
+ default: y(() => [g(e.$slots, "default", {}, () => [(m(!0), s(r, null, h(j.value, (e) => (m(), s("div", {
47
60
  key: e.value,
48
- class: f(N.value ? void 0 : P.value.wrapper())
49
- }, [l(_(x), {
50
- id: `${_(j)}-${e.value}`,
61
+ class: p(I.value ? void 0 : L.value.wrapper())
62
+ }, [u(v(S), {
63
+ id: `${v(M)}-${e.value}`,
51
64
  value: e.value,
52
65
  disabled: e.disabled,
53
- "aria-describedby": e.description ? `${_(j)}-${e.value}-description` : void 0,
54
- class: f(I.value)
66
+ "aria-describedby": e.description ? `${v(M)}-${e.value}-description` : void 0,
67
+ class: p(z.value)
55
68
  }, {
56
- default: v(() => [l(_(b), { class: f(N.value ? void 0 : P.value.indicator()) }, null, 8, ["class"])]),
69
+ default: y(() => [u(v(x), { class: p(I.value ? void 0 : L.value.indicator()) }, null, 8, ["class"])]),
57
70
  _: 1
58
71
  }, 8, [
59
72
  "id",
@@ -61,20 +74,25 @@ var T = ["id"], E = /*@__PURE__*/ u({
61
74
  "disabled",
62
75
  "aria-describedby",
63
76
  "class"
64
- ]), s("div", { class: f(N.value ? void 0 : P.value.content()) }, [l(_(y), {
65
- for: `${_(j)}-${e.value}`,
66
- class: f(L.value)
77
+ ]), c("div", { class: p(I.value ? void 0 : L.value.content()) }, [u(v(b), {
78
+ for: `${v(M)}-${e.value}`,
79
+ class: p(B.value)
67
80
  }, {
68
- default: v(() => [c(g(e.label), 1)]),
81
+ default: y(() => [l(_(e.label), 1)]),
69
82
  _: 2
70
- }, 1032, ["for", "class"]), e.description ? (p(), o("p", {
83
+ }, 1032, ["for", "class"]), e.description ? (m(), s("p", {
71
84
  key: 0,
72
- id: `${_(j)}-${e.value}-description`,
73
- class: f(R.value)
74
- }, g(e.description), 11, T)) : a("", !0)], 2)], 2))), 128))])]),
85
+ id: `${v(M)}-${e.value}-description`,
86
+ class: p(V.value)
87
+ }, _(e.description), 11, E)) : o("", !0)], 2)], 2))), 128))])]),
75
88
  _: 3
76
- }, 16, ["class"]));
89
+ }, 16, [
90
+ "aria-labelledby",
91
+ "aria-invalid",
92
+ "aria-describedby",
93
+ "class"
94
+ ]));
77
95
  }
78
96
  });
79
97
  //#endregion
80
- export { E as default };
98
+ export { D as default };
@@ -21,6 +21,8 @@ export interface SelectProps extends SelectRootProps {
21
21
  size?: 'sm' | 'md' | 'lg';
22
22
  /** Lands on the trigger, so a `<label for>` names the control. */
23
23
  id?: string;
24
+ /** Mark as failing validation. Taken from the enclosing `IFormField` when omitted. */
25
+ invalid?: boolean;
24
26
  /** Skip built-in classes; you take over styling entirely. */
25
27
  unstyled?: boolean;
26
28
  class?: ClassValue;
@@ -45,6 +47,7 @@ declare const __VLS_base: import("vue").DefineComponent<SelectProps, {}, {}, {},
45
47
  "onUpdate:open"?: ((value: boolean) => any) | undefined;
46
48
  }>, {
47
49
  unstyled: boolean;
50
+ invalid: boolean;
48
51
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
49
52
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
50
53
  declare const _default: typeof __VLS_export;