iryx-ui 0.18.2 → 0.18.4

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 (37) hide show
  1. package/dist/components/Checkbox.vue.d.ts +3 -0
  2. package/dist/components/Checkbox.vue_vue_type_script_setup_true_lang.js +59 -42
  3. package/dist/components/Combobox.vue_vue_type_script_setup_true_lang.js +3 -1
  4. package/dist/components/CommandPalette.vue_vue_type_script_setup_true_lang.js +2 -1
  5. package/dist/components/DateField.vue_vue_type_script_setup_true_lang.js +3 -1
  6. package/dist/components/DatePicker.vue_vue_type_script_setup_true_lang.js +3 -1
  7. package/dist/components/DateRangePicker.vue_vue_type_script_setup_true_lang.js +65 -63
  8. package/dist/components/Editable.vue_vue_type_script_setup_true_lang.js +7 -2
  9. package/dist/components/FileUpload.vue_vue_type_script_setup_true_lang.js +3 -1
  10. package/dist/components/FormField.vue_vue_type_script_setup_true_lang.js +50 -47
  11. package/dist/components/Input.vue_vue_type_script_setup_true_lang.js +6 -4
  12. package/dist/components/NumberInput.vue_vue_type_script_setup_true_lang.js +3 -1
  13. package/dist/components/PinInput.vue.d.ts +1 -0
  14. package/dist/components/PinInput.vue_vue_type_script_setup_true_lang.js +40 -32
  15. package/dist/components/RadioGroup.vue.d.ts +3 -0
  16. package/dist/components/RadioGroup.vue_vue_type_script_setup_true_lang.js +49 -31
  17. package/dist/components/Select.vue.d.ts +3 -0
  18. package/dist/components/Select.vue_vue_type_script_setup_true_lang.js +65 -46
  19. package/dist/components/SignaturePad.vue_vue_type_script_setup_true_lang.js +3 -1
  20. package/dist/components/Slider.vue_vue_type_script_setup_true_lang.js +58 -53
  21. package/dist/components/Switch.vue.d.ts +3 -0
  22. package/dist/components/Switch.vue_vue_type_script_setup_true_lang.js +50 -33
  23. package/dist/components/TagsInput.vue_vue_type_script_setup_true_lang.js +3 -1
  24. package/dist/components/Textarea.vue_vue_type_script_setup_true_lang.js +5 -3
  25. package/dist/components/TimeField.vue_vue_type_script_setup_true_lang.js +3 -1
  26. package/dist/composables/form.d.ts +8 -1
  27. package/dist/index.js +9 -9
  28. package/dist/theme/checkbox.d.ts +15 -0
  29. package/dist/theme/checkbox.js +2 -1
  30. package/dist/theme/radio-group.d.ts +15 -0
  31. package/dist/theme/radio-group.js +2 -1
  32. package/dist/theme/select.d.ts +15 -0
  33. package/dist/theme/select.js +8 -5
  34. package/dist/theme/switch.d.ts +15 -0
  35. package/dist/theme/switch.js +2 -1
  36. package/dist/theme/timeline.js +5 -5
  37. package/package.json +1 -1
@@ -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,9 @@ 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);
59
+ j && D.id && (j.id.value = D.id);
60
+ let N = i(() => D.invalid ?? j?.invalid.value ?? !1), P = e(), F = i(() => D.unstyled ?? P.unstyled), I = g(k.value), L;
59
61
  function R() {
60
62
  L !== void 0 && (clearTimeout(L), L = void 0);
61
63
  }
@@ -81,7 +83,7 @@ var T = [
81
83
  R(), I.value = "", k.value = "", V.value?.focus();
82
84
  }
83
85
  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({
86
+ 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
87
  size: D.size,
86
88
  invalid: N.value
87
89
  }));
@@ -57,7 +57,9 @@ var M = [
57
57
  }),
58
58
  emits: ["update:modelValue"],
59
59
  setup(_) {
60
- let v = _, F = w(_, "modelValue"), I = n(), L = f(() => v.id ?? I?.id.value), R = f(() => v.invalid ?? I?.invalid.value ?? !1), z = e(), B = f(() => v.unstyled ?? z.unstyled), V = S(""), H = S(!1);
60
+ let v = _, F = w(_, "modelValue"), I = n(), L = f(() => v.id ?? I?.id.value);
61
+ I && v.id && (I.id.value = v.id);
62
+ let R = f(() => v.invalid ?? I?.invalid.value ?? !1), z = e(), B = f(() => v.unstyled ?? z.unstyled), V = S(""), H = S(!1);
61
63
  function U(e) {
62
64
  return e ? v.locale ? o(e, v.locale, v.precision) : v.precision == null ? e : l(e, v.precision) ?? e : "";
63
65
  }
@@ -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;
@@ -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 };
@@ -54,7 +54,9 @@ var x = [
54
54
  "clear"
55
55
  ],
56
56
  setup(d, { expose: w, emit: T }) {
57
- let E = d, D = T, O = _(), k = _([]), A = !1, j = 0, M = () => k.value.at(-1), N = r(), P = s(() => E.id ?? N?.id.value), F = s(() => E.invalid ?? N?.invalid.value ?? !1), I = s(() => !i(k.value));
57
+ let E = d, D = T, O = _(), k = _([]), A = !1, j = 0, M = () => k.value.at(-1), N = r(), P = s(() => E.id ?? N?.id.value);
58
+ N && E.id && (N.id.value = E.id);
59
+ let F = s(() => E.invalid ?? N?.invalid.value ?? !1), I = s(() => !i(k.value));
58
60
  function L() {
59
61
  if (E.penColor !== "currentColor") return E.penColor;
60
62
  let e = O.value;