iryx-ui 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,19 @@
1
1
  import type { CheckboxRootProps } from 'reka-ui';
2
2
  import type { ClassValue } from '../class-value';
3
+ import type { IconLike } from '../composables/icon';
3
4
  export interface CheckboxProps extends CheckboxRootProps {
4
5
  /** Text shown beside the box. Also makes the text clickable. */
5
6
  label?: string;
6
7
  /** Secondary text under the label. */
7
8
  description?: string;
9
+ /**
10
+ * How the control is drawn. `checkbox` is a box beside its label, `card`
11
+ * makes the whole bordered surface the control, and `tile` centres an icon
12
+ * above the label.
13
+ */
14
+ variant?: 'checkbox' | 'card' | 'tile';
15
+ /** Shown above the label by the `tile` variant, ignored by the others. */
16
+ icon?: IconLike;
8
17
  size?: 'sm' | 'md' | 'lg';
9
18
  id?: string;
10
19
  /** Mark as failing validation. Taken from the enclosing `IFormField` when omitted. */
@@ -16,21 +25,29 @@ export interface CheckboxProps extends CheckboxRootProps {
16
25
  ui?: {
17
26
  wrapper?: string;
18
27
  root?: string;
28
+ mark?: string;
29
+ icon?: string;
19
30
  indicator?: string;
20
31
  content?: string;
21
32
  label?: string;
22
33
  description?: string;
23
34
  };
24
35
  }
25
- declare var __VLS_13: {}, __VLS_31: {}, __VLS_33: {}, __VLS_48: {};
36
+ declare var __VLS_14: {}, __VLS_31: {}, __VLS_33: {}, __VLS_47: {}, __VLS_65: {}, __VLS_67: {}, __VLS_82: {};
26
37
  type __VLS_Slots = {} & {
27
- default?: (props: typeof __VLS_13) => any;
38
+ default?: (props: typeof __VLS_14) => any;
28
39
  } & {
29
40
  label?: (props: typeof __VLS_31) => any;
30
41
  } & {
31
42
  description?: (props: typeof __VLS_33) => any;
32
43
  } & {
33
- default?: (props: typeof __VLS_48) => any;
44
+ default?: (props: typeof __VLS_47) => any;
45
+ } & {
46
+ label?: (props: typeof __VLS_65) => any;
47
+ } & {
48
+ description?: (props: typeof __VLS_67) => any;
49
+ } & {
50
+ default?: (props: typeof __VLS_82) => any;
34
51
  };
35
52
  declare const __VLS_base: import("vue").DefineComponent<CheckboxProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
36
53
  "update:modelValue": (value: boolean | "indeterminate") => any;
@@ -2,16 +2,18 @@ import { useIryxUiConfig as e } from "../config.js";
2
2
  import t from "./Icon.js";
3
3
  import { useFormField as n } from "../composables/form.js";
4
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";
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 _, useSlots as v, withCtx as y } from "vue";
6
+ import { MinusSignIcon as b, Tick02Icon as x } from "@hugeicons/core-free-icons";
7
+ import { CheckboxIndicator as S, CheckboxRoot as C, Label as w, useForwardPropsEmits as T, useId as E } from "reka-ui";
8
8
  //#region src/components/Checkbox.vue?vue&type=script&setup=true&lang.ts
9
- var E = ["id"], D = /*@__PURE__*/ d({
9
+ var D = ["id"], O = ["id"], k = ["id"], A = /*@__PURE__*/ d({
10
10
  inheritAttrs: !1,
11
11
  __name: "Checkbox",
12
12
  props: {
13
13
  label: {},
14
14
  description: {},
15
+ variant: {},
16
+ icon: {},
15
17
  size: {},
16
18
  id: {},
17
19
  invalid: {
@@ -41,35 +43,80 @@ var E = ["id"], D = /*@__PURE__*/ d({
41
43
  required: { type: Boolean }
42
44
  },
43
45
  emits: ["update:modelValue"],
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", {
46
+ setup(d, { emit: A }) {
47
+ let j = d, M = A, N = T(i(() => {
48
+ let { label: e, description: t, variant: n, icon: r, size: i, id: a, invalid: o, unstyled: s, class: c, ui: l, ...u } = j;
49
+ return u;
50
+ }), M), P = v(), F = E(), I = n(), L = i(() => j.invalid ?? I?.invalid.value ?? !1), R = i(() => j.id ?? I?.id.value ?? F);
51
+ I && (I.id.value = R.value);
52
+ let z = i(() => !!(j.description || P.description)), B = i(() => !!(j.label || P.label || z.value)), V = i(() => z.value ? `${R.value}-description` : void 0), H = e(), U = i(() => j.unstyled ?? H.unstyled), W = i(() => (j.variant ?? "checkbox") !== "checkbox"), G = i(() => r({
53
+ variant: j.variant,
54
+ size: j.size,
55
+ withText: B.value,
56
+ invalid: L.value
57
+ })), K = i(() => U.value ? j.ui?.wrapper : G.value.wrapper({ class: j.ui?.wrapper })), q = i(() => U.value ? [j.ui?.root, j.class] : G.value.root({ class: [j.ui?.root, j.class] })), J = i(() => U.value ? j.ui?.indicator : G.value.indicator({ class: j.ui?.indicator })), Y = i(() => U.value ? j.ui?.content : G.value.content({ class: j.ui?.content })), X = i(() => U.value ? j.ui?.label : G.value.label({ class: j.ui?.label })), Z = i(() => U.value ? j.ui?.description : G.value.description({ class: j.ui?.description })), Q = i(() => U.value ? j.ui?.mark : G.value.mark({ class: j.ui?.mark })), $ = i(() => U.value ? j.ui?.icon : G.value.icon({ class: j.ui?.icon }));
58
+ return (e, n) => W.value ? (m(), a(_(C), f({
56
59
  key: 0,
57
- class: p(z.value)
58
- }, [u(_(S), f({ id: P.value }, {
59
- ..._(A),
60
+ id: R.value
61
+ }, {
62
+ ..._(N),
60
63
  ...e.$attrs
61
64
  }, {
62
- "aria-invalid": N.value || void 0,
63
- "aria-describedby": O.description ? `${P.value}-description` : void 0,
64
- class: B.value
65
+ "aria-invalid": L.value || void 0,
66
+ "aria-labelledby": `${R.value}-label`,
67
+ "aria-describedby": V.value,
68
+ class: [q.value, "group/item"]
65
69
  }), {
66
- default: v(() => [u(_(x), { class: p(V.value) }, {
67
- default: v(() => [h(e.$slots, "default", {}, () => [O.modelValue === "indeterminate" ? (m(), a(t, {
70
+ default: y(() => [j.variant === "card" ? (m(), s("span", {
71
+ key: 0,
72
+ class: p(Q.value)
73
+ }, [u(_(S), { class: p(J.value) }, {
74
+ default: y(() => [h(e.$slots, "default", {}, () => [j.modelValue === "indeterminate" ? (m(), a(t, {
68
75
  key: 0,
69
- icon: _(y)
76
+ icon: _(b)
70
77
  }, null, 8, ["icon"])) : (m(), a(t, {
71
78
  key: 1,
79
+ icon: _(x)
80
+ }, null, 8, ["icon"]))])]),
81
+ _: 3
82
+ }, 8, ["class"])], 2)) : j.icon ? (m(), a(t, {
83
+ key: 1,
84
+ icon: j.icon,
85
+ "data-slot": "icon",
86
+ class: p($.value)
87
+ }, null, 8, ["icon", "class"])) : o("", !0), c("span", { class: p(Y.value) }, [c("span", {
88
+ id: `${R.value}-label`,
89
+ class: p(X.value)
90
+ }, [h(e.$slots, "label", {}, () => [l(g(j.label), 1)])], 10, D), z.value ? (m(), s("span", {
91
+ key: 0,
92
+ id: `${R.value}-description`,
93
+ class: p(Z.value)
94
+ }, [h(e.$slots, "description", {}, () => [l(g(j.description), 1)])], 10, O)) : o("", !0)], 2)]),
95
+ _: 3
96
+ }, 16, [
97
+ "id",
98
+ "aria-invalid",
99
+ "aria-labelledby",
100
+ "aria-describedby",
101
+ "class"
102
+ ])) : B.value ? (m(), s("div", {
103
+ key: 1,
104
+ class: p(K.value)
105
+ }, [u(_(C), f({ id: R.value }, {
106
+ ..._(N),
107
+ ...e.$attrs
108
+ }, {
109
+ "aria-invalid": L.value || void 0,
110
+ "aria-describedby": V.value,
111
+ class: q.value
112
+ }), {
113
+ default: y(() => [u(_(S), { class: p(J.value) }, {
114
+ default: y(() => [h(e.$slots, "default", {}, () => [j.modelValue === "indeterminate" ? (m(), a(t, {
115
+ key: 0,
72
116
  icon: _(b)
117
+ }, null, 8, ["icon"])) : (m(), a(t, {
118
+ key: 1,
119
+ icon: _(x)
73
120
  }, null, 8, ["icon"]))])]),
74
121
  _: 3
75
122
  }, 8, ["class"])]),
@@ -79,33 +126,33 @@ var E = ["id"], D = /*@__PURE__*/ d({
79
126
  "aria-invalid",
80
127
  "aria-describedby",
81
128
  "class"
82
- ]), c("div", { class: p(H.value) }, [u(_(C), {
83
- for: P.value,
84
- class: p(U.value)
129
+ ]), c("div", { class: p(Y.value) }, [u(_(w), {
130
+ for: R.value,
131
+ class: p(X.value)
85
132
  }, {
86
- default: v(() => [h(e.$slots, "label", {}, () => [l(g(O.label), 1)])]),
133
+ default: y(() => [h(e.$slots, "label", {}, () => [l(g(j.label), 1)])]),
87
134
  _: 3
88
- }, 8, ["for", "class"]), O.description || e.$slots.description ? (m(), s("p", {
135
+ }, 8, ["for", "class"]), z.value ? (m(), s("p", {
89
136
  key: 0,
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({
93
- key: 1,
94
- id: P.value
137
+ id: `${R.value}-description`,
138
+ class: p(Z.value)
139
+ }, [h(e.$slots, "description", {}, () => [l(g(j.description), 1)])], 10, k)) : o("", !0)], 2)], 2)) : (m(), a(_(C), f({
140
+ key: 2,
141
+ id: R.value
95
142
  }, {
96
- ..._(A),
143
+ ..._(N),
97
144
  ...e.$attrs
98
145
  }, {
99
- "aria-invalid": N.value || void 0,
100
- class: B.value
146
+ "aria-invalid": L.value || void 0,
147
+ class: q.value
101
148
  }), {
102
- default: v(() => [u(_(x), { class: p(V.value) }, {
103
- default: v(() => [h(e.$slots, "default", {}, () => [O.modelValue === "indeterminate" ? (m(), a(t, {
149
+ default: y(() => [u(_(S), { class: p(J.value) }, {
150
+ default: y(() => [h(e.$slots, "default", {}, () => [j.modelValue === "indeterminate" ? (m(), a(t, {
104
151
  key: 0,
105
- icon: _(y)
152
+ icon: _(b)
106
153
  }, null, 8, ["icon"])) : (m(), a(t, {
107
154
  key: 1,
108
- icon: _(b)
155
+ icon: _(x)
109
156
  }, null, 8, ["icon"]))])]),
110
157
  _: 3
111
158
  }, 8, ["class"])]),
@@ -118,4 +165,4 @@ var E = ["id"], D = /*@__PURE__*/ d({
118
165
  }
119
166
  });
120
167
  //#endregion
121
- export { D as default };
168
+ export { A as default };
@@ -11,6 +11,18 @@ export interface ProgressProps {
11
11
  /** Current value. `null` (or `indeterminate`) means unknown duration. */
12
12
  modelValue?: number | null;
13
13
  max?: number;
14
+ /**
15
+ * `linear` is a bar, `circle` a ring with the value in the middle. A ring
16
+ * ignores `segments` — a broken-up ring is a donut chart, and `IDonutChart`
17
+ * is the component for that.
18
+ */
19
+ shape?: 'linear' | 'circle';
20
+ /**
21
+ * How many degrees of the ring the track covers — `180` is a half circle,
22
+ * `270` a gauge. The arc is centred at the top, so the gap sits at the
23
+ * bottom. Circles only, and ignored by the bar.
24
+ */
25
+ angle?: number;
14
26
  variant?: ProgressVariant;
15
27
  /**
16
28
  * Break the bar into runs that share one track — storage by file type, a
@@ -46,17 +58,31 @@ export interface ProgressProps {
46
58
  legendItem?: string;
47
59
  legendSwatch?: string;
48
60
  legendValue?: string;
61
+ ring?: string;
62
+ ringTrack?: string;
63
+ ringIndicator?: string;
64
+ ringContent?: string;
65
+ ringValue?: string;
66
+ ringLabel?: string;
49
67
  };
50
68
  }
51
- declare var __VLS_1: {}, __VLS_3: {
69
+ declare var __VLS_13: {
70
+ value: number | null;
71
+ percent: number;
72
+ formatted: string;
73
+ }, __VLS_15: {}, __VLS_17: {}, __VLS_19: {
52
74
  value: number | null;
53
75
  percent: number;
54
76
  formatted: string;
55
77
  };
56
78
  type __VLS_Slots = {} & {
57
- label?: (props: typeof __VLS_1) => any;
79
+ value?: (props: typeof __VLS_13) => any;
80
+ } & {
81
+ label?: (props: typeof __VLS_15) => any;
82
+ } & {
83
+ label?: (props: typeof __VLS_17) => any;
58
84
  } & {
59
- value?: (props: typeof __VLS_3) => any;
85
+ value?: (props: typeof __VLS_19) => any;
60
86
  };
61
87
  declare const __VLS_base: import("vue").DefineComponent<ProgressProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ProgressProps> & Readonly<{}>, {
62
88
  unstyled: boolean;
@@ -1,17 +1,19 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
2
  import { progressTheme as t } from "../theme/progress.js";
3
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, normalizeStyle as p, openBlock as m, renderList as h, renderSlot as g, toDisplayString as _, unref as v, useSlots as y, withCtx as b } from "vue";
4
- import { ProgressIndicator as x, ProgressRoot as S, useId as C } from "reka-ui";
4
+ import { ProgressIndicator as x, ProgressRoot as S, useId as ee } from "reka-ui";
5
5
  //#region src/components/Progress.vue?vue&type=script&setup=true&lang.ts
6
- var w = ["id"], T = {
6
+ var C = ["transform"], w = ["stroke-linecap", "stroke-dasharray"], T = ["stroke-dasharray"], te = ["id"], E = ["id"], ne = {
7
7
  key: 0,
8
8
  class: "flex h-full w-full"
9
- }, E = /*@__PURE__*/ u({
9
+ }, D = 8, O = /*@__PURE__*/ u({
10
10
  inheritAttrs: !1,
11
11
  __name: "Progress",
12
12
  props: {
13
13
  modelValue: {},
14
14
  max: { default: 100 },
15
+ shape: {},
16
+ angle: {},
15
17
  variant: {},
16
18
  segments: {},
17
19
  size: {},
@@ -32,60 +34,114 @@ var w = ["id"], T = {
32
34
  ui: {}
33
35
  },
34
36
  setup(u) {
35
- let E = u, D = y(), O = C(), k = r(() => !!(E.label || D.label)), A = r(() => (E.segments?.length ?? 0) > 0), j = r(() => !A.value && (E.indeterminate || E.modelValue == null)), M = r(() => {
37
+ let O = u, re = y(), k = ee(), A = r(() => !!(O.label || re.label)), j = r(() => O.shape === "circle"), M = r(() => !j.value && (O.segments?.length ?? 0) > 0), N = r(() => !M.value && (O.indeterminate || O.modelValue == null)), P = r(() => {
36
38
  let e = 0;
37
- return (E.segments ?? []).map((t) => {
38
- let n = Math.max(t.value, 0), r = Math.max(E.max - e, 0), i = Math.min(n, r);
39
+ return (O.segments ?? []).map((t) => {
40
+ let n = Math.max(t.value, 0), r = Math.max(O.max - e, 0), i = Math.min(n, r);
39
41
  return e += i, {
40
42
  ...t,
41
43
  value: n,
42
- percent: E.max > 0 ? i / E.max * 100 : 0
44
+ percent: O.max > 0 ? i / O.max * 100 : 0
43
45
  };
44
46
  });
45
- }), N = r(() => M.value.reduce((e, t) => e + t.value, 0)), P = r(() => M.value.filter((e) => e.label)), F = r(() => j.value ? null : A.value ? Math.min(N.value, E.max) : Math.min(Math.max(E.modelValue ?? 0, 0), E.max)), I = r(() => F.value == null ? 0 : F.value / E.max * 100), L = r(() => {
46
- if (F.value != null) return E.formatValue ? E.formatValue(F.value, E.max) : `${Math.round(I.value)}%`;
47
- }), R = r(() => !!(E.label || E.showValue && L.value)), z = e(), B = r(() => E.unstyled ?? z.unstyled), V = r(() => t({
48
- variant: E.variant,
49
- size: E.size,
50
- indeterminate: j.value
51
- })), H = r(() => B.value ? [E.ui?.root, E.class] : V.value.root({ class: [E.ui?.root, E.class] })), U = r(() => B.value ? E.ui?.header : V.value.header({ class: E.ui?.header })), W = r(() => B.value ? E.ui?.label : V.value.label({ class: E.ui?.label })), G = r(() => B.value ? E.ui?.value : V.value.value({ class: E.ui?.value })), K = r(() => B.value ? E.ui?.track : V.value.track({ class: E.ui?.track })), q = r(() => B.value ? E.ui?.indicator : V.value.indicator({ class: E.ui?.indicator })), J = r(() => B.value ? E.ui?.legend : V.value.legend({ class: E.ui?.legend })), Y = r(() => B.value ? E.ui?.legendItem : V.value.legendItem({ class: E.ui?.legendItem })), X = r(() => B.value ? E.ui?.legendValue : V.value.legendValue({ class: E.ui?.legendValue }));
52
- function Z(e) {
53
- return B.value ? E.ui?.segment : t({ variant: e ?? "neutral" }).segment({ class: E.ui?.segment });
47
+ }), F = r(() => P.value.reduce((e, t) => e + t.value, 0)), I = r(() => P.value.filter((e) => e.label)), L = r(() => N.value ? null : M.value ? Math.min(F.value, O.max) : Math.min(Math.max(O.modelValue ?? 0, 0), O.max)), R = r(() => L.value == null ? 0 : L.value / O.max * 100), z = r(() => {
48
+ if (L.value != null) return O.formatValue ? O.formatValue(L.value, O.max) : `${Math.round(R.value)}%`;
49
+ }), B = r(() => !!(O.label || O.showValue && z.value)), V = e(), H = r(() => O.unstyled ?? V.unstyled), U = r(() => t({
50
+ shape: O.shape,
51
+ variant: O.variant,
52
+ size: O.size,
53
+ indeterminate: N.value
54
+ })), W = r(() => H.value ? [O.ui?.root, O.class] : U.value.root({ class: [O.ui?.root, O.class] })), G = r(() => H.value ? O.ui?.header : U.value.header({ class: O.ui?.header })), K = r(() => H.value ? O.ui?.label : U.value.label({ class: O.ui?.label })), q = r(() => H.value ? O.ui?.value : U.value.value({ class: O.ui?.value })), J = r(() => H.value ? O.ui?.track : U.value.track({ class: O.ui?.track })), Y = r(() => H.value ? O.ui?.indicator : U.value.indicator({ class: O.ui?.indicator })), ie = r(() => H.value ? O.ui?.ring : U.value.ring({ class: O.ui?.ring })), ae = r(() => H.value ? O.ui?.ringTrack : U.value.ringTrack({ class: O.ui?.ringTrack })), oe = r(() => H.value ? O.ui?.ringIndicator : U.value.ringIndicator({ class: O.ui?.ringIndicator })), se = r(() => H.value ? O.ui?.ringContent : U.value.ringContent({ class: O.ui?.ringContent })), ce = r(() => H.value ? O.ui?.ringValue : U.value.ringValue({ class: O.ui?.ringValue })), le = r(() => H.value ? O.ui?.ringLabel : U.value.ringLabel({ class: O.ui?.ringLabel })), ue = r(() => H.value ? O.ui?.legend : U.value.legend({ class: O.ui?.legend })), de = r(() => H.value ? O.ui?.legendItem : U.value.legendItem({ class: O.ui?.legendItem })), fe = r(() => H.value ? O.ui?.legendValue : U.value.legendValue({ class: O.ui?.legendValue }));
55
+ function pe(e) {
56
+ return H.value ? O.ui?.segment : t({ variant: e ?? "neutral" }).segment({ class: O.ui?.segment });
54
57
  }
55
- function Q(e) {
56
- return B.value ? E.ui?.legendSwatch : t({ variant: e ?? "neutral" }).legendSwatch({ class: E.ui?.legendSwatch });
58
+ function me(e) {
59
+ return H.value ? O.ui?.legendSwatch : t({ variant: e ?? "neutral" }).legendSwatch({ class: O.ui?.legendSwatch });
57
60
  }
58
- let $ = r(() => j.value ? void 0 : { transform: `translateX(-${100 - I.value}%)` });
59
- return (e, t) => (m(), o("div", { class: f(H.value) }, [
60
- R.value ? (m(), o("div", {
61
+ let X = (100 - D) / 2, Z = 2 * Math.PI * X, Q = r(() => Math.min(Math.max(O.angle ?? 360, 1), 360)), $ = r(() => Z * (Q.value / 360)), he = r(() => Q.value === 360 ? -90 : -(90 + Q.value / 2)), ge = r(() => `${N.value ? $.value * .25 : $.value * (R.value / 100)} ${Z}`), _e = r(() => `${$.value} ${Z}`), ve = r(() => N.value ? void 0 : { transform: `translateX(-${100 - R.value}%)` });
62
+ return (e, t) => j.value ? (m(), o("div", {
63
+ key: 0,
64
+ class: f(W.value)
65
+ }, [l(v(S), d({
66
+ "model-value": L.value,
67
+ max: O.max,
68
+ "get-value-label": () => z.value ?? "",
69
+ "aria-labelledby": A.value ? v(k) : void 0
70
+ }, e.$attrs, { "as-child": "" }), {
71
+ default: b(() => [(m(), o("svg", {
72
+ class: f(ie.value),
73
+ viewBox: "0 0 100 100",
74
+ "aria-hidden": "true"
75
+ }, [s("g", { transform: `rotate(${he.value} 50 50)` }, [s("circle", {
76
+ class: f(ae.value),
77
+ cx: "50",
78
+ cy: "50",
79
+ r: X,
80
+ "stroke-width": D,
81
+ "stroke-linecap": Q.value === 360 ? void 0 : "round",
82
+ "stroke-dasharray": _e.value
83
+ }, null, 10, w), l(v(x), { "as-child": "" }, {
84
+ default: b(() => [s("circle", {
85
+ class: f(oe.value),
86
+ cx: "50",
87
+ cy: "50",
88
+ r: X,
89
+ "stroke-width": D,
90
+ "stroke-linecap": "round",
91
+ "stroke-dasharray": ge.value
92
+ }, null, 10, T)]),
93
+ _: 1
94
+ })], 8, C)], 2))]),
95
+ _: 1
96
+ }, 16, [
97
+ "model-value",
98
+ "max",
99
+ "get-value-label",
100
+ "aria-labelledby"
101
+ ]), s("div", { class: f(se.value) }, [O.showValue && z.value ? (m(), o("span", {
102
+ key: 0,
103
+ class: f(ce.value)
104
+ }, [g(e.$slots, "value", {
105
+ value: L.value,
106
+ percent: R.value,
107
+ formatted: z.value
108
+ }, () => [c(_(z.value), 1)])], 2)) : a("", !0), A.value ? (m(), o("span", {
109
+ key: 1,
110
+ id: v(k),
111
+ class: f(le.value)
112
+ }, [g(e.$slots, "label", {}, () => [c(_(O.label), 1)])], 10, te)) : a("", !0)], 2)], 2)) : (m(), o("div", {
113
+ key: 1,
114
+ class: f(W.value)
115
+ }, [
116
+ B.value ? (m(), o("div", {
61
117
  key: 0,
62
- class: f(U.value)
63
- }, [k.value ? (m(), o("span", {
118
+ class: f(G.value)
119
+ }, [A.value ? (m(), o("span", {
64
120
  key: 0,
65
- id: v(O),
66
- class: f(W.value)
67
- }, [g(e.$slots, "label", {}, () => [c(_(E.label), 1)])], 10, w)) : a("", !0), E.showValue && L.value ? (m(), o("span", {
121
+ id: v(k),
122
+ class: f(K.value)
123
+ }, [g(e.$slots, "label", {}, () => [c(_(O.label), 1)])], 10, E)) : a("", !0), O.showValue && z.value ? (m(), o("span", {
68
124
  key: 1,
69
- class: f(G.value)
125
+ class: f(q.value)
70
126
  }, [g(e.$slots, "value", {
71
- value: F.value,
72
- percent: I.value,
73
- formatted: L.value
74
- }, () => [c(_(L.value), 1)])], 2)) : a("", !0)], 2)) : a("", !0),
127
+ value: L.value,
128
+ percent: R.value,
129
+ formatted: z.value
130
+ }, () => [c(_(z.value), 1)])], 2)) : a("", !0)], 2)) : a("", !0),
75
131
  l(v(S), d({
76
- "model-value": F.value,
77
- max: E.max,
78
- "get-value-label": () => L.value ?? "",
79
- "aria-labelledby": k.value ? v(O) : void 0
80
- }, e.$attrs, { class: K.value }), {
81
- default: b(() => [A.value ? (m(), o("div", T, [(m(!0), o(n, null, h(M.value, (e, t) => (m(), o("div", {
132
+ "model-value": L.value,
133
+ max: O.max,
134
+ "get-value-label": () => z.value ?? "",
135
+ "aria-labelledby": A.value ? v(k) : void 0
136
+ }, e.$attrs, { class: J.value }), {
137
+ default: b(() => [M.value ? (m(), o("div", ne, [(m(!0), o(n, null, h(P.value, (e, t) => (m(), o("div", {
82
138
  key: e.label ?? t,
83
- class: f(Z(e.variant)),
139
+ class: f(pe(e.variant)),
84
140
  style: p({ width: `${e.percent}%` })
85
141
  }, null, 6))), 128))])) : (m(), i(v(x), {
86
142
  key: 1,
87
- class: f(q.value),
88
- style: p($.value)
143
+ class: f(Y.value),
144
+ style: p(ve.value)
89
145
  }, null, 8, ["class", "style"]))]),
90
146
  _: 1
91
147
  }, 16, [
@@ -95,19 +151,19 @@ var w = ["id"], T = {
95
151
  "aria-labelledby",
96
152
  "class"
97
153
  ]),
98
- P.value.length ? (m(), o("ul", {
154
+ I.value.length ? (m(), o("ul", {
99
155
  key: 1,
100
- class: f(J.value)
101
- }, [(m(!0), o(n, null, h(P.value, (e, t) => (m(), o("li", {
156
+ class: f(ue.value)
157
+ }, [(m(!0), o(n, null, h(I.value, (e, t) => (m(), o("li", {
102
158
  key: e.label ?? t,
103
- class: f(Y.value)
159
+ class: f(de.value)
104
160
  }, [
105
- s("span", { class: f(Q(e.variant)) }, null, 2),
161
+ s("span", { class: f(me(e.variant)) }, null, 2),
106
162
  s("span", null, _(e.label), 1),
107
- s("span", { class: f(X.value) }, _(E.formatValue ? E.formatValue(e.value, E.max) : `${Math.round(e.value / E.max * 100)}%`), 3)
163
+ s("span", { class: f(fe.value) }, _(O.formatValue ? O.formatValue(e.value, O.max) : `${Math.round(e.value / O.max * 100)}%`), 3)
108
164
  ], 2))), 128))], 2)) : a("", !0)
109
165
  ], 2));
110
166
  }
111
167
  });
112
168
  //#endregion
113
- export { E as default };
169
+ export { O as default };
@@ -1,15 +1,24 @@
1
1
  import type { RadioGroupRootProps } from 'reka-ui';
2
2
  import type { ClassValue } from '../class-value';
3
+ import type { IconLike } from '../composables/icon';
3
4
  export interface RadioGroupItemOption {
4
5
  label: string;
5
6
  value: string;
6
7
  /** Secondary text under the label. */
7
8
  description?: string;
9
+ /** Shown above the label by the `tile` variant, ignored by the others. */
10
+ icon?: IconLike;
8
11
  disabled?: boolean;
9
12
  }
10
13
  export interface RadioGroupProps extends RadioGroupRootProps {
11
14
  /** Options to render. Strings are expanded to `{ label, value }`. */
12
15
  items?: (RadioGroupItemOption | string)[];
16
+ /**
17
+ * How each option is drawn. `radio` is a circle beside its label, `card`
18
+ * makes the whole bordered surface the control, and `tile` centres an icon
19
+ * above the label.
20
+ */
21
+ variant?: 'radio' | 'card' | 'tile';
13
22
  size?: 'sm' | 'md' | 'lg';
14
23
  /** Mark as failing validation. Taken from the enclosing `IFormField` when omitted. */
15
24
  invalid?: boolean;
@@ -19,6 +28,9 @@ export interface RadioGroupProps extends RadioGroupRootProps {
19
28
  ui?: {
20
29
  root?: string;
21
30
  item?: string;
31
+ mark?: string;
32
+ icon?: string;
33
+ content?: string;
22
34
  label?: string;
23
35
  description?: string;
24
36
  };