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.
@@ -1,11 +1,12 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
2
  import t from "./Icon.js";
3
- import { selectTheme as n } from "../theme/select.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, guardReactiveProps as d, mergeProps as f, normalizeClass as p, normalizeProps as m, openBlock as h, renderList as g, renderSlot as _, toDisplayString as v, unref as y, withCtx as b } from "vue";
5
- import { ArrowDown01Icon as x, Tick02Icon as S } from "@hugeicons/core-free-icons";
6
- import { SelectContent as C, SelectGroup as w, SelectIcon as T, SelectItem as E, SelectItemIndicator as D, SelectItemText as O, SelectLabel as k, SelectPortal as A, SelectRoot as j, SelectTrigger as M, SelectValue as N, SelectViewport as P, useForwardPropsEmits as F } from "reka-ui";
3
+ import { useFormField as n } from "../composables/form.js";
4
+ import { selectTheme as r } from "../theme/select.js";
5
+ import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, createTextVNode as l, createVNode as u, defineComponent as d, guardReactiveProps as f, mergeProps as p, normalizeClass as m, normalizeProps as h, openBlock as g, renderList as _, renderSlot as v, toDisplayString as y, unref as b, withCtx as x } from "vue";
6
+ import { ArrowDown01Icon as S, Tick02Icon as C } from "@hugeicons/core-free-icons";
7
+ import { SelectContent as w, SelectGroup as T, SelectIcon as E, SelectItem as D, SelectItemIndicator as O, SelectItemText as k, SelectLabel as A, SelectPortal as ee, SelectRoot as te, SelectTrigger as j, SelectValue as M, SelectViewport as N, useForwardPropsEmits as P } from "reka-ui";
7
8
  //#region src/components/Select.vue?vue&type=script&setup=true&lang.ts
8
- var I = /*@__PURE__*/ u({
9
+ var F = /*@__PURE__*/ d({
9
10
  inheritAttrs: !1,
10
11
  __name: "Select",
11
12
  props: {
@@ -13,6 +14,10 @@ var I = /*@__PURE__*/ u({
13
14
  placeholder: {},
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
@@ -38,67 +43,81 @@ var I = /*@__PURE__*/ u({
38
43
  required: { type: Boolean }
39
44
  },
40
45
  emits: ["update:modelValue", "update:open"],
41
- setup(u, { emit: I }) {
42
- let L = u, R = I, z = F(i(() => {
43
- let { items: e, placeholder: t, size: n, id: r, unstyled: i, class: a, ui: o, ...s } = L;
44
- return s;
45
- }), R);
46
- function B(e) {
46
+ setup(d, { emit: F }) {
47
+ let I = d, L = F, R = P(a(() => {
48
+ let { items: e, placeholder: t, size: n, id: r, invalid: i, unstyled: a, class: o, ui: s, ...c } = I;
49
+ return c;
50
+ }), L);
51
+ function z(e) {
47
52
  return typeof e == "string" ? {
48
53
  label: e,
49
54
  value: e
50
55
  } : e;
51
56
  }
52
- function V(e) {
57
+ function B(e) {
53
58
  return typeof e != "string" && "items" in e;
54
59
  }
55
- let H = i(() => {
56
- let e = L.items ?? [];
57
- if (e.some(V)) return e.map((e) => V(e) ? {
60
+ let V = a(() => {
61
+ let e = I.items ?? [];
62
+ if (e.some(B)) return e.map((e) => B(e) ? {
58
63
  label: e.label,
59
- options: e.items.map(B)
64
+ options: e.items.map(z)
60
65
  } : {
61
66
  label: "",
62
- options: [B(e)]
67
+ options: [z(e)]
63
68
  });
64
- }), U = i(() => (L.items ?? []).flatMap((e) => V(e) ? e.items.map(B) : [B(e)])), W = e(), G = i(() => L.unstyled ?? W.unstyled), K = i(() => n({ size: L.size })), q = i(() => G.value ? [L.ui?.trigger, L.class] : K.value.trigger({ class: [L.ui?.trigger, L.class] })), J = i(() => G.value ? L.ui?.content : K.value.content({ class: L.ui?.content })), Y = i(() => G.value ? L.ui?.viewport : K.value.viewport({ class: L.ui?.viewport })), X = i(() => G.value ? L.ui?.item : K.value.item({ class: L.ui?.item })), Z = i(() => G.value ? void 0 : K.value.itemIndicator()), Q = i(() => G.value ? L.ui?.group : K.value.group({ class: L.ui?.group })), $ = i(() => G.value ? L.ui?.groupLabel : K.value.groupLabel({ class: L.ui?.groupLabel }));
65
- return (e, n) => (h(), a(y(j), m(d(y(z))), {
66
- default: b(() => [l(y(M), f({ id: L.id }, e.$attrs, { class: q.value }), {
67
- default: b(() => [l(y(N), {
69
+ }), H = a(() => (I.items ?? []).flatMap((e) => B(e) ? e.items.map(z) : [z(e)])), U = n(), W = a(() => I.id ?? U?.id.value);
70
+ U && I.id && (U.id.value = I.id);
71
+ let G = a(() => I.invalid ?? U?.invalid.value ?? !1), K = e(), q = a(() => I.unstyled ?? K.unstyled), J = a(() => r({
72
+ size: I.size,
73
+ invalid: G.value
74
+ })), Y = a(() => q.value ? [I.ui?.trigger, I.class] : J.value.trigger({ class: [I.ui?.trigger, I.class] })), X = a(() => q.value ? I.ui?.content : J.value.content({ class: I.ui?.content })), Z = a(() => q.value ? I.ui?.viewport : J.value.viewport({ class: I.ui?.viewport })), Q = a(() => q.value ? I.ui?.item : J.value.item({ class: I.ui?.item })), $ = a(() => q.value ? void 0 : J.value.itemIndicator()), ne = a(() => q.value ? I.ui?.group : J.value.group({ class: I.ui?.group })), re = a(() => q.value ? I.ui?.groupLabel : J.value.groupLabel({ class: I.ui?.groupLabel }));
75
+ return (e, n) => (g(), o(b(te), h(f(b(R))), {
76
+ default: x(() => [u(b(j), p({
77
+ id: W.value,
78
+ "aria-invalid": G.value || void 0,
79
+ "aria-describedby": b(U)?.describedBy.value
80
+ }, e.$attrs, { class: Y.value }), {
81
+ default: x(() => [u(b(M), {
68
82
  class: "truncate",
69
- placeholder: L.placeholder
70
- }, null, 8, ["placeholder"]), l(y(T), { "as-child": "" }, {
71
- default: b(() => [l(t, { icon: y(x) }, null, 8, ["icon"])]),
83
+ placeholder: I.placeholder
84
+ }, null, 8, ["placeholder"]), u(b(E), { "as-child": "" }, {
85
+ default: x(() => [u(t, { icon: b(S) }, null, 8, ["icon"])]),
72
86
  _: 1
73
87
  })]),
74
88
  _: 1
75
- }, 16, ["id", "class"]), l(y(A), null, {
76
- default: b(() => [l(y(C), {
77
- class: p(J.value),
89
+ }, 16, [
90
+ "id",
91
+ "aria-invalid",
92
+ "aria-describedby",
93
+ "class"
94
+ ]), u(b(ee), null, {
95
+ default: x(() => [u(b(w), {
96
+ class: m(X.value),
78
97
  position: "item-aligned"
79
98
  }, {
80
- default: b(() => [l(y(P), { class: p(Y.value) }, {
81
- default: b(() => [_(e.$slots, "default", {}, () => [H.value ? (h(!0), s(r, { key: 0 }, g(H.value, (e, n) => (h(), a(y(w), {
99
+ default: x(() => [u(b(N), { class: m(Z.value) }, {
100
+ default: x(() => [v(e.$slots, "default", {}, () => [V.value ? (g(!0), c(i, { key: 0 }, _(V.value, (e, n) => (g(), o(b(T), {
82
101
  key: e.label || n,
83
- class: p(Q.value)
102
+ class: m(ne.value)
84
103
  }, {
85
- default: b(() => [e.label ? (h(), a(y(k), {
104
+ default: x(() => [e.label ? (g(), o(b(A), {
86
105
  key: 0,
87
- class: p($.value)
106
+ class: m(re.value)
88
107
  }, {
89
- default: b(() => [c(v(e.label), 1)]),
108
+ default: x(() => [l(y(e.label), 1)]),
90
109
  _: 2
91
- }, 1032, ["class"])) : o("", !0), (h(!0), s(r, null, g(e.options, (e) => (h(), a(y(E), {
110
+ }, 1032, ["class"])) : s("", !0), (g(!0), c(i, null, _(e.options, (e) => (g(), o(b(D), {
92
111
  key: e.value,
93
112
  value: e.value,
94
113
  disabled: e.disabled,
95
- class: p(X.value)
114
+ class: m(Q.value)
96
115
  }, {
97
- default: b(() => [l(y(D), { class: p(Z.value) }, {
98
- default: b(() => [l(t, { icon: y(S) }, null, 8, ["icon"])]),
116
+ default: x(() => [u(b(O), { class: m($.value) }, {
117
+ default: x(() => [u(t, { icon: b(C) }, null, 8, ["icon"])]),
99
118
  _: 1
100
- }, 8, ["class"]), l(y(O), null, {
101
- default: b(() => [c(v(e.label), 1)]),
119
+ }, 8, ["class"]), u(b(k), null, {
120
+ default: x(() => [l(y(e.label), 1)]),
102
121
  _: 2
103
122
  }, 1024)]),
104
123
  _: 2
@@ -108,17 +127,17 @@ var I = /*@__PURE__*/ u({
108
127
  "class"
109
128
  ]))), 128))]),
110
129
  _: 2
111
- }, 1032, ["class"]))), 128)) : (h(!0), s(r, { key: 1 }, g(U.value, (e) => (h(), a(y(E), {
130
+ }, 1032, ["class"]))), 128)) : (g(!0), c(i, { key: 1 }, _(H.value, (e) => (g(), o(b(D), {
112
131
  key: e.value,
113
132
  value: e.value,
114
133
  disabled: e.disabled,
115
- class: p(X.value)
134
+ class: m(Q.value)
116
135
  }, {
117
- default: b(() => [l(y(D), { class: p(Z.value) }, {
118
- default: b(() => [l(t, { icon: y(S) }, null, 8, ["icon"])]),
136
+ default: x(() => [u(b(O), { class: m($.value) }, {
137
+ default: x(() => [u(t, { icon: b(C) }, null, 8, ["icon"])]),
119
138
  _: 1
120
- }, 8, ["class"]), l(y(O), null, {
121
- default: b(() => [c(v(e.label), 1)]),
139
+ }, 8, ["class"]), u(b(k), null, {
140
+ default: x(() => [l(y(e.label), 1)]),
122
141
  _: 2
123
142
  }, 1024)]),
124
143
  _: 2
@@ -138,4 +157,4 @@ var I = /*@__PURE__*/ u({
138
157
  }
139
158
  });
140
159
  //#endregion
141
- export { I as default };
160
+ export { F as default };
@@ -1,9 +1,10 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
- import { sliderTheme as t } from "../theme/slider.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 { SliderRange as y, SliderRoot as b, SliderThumb as x, SliderTrack as S, useId as C } from "reka-ui";
2
+ import { useFormField as t } from "../composables/form.js";
3
+ import { sliderTheme as n } from "../theme/slider.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 { SliderRange as b, SliderRoot as x, SliderThumb as S, SliderTrack as C, useId as w } from "reka-ui";
5
6
  //#region src/components/Slider.vue?vue&type=script&setup=true&lang.ts
6
- var w = ["id"], T = /*@__PURE__*/ u({
7
+ var T = ["id"], E = /*@__PURE__*/ d({
7
8
  inheritAttrs: !1,
8
9
  __name: "Slider",
9
10
  props: {
@@ -35,62 +36,65 @@ var w = ["id"], T = /*@__PURE__*/ u({
35
36
  ui: {}
36
37
  },
37
38
  emits: ["update:modelValue", "valueCommit"],
38
- setup(u, { emit: T }) {
39
- let E = u, D = T, O = r(() => typeof E.modelValue == "number"), k = r(() => Array.isArray(E.modelValue) ? E.modelValue : typeof E.modelValue == "number" ? [E.modelValue] : [E.min]);
40
- function A(e) {
41
- return O.value ? e[0] ?? E.min : e;
39
+ setup(d, { emit: E }) {
40
+ let D = d, O = E, k = i(() => typeof D.modelValue == "number"), A = i(() => Array.isArray(D.modelValue) ? D.modelValue : typeof D.modelValue == "number" ? [D.modelValue] : [D.min]);
41
+ function j(e) {
42
+ return k.value ? e[0] ?? D.min : e;
42
43
  }
43
- let j = r(() => E.formatValue ?? ((e) => String(e))), M = r(() => k.value.map((e) => j.value(e)).join(" – "));
44
- function N(e, t) {
45
- return E.label ? k.value.length > 1 ? `${E.label} ${E.rangeLabels[e] ?? ""}`.trim() : E.label : k.value.length > 1 ? E.rangeLabels[e] ?? void 0 : j.value(t);
44
+ let M = i(() => D.formatValue ?? ((e) => String(e))), N = i(() => A.value.map((e) => M.value(e)).join(" – "));
45
+ function P(e, t) {
46
+ return D.label ? A.value.length > 1 ? `${D.label} ${D.rangeLabels[e] ?? ""}`.trim() : D.label : A.value.length > 1 ? D.rangeLabels[e] ?? void 0 : M.value(t);
46
47
  }
47
- let P = C(), F = r(() => `${E.id ?? P}-label`), I = r(() => !!(E.label || E.showValue)), L = e(), R = r(() => E.unstyled ?? L.unstyled), z = r(() => t({
48
- orientation: E.orientation,
49
- size: E.size,
50
- disabled: E.disabled ?? !1
48
+ let F = w(), I = t();
49
+ I && (I.id.value = void 0);
50
+ let L = i(() => `${D.id ?? F}-label`), R = i(() => !!(D.label || D.showValue)), z = e(), B = i(() => D.unstyled ?? z.unstyled), V = i(() => n({
51
+ orientation: D.orientation,
52
+ size: D.size,
53
+ disabled: D.disabled ?? !1
51
54
  }));
52
- function B(e, t) {
53
- let n = [E.ui?.[e], t];
54
- return R.value ? n : z.value[e]({ class: n });
55
+ function H(e, t) {
56
+ let n = [D.ui?.[e], t];
57
+ return B.value ? n : V.value[e]({ class: n });
55
58
  }
56
- return (e, t) => (p(), o("div", { class: f(B("root", E.class)) }, [
57
- I.value ? (p(), o("div", {
59
+ return (e, t) => (m(), s("div", { class: p(H("root", D.class)) }, [
60
+ R.value ? (m(), s("div", {
58
61
  key: 0,
59
- class: f(B("header"))
60
- }, [E.label || e.$slots.label ? (p(), o("span", {
62
+ class: p(H("header"))
63
+ }, [D.label || e.$slots.label ? (m(), s("span", {
61
64
  key: 0,
62
- id: F.value,
63
- class: f(B("label"))
64
- }, [h(e.$slots, "label", {}, () => [c(g(E.label), 1)])], 10, w)) : a("", !0), E.showValue ? (p(), o("span", {
65
+ id: L.value,
66
+ class: p(H("label"))
67
+ }, [g(e.$slots, "label", {}, () => [l(_(D.label), 1)])], 10, T)) : o("", !0), D.showValue ? (m(), s("span", {
65
68
  key: 1,
66
- class: f(B("value"))
67
- }, [h(e.$slots, "value", {
68
- values: k.value,
69
- text: M.value
70
- }, () => [c(g(M.value), 1)])], 2)) : a("", !0)], 2)) : a("", !0),
71
- l(_(b), d({
72
- "model-value": k.value,
73
- min: E.min,
74
- max: E.max,
75
- step: E.step,
76
- disabled: E.disabled,
77
- orientation: E.orientation,
78
- inverted: E.inverted,
79
- "min-steps-between-thumbs": E.minStepsBetweenThumbs,
80
- "aria-labelledby": E.label ? F.value : void 0
69
+ class: p(H("value"))
70
+ }, [g(e.$slots, "value", {
71
+ values: A.value,
72
+ text: N.value
73
+ }, () => [l(_(N.value), 1)])], 2)) : o("", !0)], 2)) : o("", !0),
74
+ u(v(x), f({
75
+ "model-value": A.value,
76
+ min: D.min,
77
+ max: D.max,
78
+ step: D.step,
79
+ disabled: D.disabled,
80
+ orientation: D.orientation,
81
+ inverted: D.inverted,
82
+ "min-steps-between-thumbs": D.minStepsBetweenThumbs,
83
+ "aria-labelledby": D.label ? L.value : v(I)?.labelId.value,
84
+ "aria-describedby": v(I)?.describedBy.value
81
85
  }, e.$attrs, {
82
- class: B("slider"),
83
- "onUpdate:modelValue": t[0] ||= (e) => e && D("update:modelValue", A(e)),
84
- onValueCommit: t[1] ||= (e) => D("valueCommit", A(e))
86
+ class: H("slider"),
87
+ "onUpdate:modelValue": t[0] ||= (e) => e && O("update:modelValue", j(e)),
88
+ onValueCommit: t[1] ||= (e) => O("valueCommit", j(e))
85
89
  }), {
86
- default: v(() => [l(_(S), { class: f(B("track")) }, {
87
- default: v(() => [l(_(y), { class: f(B("range")) }, null, 8, ["class"])]),
90
+ default: y(() => [u(v(C), { class: p(H("track")) }, {
91
+ default: y(() => [u(v(b), { class: p(H("range")) }, null, 8, ["class"])]),
88
92
  _: 1
89
- }, 8, ["class"]), (p(!0), o(n, null, m(k.value, (e, t) => (p(), i(_(x), {
93
+ }, 8, ["class"]), (m(!0), s(r, null, h(A.value, (e, t) => (m(), a(v(S), {
90
94
  key: t,
91
- "aria-label": N(t, e),
92
- "aria-valuetext": j.value(e),
93
- class: f(B("thumb"))
95
+ "aria-label": P(t, e),
96
+ "aria-valuetext": M.value(e),
97
+ class: p(H("thumb"))
94
98
  }, null, 8, [
95
99
  "aria-label",
96
100
  "aria-valuetext",
@@ -107,14 +111,15 @@ var w = ["id"], T = /*@__PURE__*/ u({
107
111
  "inverted",
108
112
  "min-steps-between-thumbs",
109
113
  "aria-labelledby",
114
+ "aria-describedby",
110
115
  "class"
111
116
  ]),
112
- E.showScale && E.orientation !== "vertical" ? (p(), o("div", {
117
+ D.showScale && D.orientation !== "vertical" ? (m(), s("div", {
113
118
  key: 1,
114
- class: f(B("scale"))
115
- }, [s("span", null, g(j.value(E.min)), 1), s("span", null, g(j.value(E.max)), 1)], 2)) : a("", !0)
119
+ class: p(H("scale"))
120
+ }, [c("span", null, _(M.value(D.min)), 1), c("span", null, _(M.value(D.max)), 1)], 2)) : o("", !0)
116
121
  ], 2));
117
122
  }
118
123
  });
119
124
  //#endregion
120
- export { T as default };
125
+ export { E as default };
@@ -7,6 +7,8 @@ export interface SwitchProps extends SwitchRootProps {
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;
@@ -32,6 +34,7 @@ declare const __VLS_base: import("vue").DefineComponent<SwitchProps, {}, {}, {},
32
34
  "onUpdate:modelValue"?: ((payload: boolean) => any) | undefined;
33
35
  }>, {
34
36
  unstyled: boolean;
37
+ invalid: boolean;
35
38
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
36
39
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
37
40
  declare const _default: typeof __VLS_export;
@@ -1,9 +1,10 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
- import { switchTheme as t } from "../theme/switch.js";
3
- import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, createVNode as c, defineComponent as l, mergeProps as u, normalizeClass as d, openBlock as f, renderSlot as p, toDisplayString as m, unref as h, withCtx as g } from "vue";
4
- import { Label as _, SwitchRoot as v, SwitchThumb as y, useForwardPropsEmits as b, useId as x } from "reka-ui";
2
+ import { useFormField as t } from "../composables/form.js";
3
+ import { switchTheme as n } from "../theme/switch.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 { Label as v, SwitchRoot as y, SwitchThumb as b, useForwardPropsEmits as x, useId as S } from "reka-ui";
5
6
  //#region src/components/Switch.vue?vue&type=script&setup=true&lang.ts
6
- var S = ["id"], C = /*@__PURE__*/ l({
7
+ var C = ["id"], w = /*@__PURE__*/ u({
7
8
  inheritAttrs: !1,
8
9
  __name: "Switch",
9
10
  props: {
@@ -11,6 +12,10 @@ var S = ["id"], C = /*@__PURE__*/ l({
11
12
  description: {},
12
13
  size: {},
13
14
  id: {},
15
+ invalid: {
16
+ type: Boolean,
17
+ default: void 0
18
+ },
14
19
  unstyled: {
15
20
  type: Boolean,
16
21
  default: void 0
@@ -34,51 +39,63 @@ var S = ["id"], C = /*@__PURE__*/ l({
34
39
  required: { type: Boolean }
35
40
  },
36
41
  emits: ["update:modelValue"],
37
- setup(l, { emit: C }) {
38
- let w = l, T = C, E = b(n(() => {
39
- let { label: e, description: t, size: n, id: r, unstyled: i, class: a, ui: o, ...s } = w;
40
- return s;
41
- }), T), D = x(), O = n(() => w.id ?? D), k = n(() => !!(w.label || w.description)), A = e(), j = n(() => w.unstyled ?? A.unstyled), M = n(() => t({
42
- size: w.size,
43
- withText: k.value
44
- })), N = n(() => j.value ? w.ui?.wrapper : M.value.wrapper({ class: w.ui?.wrapper })), P = n(() => j.value ? [w.ui?.root, w.class] : M.value.root({ class: [w.ui?.root, w.class] })), F = n(() => j.value ? w.ui?.thumb : M.value.thumb({ class: w.ui?.thumb })), I = n(() => j.value ? w.ui?.content : M.value.content({ class: w.ui?.content })), L = n(() => j.value ? w.ui?.label : M.value.label({ class: w.ui?.label })), R = n(() => j.value ? w.ui?.description : M.value.description({ class: w.ui?.description }));
45
- return (e, t) => k.value ? (f(), a("div", {
42
+ setup(u, { emit: w }) {
43
+ let T = u, E = w, D = x(r(() => {
44
+ let { label: e, description: t, size: n, id: r, invalid: i, unstyled: a, class: o, ui: s, ...c } = T;
45
+ return c;
46
+ }), E), O = S(), k = t(), A = r(() => T.invalid ?? k?.invalid.value ?? !1), j = r(() => T.id ?? k?.id.value ?? O);
47
+ k && (k.id.value = j.value);
48
+ let M = r(() => !!(T.label || T.description)), N = e(), P = r(() => T.unstyled ?? N.unstyled), F = r(() => n({
49
+ size: T.size,
50
+ withText: M.value,
51
+ invalid: A.value
52
+ })), I = r(() => P.value ? T.ui?.wrapper : F.value.wrapper({ class: T.ui?.wrapper })), L = r(() => P.value ? [T.ui?.root, T.class] : F.value.root({ class: [T.ui?.root, T.class] })), R = r(() => P.value ? T.ui?.thumb : F.value.thumb({ class: T.ui?.thumb })), z = r(() => P.value ? T.ui?.content : F.value.content({ class: T.ui?.content })), B = r(() => P.value ? T.ui?.label : F.value.label({ class: T.ui?.label })), V = r(() => P.value ? T.ui?.description : F.value.description({ class: T.ui?.description }));
53
+ return (e, t) => M.value ? (p(), o("div", {
46
54
  key: 0,
47
- class: d(N.value)
48
- }, [c(h(v), u({ id: O.value }, {
49
- ...h(E),
55
+ class: f(I.value)
56
+ }, [l(g(y), d({ id: j.value }, {
57
+ ...g(D),
50
58
  ...e.$attrs
51
59
  }, {
52
- "aria-describedby": w.description ? `${O.value}-description` : void 0,
53
- class: P.value
60
+ "aria-invalid": A.value || void 0,
61
+ "aria-describedby": T.description ? `${j.value}-description` : void 0,
62
+ class: L.value
54
63
  }), {
55
- default: g(() => [c(h(y), { class: d(F.value) }, null, 8, ["class"])]),
64
+ default: _(() => [l(g(b), { class: f(R.value) }, null, 8, ["class"])]),
56
65
  _: 1
57
66
  }, 16, [
58
67
  "id",
68
+ "aria-invalid",
59
69
  "aria-describedby",
60
70
  "class"
61
- ]), o("div", { class: d(I.value) }, [c(h(_), {
62
- for: O.value,
63
- class: d(L.value)
71
+ ]), s("div", { class: f(z.value) }, [l(g(v), {
72
+ for: j.value,
73
+ class: f(B.value)
64
74
  }, {
65
- default: g(() => [p(e.$slots, "label", {}, () => [s(m(w.label), 1)])]),
75
+ default: _(() => [m(e.$slots, "label", {}, () => [c(h(T.label), 1)])]),
66
76
  _: 3
67
- }, 8, ["for", "class"]), w.description || e.$slots.description ? (f(), a("p", {
77
+ }, 8, ["for", "class"]), T.description || e.$slots.description ? (p(), o("p", {
68
78
  key: 0,
69
- id: `${O.value}-description`,
70
- class: d(R.value)
71
- }, [p(e.$slots, "description", {}, () => [s(m(w.description), 1)])], 10, S)) : i("", !0)], 2)], 2)) : (f(), r(h(v), u({
79
+ id: `${j.value}-description`,
80
+ class: f(V.value)
81
+ }, [m(e.$slots, "description", {}, () => [c(h(T.description), 1)])], 10, C)) : a("", !0)], 2)], 2)) : (p(), i(g(y), d({
72
82
  key: 1,
73
- id: w.id
83
+ id: j.value
74
84
  }, {
75
- ...h(E),
85
+ ...g(D),
76
86
  ...e.$attrs
77
- }, { class: P.value }), {
78
- default: g(() => [c(h(y), { class: d(F.value) }, null, 8, ["class"])]),
87
+ }, {
88
+ "aria-invalid": A.value || void 0,
89
+ class: L.value
90
+ }), {
91
+ default: _(() => [l(g(b), { class: f(R.value) }, null, 8, ["class"])]),
79
92
  _: 1
80
- }, 16, ["id", "class"]));
93
+ }, 16, [
94
+ "id",
95
+ "aria-invalid",
96
+ "class"
97
+ ]));
81
98
  }
82
99
  });
83
100
  //#endregion
84
- export { C as default };
101
+ export { w as default };
@@ -1,6 +1,6 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
- import { textareaTheme as t } from "../theme/input.js";
3
- import { useFormField as n } from "../composables/form.js";
2
+ import { useFormField as t } from "../composables/form.js";
3
+ import { textareaTheme as n } from "../theme/input.js";
4
4
  import { computed as r, createElementBlock as i, defineComponent as a, mergeModels as o, nextTick as s, normalizeClass as c, onMounted as l, openBlock as u, ref as d, unref as f, useModel as p, vModelText as m, watch as h, withDirectives as g } from "vue";
5
5
  //#region src/components/Textarea.vue?vue&type=script&setup=true&lang.ts
6
6
  var _ = [
@@ -41,7 +41,7 @@ var _ = [
41
41
  }),
42
42
  emits: ["update:modelValue"],
43
43
  setup(a, { expose: o }) {
44
- let v = a, y = p(a, "modelValue"), b = n(), x = r(() => v.id ?? b?.id.value), S = r(() => v.invalid ?? b?.invalid.value ?? !1), C = e(), w = r(() => v.unstyled ?? C.unstyled), T = r(() => w.value ? v.class : t({
44
+ let v = a, y = p(a, "modelValue"), b = t(), x = r(() => v.id ?? b?.id.value), S = r(() => v.invalid ?? b?.invalid.value ?? !1), C = e(), w = r(() => v.unstyled ?? C.unstyled), T = r(() => w.value ? v.class : n({
45
45
  size: v.size,
46
46
  invalid: S.value,
47
47
  autosize: !!v.autosize,
@@ -52,7 +52,14 @@ export interface FormContext {
52
52
  export declare const formContextKey: InjectionKey<FormContext>;
53
53
  /** Context a `FormField` exposes to the control it wraps. */
54
54
  export interface FormFieldContext {
55
- id: ComputedRef<string>;
55
+ /**
56
+ * The id the field's `<label for>` points at. Writable: a control with its
57
+ * own `id` writes that back, and one a label cannot target — a radio group,
58
+ * a slider — clears it so the field renders no dangling `for`.
59
+ */
60
+ id: Ref<string | undefined>;
61
+ /** Id of the field's own `<label>`, for controls a `for` cannot target. */
62
+ labelId: ComputedRef<string | undefined>;
56
63
  name: ComputedRef<string | undefined>;
57
64
  invalid: ComputedRef<boolean>;
58
65
  describedBy: ComputedRef<string | undefined>;
package/dist/index.js CHANGED
@@ -43,14 +43,14 @@ import { calendarTheme as _e } from "./theme/calendar.js";
43
43
  import ve from "./components/Calendar.js";
44
44
  import { cardTheme as ye } from "./theme/card.js";
45
45
  import be from "./components/Card.js";
46
- import { checkboxTheme as xe } from "./theme/checkbox.js";
47
- import Se from "./components/Checkbox.js";
48
- import { collapsibleTheme as Ce } from "./theme/collapsible.js";
49
- import we from "./components/Collapsible.js";
50
- import { fieldBase as Te, inputTheme as Ee, textareaTheme as De } from "./theme/input.js";
51
- import { colorPickerTheme as Oe } from "./theme/color-picker.js";
52
- import ke from "./components/ColorPicker.js";
53
- import { formContextKey as Ae, formFieldContextKey as je, getByPath as Me, isStandardSchema as Ne, issuePath as Pe, useForm as Fe, useFormField as Ie } from "./composables/form.js";
46
+ import { formContextKey as xe, formFieldContextKey as Se, getByPath as Ce, isStandardSchema as we, issuePath as Te, useForm as Ee, useFormField as De } from "./composables/form.js";
47
+ import { checkboxTheme as Oe } from "./theme/checkbox.js";
48
+ import ke from "./components/Checkbox.js";
49
+ import { collapsibleTheme as Ae } from "./theme/collapsible.js";
50
+ import je from "./components/Collapsible.js";
51
+ import { fieldBase as Me, inputTheme as Ne, textareaTheme as Pe } from "./theme/input.js";
52
+ import { colorPickerTheme as Fe } from "./theme/color-picker.js";
53
+ import Ie from "./components/ColorPicker.js";
54
54
  import { comboboxTheme as Le } from "./theme/combobox.js";
55
55
  import Re from "./components/Combobox.js";
56
56
  import { isApplePlatform as ze, parseHotkey as Be, useApplePlatform as Ve } from "./composables/kbd.js";
@@ -167,4 +167,4 @@ import pr from "./components/Tooltip.js";
167
167
  import { treeTheme as mr } from "./theme/tree.js";
168
168
  import hr from "./components/Tree.js";
169
169
  import { IryxUi as gr, createIryxUi as _r } from "./plugin.js";
170
- export { B as AXIS_GAP, s as Accordion, l as Alert, h as App, b as AppShell, x as AspectRatio, D as AuthProviders, A as Avatar, j as AvatarGroup, N as Badge, F as Banner, ie as BarChart, oe as Breadcrumb, E as Button, ce as ButtonGroup, V as CATEGORY_HEIGHT, H as CHAR_WIDTH, ve as Calendar, le as CalendarDate, be as Card, re as ChartLegend, Se as Checkbox, we as Collapsible, ke as ColorPicker, Re as Combobox, Ye as CommandPalette, tt as ConfirmDialog, rt as Container, st as ContextMenu, lt as DateField, dt as DatePicker, ft as DateRangePicker, et as Dialog, mt as DonutChart, y as Drawer, ht as DropdownMenu, _t as Editable, yt as EmptyState, xt as FileUpload, St as Form, Tt as FormField, Dt as HoverCard, o as Icon, Ot as Input, gr as IryxUi, Je as Kbd, wt as Label, At as LineChart, Mt as Menubar, Ft as NavigationMenu, Jt as NumberInput, Xt as PageHeader, Qt as Pagination, en as PasswordInput, nn as PinInput, an as Popover, sn as Progress, Z as REVEAL_DURATION, ln as RadioGroup, U as SERIES_SLOTS, dn as ScrollArea, hn as ScrollFade, _n as Select, yn as Separator, wn as Sidebar, On as SignaturePad, An as Skeleton, Mn as Slider, Pn as Sparkline, In as Splitter, Rn as Stat, Bn as Stepper, Hn as Switch, W as TOP_PAD, Kn as Table, Jn as Tabs, Xn as TagsInput, Zn as Textarea, ue as Time, $n as TimeField, tr as Timeline, ar as Toaster, cr as Toggle, lr as ToggleGroup, dr as Toolbar, pr as Tooltip, hr as Tree, i as accordionTheme, It as addDecimals, c as alertTheme, _ as appShellTheme, f as applyTheme, S as authProvidersTheme, O as avatarGroupTheme, k as avatarTheme, M as badgeTheme, P as bannerTheme, te as barChartTheme, ae as breadcrumbTheme, C as buttonGroupContextKey, se as buttonGroupTheme, T as buttonTheme, _e as calendarTheme, ye as cardTheme, G as cartesianLayout, ne as chartLegendTheme, xe as checkboxTheme, Lt as clampDecimal, K as clampTooltip, p as clearTheme, Ce as collapsibleTheme, Oe as colorPickerTheme, Le as comboboxTheme, He as commandHaystack, Ke as commandPaletteTheme, Rt as compareDecimals, e as componentNames, nt as containerTheme, _r as createIryxUi, ct as dateFieldTheme, ut as datePickerTheme, t as defaultConfig, $e as dialogTheme, pt as donutChartTheme, v as drawerTheme, it as dropdownMenuTheme, gt as editableTheme, vt as emptyStateTheme, I as extent, Te as fieldBase, bt as fileUploadTheme, L as finiteValues, Ae as formContextKey, je as formFieldContextKey, zt as formatDecimal, Bt as formatForLocale, de as formatIsoDate, Me as getByPath, Un as getRowValue, Tn as hasInk, Et as hoverCardTheme, u as initAppearance, Ee as inputTheme, n as iryxUiConfigKey, ze as isApplePlatform, Ue as isCommandGroup, Vt as isDecimal, a as isIconArray, Nt as isNavigationGroup, at as isSeparator, bn as isSidebarGroup, xn as isSidebarSection, Ne as isStandardSchema, ot as isSubmenu, fe as isoToday, Pe as issuePath, qe as kbdTheme, Ct as labelTheme, kt as lineChartTheme, R as linearScale, Ht as localeSeparators, We as matchesHotkey, jt as menubarTheme, Pt as navigationMenuTheme, z as niceTicks, qt as numberInputTheme, Yt as pageHeaderTheme, Zt as paginationTheme, Ut as parseDecimal, Wt as parseFromLocale, Be as parseHotkey, $t as passwordInputTheme, tn as pinInputTheme, rn as popoverTheme, on as progressTheme, cn as radioGroupTheme, Xe as resolveConfirm, Gt as roundDecimal, un as scrollAreaTheme, fn as scrollFadeMask, mn as scrollFadeTheme, gn as selectTheme, vn as separatorTheme, q as seriesColor, Cn as sidebarTheme, Dn as signaturePadTheme, kn as skeletonTheme, jn as sliderTheme, J as slotOf, Nn as sparklineTheme, Fn as splitterTheme, Ln as statTheme, zn as stepperTheme, En as strokeWidth, Vn as switchTheme, Gn as tableTheme, qn as tabsTheme, Yn as tagsInputTheme, De as textareaTheme, m as themes, Qn as timeFieldTheme, er as timelineTheme, pe as toCalendarDate, Ge as toCommandGroups, Kt as toEditable, me as toIsoDate, he as toIsoTime, Sn as toSidebarSections, ge as toTime, ir as toastTheme, or as toggleGroupTheme, sr as toggleTheme, ur as toolbarTheme, Y as tooltipHalfWidth, fr as tooltipTheme, mr as treeTheme, d as useAppearance, Ve as useApplePlatform, w as useButtonGroup, Q as useChartAnimation, $ as useChartProgress, ee as useChartReveal, Ze as useConfirm, Qe as useConfirmState, Wn as useDataTable, g as useElementSize, Fe as useForm, Ie as useFormField, r as useIryxUiConfig, pn as useScrollEdges, nr as useToast, rr as useToastState, X as warnOnSlotOverflow };
170
+ export { B as AXIS_GAP, s as Accordion, l as Alert, h as App, b as AppShell, x as AspectRatio, D as AuthProviders, A as Avatar, j as AvatarGroup, N as Badge, F as Banner, ie as BarChart, oe as Breadcrumb, E as Button, ce as ButtonGroup, V as CATEGORY_HEIGHT, H as CHAR_WIDTH, ve as Calendar, le as CalendarDate, be as Card, re as ChartLegend, ke as Checkbox, je as Collapsible, Ie as ColorPicker, Re as Combobox, Ye as CommandPalette, tt as ConfirmDialog, rt as Container, st as ContextMenu, lt as DateField, dt as DatePicker, ft as DateRangePicker, et as Dialog, mt as DonutChart, y as Drawer, ht as DropdownMenu, _t as Editable, yt as EmptyState, xt as FileUpload, St as Form, Tt as FormField, Dt as HoverCard, o as Icon, Ot as Input, gr as IryxUi, Je as Kbd, wt as Label, At as LineChart, Mt as Menubar, Ft as NavigationMenu, Jt as NumberInput, Xt as PageHeader, Qt as Pagination, en as PasswordInput, nn as PinInput, an as Popover, sn as Progress, Z as REVEAL_DURATION, ln as RadioGroup, U as SERIES_SLOTS, dn as ScrollArea, hn as ScrollFade, _n as Select, yn as Separator, wn as Sidebar, On as SignaturePad, An as Skeleton, Mn as Slider, Pn as Sparkline, In as Splitter, Rn as Stat, Bn as Stepper, Hn as Switch, W as TOP_PAD, Kn as Table, Jn as Tabs, Xn as TagsInput, Zn as Textarea, ue as Time, $n as TimeField, tr as Timeline, ar as Toaster, cr as Toggle, lr as ToggleGroup, dr as Toolbar, pr as Tooltip, hr as Tree, i as accordionTheme, It as addDecimals, c as alertTheme, _ as appShellTheme, f as applyTheme, S as authProvidersTheme, O as avatarGroupTheme, k as avatarTheme, M as badgeTheme, P as bannerTheme, te as barChartTheme, ae as breadcrumbTheme, C as buttonGroupContextKey, se as buttonGroupTheme, T as buttonTheme, _e as calendarTheme, ye as cardTheme, G as cartesianLayout, ne as chartLegendTheme, Oe as checkboxTheme, Lt as clampDecimal, K as clampTooltip, p as clearTheme, Ae as collapsibleTheme, Fe as colorPickerTheme, Le as comboboxTheme, He as commandHaystack, Ke as commandPaletteTheme, Rt as compareDecimals, e as componentNames, nt as containerTheme, _r as createIryxUi, ct as dateFieldTheme, ut as datePickerTheme, t as defaultConfig, $e as dialogTheme, pt as donutChartTheme, v as drawerTheme, it as dropdownMenuTheme, gt as editableTheme, vt as emptyStateTheme, I as extent, Me as fieldBase, bt as fileUploadTheme, L as finiteValues, xe as formContextKey, Se as formFieldContextKey, zt as formatDecimal, Bt as formatForLocale, de as formatIsoDate, Ce as getByPath, Un as getRowValue, Tn as hasInk, Et as hoverCardTheme, u as initAppearance, Ne as inputTheme, n as iryxUiConfigKey, ze as isApplePlatform, Ue as isCommandGroup, Vt as isDecimal, a as isIconArray, Nt as isNavigationGroup, at as isSeparator, bn as isSidebarGroup, xn as isSidebarSection, we as isStandardSchema, ot as isSubmenu, fe as isoToday, Te as issuePath, qe as kbdTheme, Ct as labelTheme, kt as lineChartTheme, R as linearScale, Ht as localeSeparators, We as matchesHotkey, jt as menubarTheme, Pt as navigationMenuTheme, z as niceTicks, qt as numberInputTheme, Yt as pageHeaderTheme, Zt as paginationTheme, Ut as parseDecimal, Wt as parseFromLocale, Be as parseHotkey, $t as passwordInputTheme, tn as pinInputTheme, rn as popoverTheme, on as progressTheme, cn as radioGroupTheme, Xe as resolveConfirm, Gt as roundDecimal, un as scrollAreaTheme, fn as scrollFadeMask, mn as scrollFadeTheme, gn as selectTheme, vn as separatorTheme, q as seriesColor, Cn as sidebarTheme, Dn as signaturePadTheme, kn as skeletonTheme, jn as sliderTheme, J as slotOf, Nn as sparklineTheme, Fn as splitterTheme, Ln as statTheme, zn as stepperTheme, En as strokeWidth, Vn as switchTheme, Gn as tableTheme, qn as tabsTheme, Yn as tagsInputTheme, Pe as textareaTheme, m as themes, Qn as timeFieldTheme, er as timelineTheme, pe as toCalendarDate, Ge as toCommandGroups, Kt as toEditable, me as toIsoDate, he as toIsoTime, Sn as toSidebarSections, ge as toTime, ir as toastTheme, or as toggleGroupTheme, sr as toggleTheme, ur as toolbarTheme, Y as tooltipHalfWidth, fr as tooltipTheme, mr as treeTheme, d as useAppearance, Ve as useApplePlatform, w as useButtonGroup, Q as useChartAnimation, $ as useChartProgress, ee as useChartReveal, Ze as useConfirm, Qe as useConfirmState, Wn as useDataTable, g as useElementSize, Ee as useForm, De as useFormField, r as useIryxUiConfig, pn as useScrollEdges, nr as useToast, rr as useToastState, X as warnOnSlotOverflow };
@@ -18,6 +18,11 @@ export declare const checkboxTheme: import("tailwind-variants").TVReturnType<{
18
18
  root: string;
19
19
  };
20
20
  };
21
+ invalid: {
22
+ true: {
23
+ root: string;
24
+ };
25
+ };
21
26
  }, {
22
27
  wrapper: string;
23
28
  root: string;
@@ -45,6 +50,11 @@ export declare const checkboxTheme: import("tailwind-variants").TVReturnType<{
45
50
  root: string;
46
51
  };
47
52
  };
53
+ invalid: {
54
+ true: {
55
+ root: string;
56
+ };
57
+ };
48
58
  }, {
49
59
  wrapper: string;
50
60
  root: string;
@@ -72,6 +82,11 @@ export declare const checkboxTheme: import("tailwind-variants").TVReturnType<{
72
82
  root: string;
73
83
  };
74
84
  };
85
+ invalid: {
86
+ true: {
87
+ root: string;
88
+ };
89
+ };
75
90
  }, {
76
91
  wrapper: string;
77
92
  root: string;
@@ -24,7 +24,8 @@ var t = e({
24
24
  indicator: "[&_svg]:size-3.5"
25
25
  }
26
26
  },
27
- withText: { true: { root: "mt-0.5" } }
27
+ withText: { true: { root: "mt-0.5" } },
28
+ invalid: { true: { root: "border-red-500 focus-visible:ring-red-500/40" } }
28
29
  },
29
30
  compoundVariants: [{
30
31
  size: "lg",
@@ -21,6 +21,11 @@ export declare const radioGroupTheme: import("tailwind-variants").TVReturnType<{
21
21
  root: string;
22
22
  };
23
23
  };
24
+ invalid: {
25
+ true: {
26
+ item: string;
27
+ };
28
+ };
24
29
  }, {
25
30
  root: string;
26
31
  wrapper: string;
@@ -52,6 +57,11 @@ export declare const radioGroupTheme: import("tailwind-variants").TVReturnType<{
52
57
  root: string;
53
58
  };
54
59
  };
60
+ invalid: {
61
+ true: {
62
+ item: string;
63
+ };
64
+ };
55
65
  }, {
56
66
  root: string;
57
67
  wrapper: string;
@@ -83,6 +93,11 @@ export declare const radioGroupTheme: import("tailwind-variants").TVReturnType<{
83
93
  root: string;
84
94
  };
85
95
  };
96
+ invalid: {
97
+ true: {
98
+ item: string;
99
+ };
100
+ };
86
101
  }, {
87
102
  root: string;
88
103
  wrapper: string;