iryx-ui 0.27.0 → 0.29.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.
@@ -8,12 +8,12 @@ import { Fragment as c, computed as l, createBlock as u, createCommentVNode as d
8
8
  import { ArrowRight01Icon as k } from "@hugeicons/core-free-icons";
9
9
  import { CollapsibleContent as A, CollapsibleRoot as j, CollapsibleTrigger as M, Primitive as N } from "reka-ui";
10
10
  //#region src/components/Sidebar.vue?vue&type=script&setup=true&lang.ts
11
- var P = [
11
+ var P = ["data-pinned"], F = [
12
12
  "aria-label",
13
13
  "disabled",
14
14
  "data-active",
15
15
  "data-disabled"
16
- ], F = /*@__PURE__*/ g({
16
+ ], I = /*@__PURE__*/ g({
17
17
  __name: "Sidebar",
18
18
  props: /*@__PURE__*/ v({
19
19
  items: {},
@@ -39,17 +39,17 @@ var P = [
39
39
  }),
40
40
  emits: ["update:collapsed"],
41
41
  setup(g) {
42
- let v = g, F = D(g, "collapsed"), I = _(r, void 0), L = l(() => F.value && I !== "drawer"), R = e(), z = l(() => v.unstyled ?? R.unstyled), B = l(() => i(v.items)), V = l(() => s({
42
+ let v = g, I = D(g, "collapsed"), L = _(r, void 0), R = l(() => I.value && L !== "drawer"), z = e(), B = l(() => v.unstyled ?? z.unstyled), V = l(() => i(v.items)), H = l(() => V.value.findIndex((e) => e.pinned)), U = l(() => s({
43
43
  side: v.side,
44
- collapsed: L.value,
45
- inShell: I !== void 0
44
+ collapsed: R.value,
45
+ inShell: L !== void 0
46
46
  }));
47
- function H(e) {
47
+ function W(e) {
48
48
  let t = v.ui?.[e];
49
- return z.value ? t : V.value[e]({ class: t });
49
+ return B.value ? t : U.value[e]({ class: t });
50
50
  }
51
- let U = l(() => v.side === "right" ? "left" : "right"), W = x({}), G = (e, t) => `${e}:${t.label}`, K = (e) => e.href ? "a" : "button", q = (e) => [...e.label][0], J = (e) => e.badge === void 0 ? e.label : `${e.label} (${e.badge})`;
52
- function Y(e) {
51
+ let G = l(() => v.side === "right" ? "left" : "right"), K = x({}), q = (e, t) => `${e}:${t.label}`, J = (e) => e.href ? "a" : "button", Y = (e) => [...e.label][0], X = (e) => e.badge === void 0 ? e.label : `${e.label} (${e.badge})`;
52
+ function Z(e) {
53
53
  return (e.items ?? []).map((e) => ({
54
54
  label: e.label,
55
55
  icon: e.icon,
@@ -58,66 +58,69 @@ var P = [
58
58
  onSelect: e.onSelect
59
59
  }));
60
60
  }
61
- function X(e, t) {
61
+ function Q(e, t) {
62
62
  if (e.disabled) {
63
63
  t.preventDefault();
64
64
  return;
65
65
  }
66
66
  e.onSelect?.();
67
67
  }
68
- let Z = (e) => e.label;
68
+ let $ = (e) => e.label;
69
69
  return (e, r) => (b(), u(E(N), {
70
70
  as: "nav",
71
71
  "aria-label": v.label,
72
- "data-collapsed": L.value ? "" : void 0,
73
- class: y(z.value ? [v.ui?.root, v.class] : V.value.root({ class: [v.ui?.root, v.class] }))
72
+ "data-collapsed": R.value ? "" : void 0,
73
+ class: y(B.value ? [v.ui?.root, v.class] : U.value.root({ class: [v.ui?.root, v.class] }))
74
74
  }, {
75
75
  default: O(() => [
76
76
  e.$slots.header ? (b(), f("div", {
77
77
  key: 0,
78
- class: y(H("header"))
79
- }, [C(e.$slots, "header", { collapsed: L.value })], 2)) : d("", !0),
80
- p("div", { class: y(H("nav")) }, [C(e.$slots, "default", { collapsed: L.value }, () => [(b(!0), f(c, null, S(B.value, (r, i) => (b(), f("div", {
78
+ class: y(W("header"))
79
+ }, [C(e.$slots, "header", { collapsed: R.value })], 2)) : d("", !0),
80
+ p("div", { class: y(W("nav")) }, [C(e.$slots, "default", { collapsed: R.value }, () => [(b(!0), f(c, null, S(V.value, (r, i) => (b(), f("div", {
81
81
  key: r.section || i,
82
- class: y(H("section"))
82
+ "data-pinned": r.pinned ? "" : void 0,
83
+ class: y([W("section"), i === H.value && "mt-auto"])
83
84
  }, [r.section ? (b(), f("p", {
84
85
  key: 0,
85
- class: y(H("sectionLabel"))
86
- }, T(r.section), 3)) : d("", !0), (b(!0), f(c, null, S(r.items, (r) => (b(), f(c, { key: r.label }, [E(n)(r) && L.value ? (b(), u(a, {
86
+ class: y(W("sectionLabel"))
87
+ }, T(r.section), 3)) : d("", !0), (b(!0), f(c, null, S(r.items, (r) => (b(), f(c, { key: r.label }, [E(n)(r) && R.value ? (b(), u(a, {
87
88
  key: 0,
88
- text: J(r),
89
- side: U.value,
90
- unstyled: z.value
89
+ text: X(r),
90
+ side: G.value,
91
+ unstyled: B.value
91
92
  }, {
92
93
  trigger: O(() => [h(o, {
93
- items: Y(r),
94
- side: U.value,
95
- unstyled: z.value
94
+ items: Z(r),
95
+ side: G.value,
96
+ unstyled: B.value,
97
+ ui: v.ui?.menu
96
98
  }, {
97
99
  trigger: O(() => [p("button", {
98
100
  type: "button",
99
- "aria-label": Z(r),
101
+ "aria-label": $(r),
100
102
  disabled: r.disabled,
101
103
  "data-active": r.active ? "" : void 0,
102
104
  "data-disabled": r.disabled ? "" : void 0,
103
- class: y(H("link"))
105
+ class: y(W("link"))
104
106
  }, [C(e.$slots, "link", {
105
107
  link: r,
106
- collapsed: L.value
108
+ collapsed: R.value
107
109
  }, () => [r.icon ? (b(), u(t, {
108
110
  key: 0,
109
111
  icon: r.icon
110
112
  }, null, 8, ["icon"])) : (b(), f("span", {
111
113
  key: 1,
112
114
  "aria-hidden": "true",
113
- class: y(H("linkInitial"))
114
- }, T(q(r)), 3))])], 10, P)]),
115
+ class: y(W("linkInitial"))
116
+ }, T(Y(r)), 3))])], 10, F)]),
115
117
  header: O(() => [m(T(r.label), 1)]),
116
118
  _: 2
117
119
  }, 1032, [
118
120
  "items",
119
121
  "side",
120
- "unstyled"
122
+ "unstyled",
123
+ "ui"
121
124
  ])]),
122
125
  _: 2
123
126
  }, 1032, [
@@ -126,25 +129,25 @@ var P = [
126
129
  "unstyled"
127
130
  ])) : E(n)(r) ? (b(), u(E(j), {
128
131
  key: 1,
129
- open: W.value[G(i, r)] ?? r.defaultOpen ?? !1,
132
+ open: K.value[q(i, r)] ?? r.defaultOpen ?? !1,
130
133
  disabled: r.disabled,
131
- "onUpdate:open": (e) => W.value[G(i, r)] = e
134
+ "onUpdate:open": (e) => K.value[q(i, r)] = e
132
135
  }, {
133
136
  default: O(() => [h(E(M), {
134
- "aria-label": Z(r),
137
+ "aria-label": $(r),
135
138
  "data-active": r.active ? "" : void 0,
136
139
  "data-disabled": r.disabled ? "" : void 0,
137
- class: y(H("link"))
140
+ class: y(W("link"))
138
141
  }, {
139
142
  default: O(() => [
140
143
  r.icon ? (b(), u(t, {
141
144
  key: 0,
142
145
  icon: r.icon
143
146
  }, null, 8, ["icon"])) : d("", !0),
144
- p("span", { class: y(H("linkLabel")) }, T(r.label), 3),
147
+ p("span", { class: y(W("linkLabel")) }, T(r.label), 3),
145
148
  h(t, {
146
149
  icon: E(k),
147
- class: y(H("groupIcon"))
150
+ class: y(W("groupIcon"))
148
151
  }, null, 8, ["icon", "class"])
149
152
  ]),
150
153
  _: 2
@@ -153,28 +156,28 @@ var P = [
153
156
  "data-active",
154
157
  "data-disabled",
155
158
  "class"
156
- ]), h(E(A), { class: y(H("groupContent")) }, {
157
- default: O(() => [p("div", { class: y(H("groupInner")) }, [(b(!0), f(c, null, S(r.items, (e) => (b(), u(w(K(e)), {
159
+ ]), h(E(A), { class: y(W("groupContent")) }, {
160
+ default: O(() => [p("div", { class: y(W("groupInner")) }, [(b(!0), f(c, null, S(r.items, (e) => (b(), u(w(J(e)), {
158
161
  key: e.label,
159
162
  href: e.href,
160
163
  type: e.href ? void 0 : "button",
161
- "aria-label": Z(e),
164
+ "aria-label": $(e),
162
165
  "aria-current": e.active ? "page" : void 0,
163
166
  "aria-disabled": e.disabled || void 0,
164
167
  "data-active": e.active ? "" : void 0,
165
168
  "data-disabled": e.disabled ? "" : void 0,
166
- class: y(H("link")),
167
- onClick: (t) => X(e, t)
169
+ class: y(W("link")),
170
+ onClick: (t) => Q(e, t)
168
171
  }, {
169
172
  default: O(() => [
170
173
  e.icon ? (b(), u(t, {
171
174
  key: 0,
172
175
  icon: e.icon
173
176
  }, null, 8, ["icon"])) : d("", !0),
174
- p("span", { class: y(H("linkLabel")) }, T(e.label), 3),
177
+ p("span", { class: y(W("linkLabel")) }, T(e.label), 3),
175
178
  e.badge === void 0 ? d("", !0) : (b(), f("span", {
176
179
  key: 1,
177
- class: y(H("linkBadge"))
180
+ class: y(W("linkBadge"))
178
181
  }, T(e.badge), 3))
179
182
  ]),
180
183
  _: 2
@@ -198,38 +201,38 @@ var P = [
198
201
  "onUpdate:open"
199
202
  ])) : (b(), u(a, {
200
203
  key: 2,
201
- text: J(r),
202
- side: U.value,
203
- disabled: !L.value,
204
- unstyled: z.value
204
+ text: X(r),
205
+ side: G.value,
206
+ disabled: !R.value,
207
+ unstyled: B.value
205
208
  }, {
206
- trigger: O(() => [(b(), u(w(K(r)), {
209
+ trigger: O(() => [(b(), u(w(J(r)), {
207
210
  href: r.href,
208
211
  type: r.href ? void 0 : "button",
209
- "aria-label": Z(r),
212
+ "aria-label": $(r),
210
213
  "aria-current": r.active ? "page" : void 0,
211
214
  "aria-disabled": r.disabled || void 0,
212
215
  "data-active": r.active ? "" : void 0,
213
216
  "data-disabled": r.disabled ? "" : void 0,
214
- class: y(H("link")),
215
- onClick: (e) => X(r, e)
217
+ class: y(W("link")),
218
+ onClick: (e) => Q(r, e)
216
219
  }, {
217
220
  default: O(() => [C(e.$slots, "link", {
218
221
  link: r,
219
- collapsed: L.value
222
+ collapsed: R.value
220
223
  }, () => [
221
224
  r.icon ? (b(), u(t, {
222
225
  key: 0,
223
226
  icon: r.icon
224
- }, null, 8, ["icon"])) : L.value ? (b(), f("span", {
227
+ }, null, 8, ["icon"])) : R.value ? (b(), f("span", {
225
228
  key: 1,
226
229
  "aria-hidden": "true",
227
- class: y(H("linkInitial"))
228
- }, T(q(r)), 3)) : d("", !0),
229
- p("span", { class: y(H("linkLabel")) }, T(r.label), 3),
230
+ class: y(W("linkInitial"))
231
+ }, T(Y(r)), 3)) : d("", !0),
232
+ p("span", { class: y(W("linkLabel")) }, T(r.label), 3),
230
233
  r.badge === void 0 ? d("", !0) : (b(), f("span", {
231
234
  key: 2,
232
- class: y(H("linkBadge"))
235
+ class: y(W("linkBadge"))
233
236
  }, T(r.badge), 3))
234
237
  ])]),
235
238
  _: 2
@@ -250,11 +253,11 @@ var P = [
250
253
  "side",
251
254
  "disabled",
252
255
  "unstyled"
253
- ]))], 64))), 128))], 2))), 128))])], 2),
256
+ ]))], 64))), 128))], 10, P))), 128))])], 2),
254
257
  e.$slots.footer ? (b(), f("div", {
255
258
  key: 1,
256
- class: y(H("footer"))
257
- }, [C(e.$slots, "footer", { collapsed: L.value })], 2)) : d("", !0)
259
+ class: y(W("footer"))
260
+ }, [C(e.$slots, "footer", { collapsed: R.value })], 2)) : d("", !0)
258
261
  ]),
259
262
  _: 3
260
263
  }, 8, [
@@ -265,4 +268,4 @@ var P = [
265
268
  }
266
269
  });
267
270
  //#endregion
268
- export { F as default };
271
+ export { I as default };
@@ -13,6 +13,8 @@ export interface StatProps {
13
13
  trend?: 'up' | 'down' | 'neutral';
14
14
  /** Secondary text under the value. */
15
15
  hint?: string;
16
+ /** Show the delta beside the value, or beside the hint. */
17
+ deltaPlacement?: 'value' | 'hint';
16
18
  size?: 'sm' | 'md' | 'lg';
17
19
  /**
18
20
  * Format the delta. Defaults to a signed percentage; override for other
@@ -30,11 +32,14 @@ export interface StatProps {
30
32
  delta?: string;
31
33
  hint?: string;
32
34
  row?: string;
35
+ hintRow?: string;
33
36
  };
34
37
  }
35
38
  declare var __VLS_8: {}, __VLS_10: {}, __VLS_12: {
36
39
  trend: "up" | "down" | "neutral";
37
- }, __VLS_19: {};
40
+ }, __VLS_19: {
41
+ trend: "up" | "down" | "neutral";
42
+ }, __VLS_26: {}, __VLS_28: {};
38
43
  type __VLS_Slots = {} & {
39
44
  label?: (props: typeof __VLS_8) => any;
40
45
  } & {
@@ -42,11 +47,16 @@ type __VLS_Slots = {} & {
42
47
  } & {
43
48
  delta?: (props: typeof __VLS_12) => any;
44
49
  } & {
45
- hint?: (props: typeof __VLS_19) => any;
50
+ delta?: (props: typeof __VLS_19) => any;
51
+ } & {
52
+ hint?: (props: typeof __VLS_26) => any;
53
+ } & {
54
+ hint?: (props: typeof __VLS_28) => any;
46
55
  };
47
56
  declare const __VLS_base: import("vue").DefineComponent<StatProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<StatProps> & Readonly<{}>, {
48
57
  unstyled: boolean;
49
58
  as: string;
59
+ deltaPlacement: "value" | "hint";
50
60
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
51
61
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
52
62
  declare const _default: typeof __VLS_export;
@@ -14,6 +14,7 @@ var x = /*@__PURE__*/ u({
14
14
  delta: {},
15
15
  trend: {},
16
16
  hint: {},
17
+ deltaPlacement: { default: "value" },
17
18
  size: {},
18
19
  formatDelta: {},
19
20
  unstyled: {
@@ -38,7 +39,7 @@ var x = /*@__PURE__*/ u({
38
39
  }), E = e(), D = r(() => x.unstyled ?? E.unstyled), O = r(() => n({
39
40
  size: x.size,
40
41
  trend: C.value
41
- })), k = r(() => D.value ? [x.ui?.root, x.class] : O.value.root({ class: [x.ui?.root, x.class] })), A = r(() => D.value ? x.ui?.label : O.value.label({ class: x.ui?.label })), j = r(() => D.value ? x.ui?.value : O.value.value({ class: x.ui?.value })), M = r(() => D.value ? x.ui?.delta : O.value.delta({ class: x.ui?.delta })), N = r(() => D.value ? x.ui?.hint : O.value.hint({ class: x.ui?.hint })), P = r(() => D.value ? x.ui?.row : O.value.row({ class: x.ui?.row }));
42
+ })), k = r(() => D.value ? [x.ui?.root, x.class] : O.value.root({ class: [x.ui?.root, x.class] })), A = r(() => D.value ? x.ui?.label : O.value.label({ class: x.ui?.label })), j = r(() => D.value ? x.ui?.value : O.value.value({ class: x.ui?.value })), M = r(() => D.value ? x.ui?.delta : O.value.delta({ class: x.ui?.delta })), N = r(() => D.value ? x.ui?.hint : O.value.hint({ class: x.ui?.hint })), P = r(() => D.value ? x.ui?.row : O.value.row({ class: x.ui?.row })), F = r(() => D.value ? x.ui?.hintRow : O.value.hintRow({ class: x.ui?.hintRow })), I = r(() => T.value !== void 0);
42
43
  return (e, n) => (f(), i(h(b), {
43
44
  as: x.as,
44
45
  class: d(k.value)
@@ -48,15 +49,27 @@ var x = /*@__PURE__*/ u({
48
49
  key: 0,
49
50
  class: d(A.value)
50
51
  }, [p(e.$slots, "label", {}, () => [c(m(x.label), 1)])], 2)) : a("", !0),
51
- s("span", { class: d(P.value) }, [s("span", { class: d(j.value) }, [p(e.$slots, "default", {}, () => [c(m(x.value), 1)])], 2), T.value || e.$slots.delta ? (f(), o("span", {
52
+ s("span", { class: d(P.value) }, [s("span", { class: d(j.value) }, [p(e.$slots, "default", {}, () => [c(m(x.value), 1)])], 2), x.deltaPlacement === "value" && (I.value || e.$slots.delta) ? (f(), o("span", {
52
53
  key: 0,
53
54
  class: d(M.value)
54
55
  }, [p(e.$slots, "delta", { trend: C.value }, () => [l(t, {
55
56
  icon: w.value,
56
57
  "data-icon": "inline-start"
57
58
  }, null, 8, ["icon"]), c(" " + m(T.value), 1)])], 2)) : a("", !0)], 2),
58
- x.hint || e.$slots.hint ? (f(), o("span", {
59
+ x.deltaPlacement === "hint" ? (f(), o("span", {
59
60
  key: 1,
61
+ class: d(F.value)
62
+ }, [I.value || e.$slots.delta ? (f(), o("span", {
63
+ key: 0,
64
+ class: d(M.value)
65
+ }, [p(e.$slots, "delta", { trend: C.value }, () => [l(t, {
66
+ icon: w.value,
67
+ "data-icon": "inline-start"
68
+ }, null, 8, ["icon"]), c(" " + m(T.value), 1)])], 2)) : a("", !0), x.hint || e.$slots.hint ? (f(), o("span", {
69
+ key: 1,
70
+ class: d(N.value)
71
+ }, [p(e.$slots, "hint", {}, () => [c(m(x.hint), 1)])], 2)) : a("", !0)], 2)) : x.hint || e.$slots.hint ? (f(), o("span", {
72
+ key: 2,
60
73
  class: d(N.value)
61
74
  }, [p(e.$slots, "hint", {}, () => [c(m(x.hint), 1)])], 2)) : a("", !0)
62
75
  ]),
@@ -20,7 +20,7 @@ export interface TextareaProps {
20
20
  /** Mark the field as invalid — styles the border and ring red. */
21
21
  invalid?: boolean;
22
22
  /** Hard limit in characters, enforced by the browser. */
23
- maxlength?: number;
23
+ maxlength?: number | string;
24
24
  /**
25
25
  * Show a character count under the field — "120/500" with `maxlength`,
26
26
  * turning red within the last tenth of the limit.
@@ -17,7 +17,7 @@ export interface ToggleGroupProps {
17
17
  items?: (ToggleGroupItemOption | string)[];
18
18
  /**
19
19
  * `single` behaves like a segmented control — one item on at a time, and
20
- * the model is that item's value. `multiple` lets any number be on, and the
20
+ * the model is that item's value. Once one is on, clicking it again keeps it on. `multiple` lets any number be on, and the
21
21
  * model is an array.
22
22
  */
23
23
  type?: 'single' | 'multiple';
@@ -1,10 +1,10 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
2
  import t from "./Icon.js";
3
3
  import { toggleGroupTheme as n, toggleTheme as r } from "../theme/toggle.js";
4
- import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock 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";
5
- import { ToggleGroupItem as _, ToggleGroupRoot as v } from "reka-ui";
4
+ import { Fragment as i, computed as a, createBlock as o, createCommentVNode as s, createElementBlock as c, defineComponent as l, normalizeClass as u, openBlock as d, ref as f, renderList as p, renderSlot as m, toDisplayString as h, unref as g, watch as _, withCtx as v } from "vue";
5
+ import { ToggleGroupItem as y, ToggleGroupRoot as b } from "reka-ui";
6
6
  //#region src/components/ToggleGroup.vue?vue&type=script&setup=true&lang.ts
7
- var y = { key: 1 }, b = /*@__PURE__*/ l({
7
+ var x = { key: 1 }, S = /*@__PURE__*/ l({
8
8
  __name: "ToggleGroup",
9
9
  props: {
10
10
  items: {},
@@ -30,37 +30,43 @@ var y = { key: 1 }, b = /*@__PURE__*/ l({
30
30
  ui: {}
31
31
  },
32
32
  emits: ["update:modelValue"],
33
- setup(l, { emit: b }) {
34
- let x = l, S = b, C = a(() => (x.items ?? []).map((e) => typeof e == "string" ? { label: e } : e)), w = (e) => e.value ?? e.label, T = e(), E = a(() => x.unstyled ?? T.unstyled), D = a(() => n({
35
- variant: x.variant,
36
- orientation: x.orientation,
37
- block: x.block
38
- })), O = a(() => E.value ? [x.ui?.root, x.class] : D.value.root({ class: [x.ui?.root, x.class] })), k = a(() => E.value ? x.ui?.item : r({
39
- size: x.size,
40
- square: x.iconOnly,
41
- class: D.value.item({ class: x.ui?.item })
33
+ setup(l, { emit: S }) {
34
+ let C = l, w = S, T = f(C.modelValue);
35
+ _(() => C.modelValue, (e) => T.value = e);
36
+ function E(e) {
37
+ let t = e;
38
+ C.type === "single" && !t || (T.value = t, w("update:modelValue", t));
39
+ }
40
+ let D = a(() => (C.items ?? []).map((e) => typeof e == "string" ? { label: e } : e)), O = (e) => e.value ?? e.label, k = e(), A = a(() => C.unstyled ?? k.unstyled), j = a(() => n({
41
+ variant: C.variant,
42
+ orientation: C.orientation,
43
+ block: C.block
44
+ })), M = a(() => A.value ? [C.ui?.root, C.class] : j.value.root({ class: [C.ui?.root, C.class] })), N = a(() => A.value ? C.ui?.item : r({
45
+ size: C.size,
46
+ square: C.iconOnly,
47
+ class: j.value.item({ class: C.ui?.item })
42
48
  }));
43
- return (e, n) => (d(), o(h(v), {
44
- type: x.type,
45
- "model-value": x.modelValue,
46
- disabled: x.disabled,
47
- orientation: x.orientation,
48
- loop: x.loop,
49
- class: u(O.value),
50
- "onUpdate:modelValue": n[0] ||= (e) => S("update:modelValue", e)
49
+ return (e, n) => (d(), o(g(b), {
50
+ type: C.type,
51
+ "model-value": T.value ?? (C.type === "multiple" ? [] : ""),
52
+ disabled: C.disabled,
53
+ orientation: C.orientation,
54
+ loop: C.loop,
55
+ class: u(M.value),
56
+ "onUpdate:modelValue": E
51
57
  }, {
52
- default: g(() => [(d(!0), c(i, null, f(C.value, (n) => (d(), o(h(_), {
53
- key: w(n),
54
- value: w(n),
58
+ default: v(() => [(d(!0), c(i, null, p(D.value, (n) => (d(), o(g(y), {
59
+ key: O(n),
60
+ value: O(n),
55
61
  disabled: n.disabled,
56
- "aria-label": n.ariaLabel ?? (x.iconOnly ? n.label : void 0),
57
- class: u(k.value)
62
+ "aria-label": n.ariaLabel ?? (C.iconOnly ? n.label : void 0),
63
+ class: u(N.value)
58
64
  }, {
59
- default: g(() => [p(e.$slots, "item", { item: n }, () => [n.icon ? (d(), o(t, {
65
+ default: v(() => [m(e.$slots, "item", { item: n }, () => [n.icon ? (d(), o(t, {
60
66
  key: 0,
61
67
  icon: n.icon,
62
- "data-icon": x.iconOnly ? void 0 : "inline-start"
63
- }, null, 8, ["icon", "data-icon"])) : s("", !0), x.iconOnly ? s("", !0) : (d(), c("span", y, m(n.label), 1))])]),
68
+ "data-icon": C.iconOnly ? void 0 : "inline-start"
69
+ }, null, 8, ["icon", "data-icon"])) : s("", !0), C.iconOnly ? s("", !0) : (d(), c("span", x, h(n.label), 1))])]),
64
70
  _: 2
65
71
  }, 1032, [
66
72
  "value",
@@ -80,4 +86,4 @@ var y = { key: 1 }, b = /*@__PURE__*/ l({
80
86
  }
81
87
  });
82
88
  //#endregion
83
- export { b as default };
89
+ export { S as default };
@@ -1,5 +1,5 @@
1
1
  export declare function defaultCountLabel(remaining: number): string;
2
- export declare function useCharacterCount(value: () => string | number | null | undefined, max: () => number | undefined): {
2
+ export declare function useCharacterCount(value: () => string | number | null | undefined, maxRaw: () => number | string | undefined): {
3
3
  remaining: import("vue").ComputedRef<number | undefined>;
4
4
  nearLimit: import("vue").ComputedRef<boolean>;
5
5
  text: import("vue").ComputedRef<string>;
@@ -4,14 +4,17 @@ function t(e) {
4
4
  return `${e} ${e === 1 ? "character" : "characters"} left`;
5
5
  }
6
6
  function n(t, n) {
7
- let r = e(() => String(t() ?? "").length), i = e(() => {
7
+ let r = () => {
8
8
  let e = n();
9
- return e == null ? void 0 : e - r.value;
9
+ return e == null || e === "" ? void 0 : Number(e);
10
+ }, i = e(() => String(t() ?? "").length), a = e(() => {
11
+ let e = r();
12
+ return e == null ? void 0 : e - i.value;
10
13
  });
11
14
  return {
12
- remaining: i,
13
- nearLimit: e(() => i.value != null && i.value <= Math.ceil(n() * .1)),
14
- text: e(() => n() == null ? `${r.value}` : `${r.value}/${n()}`)
15
+ remaining: a,
16
+ nearLimit: e(() => a.value != null && a.value <= Math.ceil(r() * .1)),
17
+ text: e(() => r() == null ? `${i.value}` : `${i.value}/${r()}`)
15
18
  };
16
19
  }
17
20
  //#endregion
@@ -1,4 +1,4 @@
1
- import type { InjectionKey } from 'vue';
1
+ import type { InjectionKey, Ref } from 'vue';
2
2
  import type { IconLike } from './icon';
3
3
  export interface SidebarLink {
4
4
  label: string;
@@ -28,6 +28,8 @@ export interface SidebarLink {
28
28
  export interface SidebarSection {
29
29
  section: string;
30
30
  items: SidebarLink[];
31
+ /** Push to the bottom of the column, above the footer. Pass `section: ''` for no heading. */
32
+ pinned?: boolean;
31
33
  }
32
34
  export type SidebarItems = (SidebarLink | SidebarSection)[];
33
35
  /** Provided by `IAppShell` around each copy of its sidebar slot. */
@@ -36,3 +38,11 @@ export declare function isSidebarSection(item: SidebarLink | SidebarSection): it
36
38
  /** Normalise to sections, so the template has a single path to render. */
37
39
  export declare function toSidebarSections(items: SidebarItems | undefined): SidebarSection[];
38
40
  export declare function isSidebarGroup(link: SidebarLink): boolean;
41
+ export declare const sidebarCollapsedCookie = "iryx-ui-sidebar-collapsed";
42
+ /**
43
+ * Provide a ref read from the request cookie so the server renders the sidebar
44
+ * the way the user left it. The Nuxt module does this for you.
45
+ */
46
+ export declare const sidebarCollapsedKey: InjectionKey<Ref<boolean>>;
47
+ /** Collapsed state remembered in a cookie. Bind it with `v-model:collapsed`. */
48
+ export declare function useSidebarCollapsed(): Ref<boolean>;
@@ -1,24 +1,35 @@
1
+ import { inject as e, ref as t, watch as n } from "vue";
1
2
  //#region src/composables/sidebar.ts
2
- var e = Symbol.for("iryx-ui:sidebar-placement");
3
- function t(e) {
3
+ var r = Symbol.for("iryx-ui:sidebar-placement");
4
+ function i(e) {
4
5
  return typeof e.section == "string";
5
6
  }
6
- function n(e) {
7
- let n = [], r;
8
- for (let i of e ?? []) {
9
- if (t(i)) {
10
- n.push(i), r = void 0;
7
+ function a(e) {
8
+ let t = [], n;
9
+ for (let r of e ?? []) {
10
+ if (i(r)) {
11
+ t.push(r), n = void 0;
11
12
  continue;
12
13
  }
13
- r || (r = [], n.push({
14
+ n || (n = [], t.push({
14
15
  section: "",
15
- items: r
16
- })), r.push(i);
16
+ items: n
17
+ })), n.push(r);
17
18
  }
18
- return n;
19
+ return [...t.filter((e) => !e.pinned), ...t.filter((e) => e.pinned)];
19
20
  }
20
- function r(e) {
21
+ function o(e) {
21
22
  return Array.isArray(e.items) && e.items.length > 0;
22
23
  }
24
+ var s = "iryx-ui-sidebar-collapsed", c = Symbol.for("iryx-ui:sidebar-collapsed");
25
+ function l() {
26
+ let r = e(c, null);
27
+ if (r) return r;
28
+ if (typeof document > "u") return t(!1);
29
+ let i = t(document.cookie.match(RegExp(`(?:^|; )${s}=([^;]*)`))?.[1] === "true");
30
+ return n(i, (e) => {
31
+ document.cookie = `${s}=${e}; path=/; max-age=31536000; samesite=lax`;
32
+ }), i;
33
+ }
23
34
  //#endregion
24
- export { r as isSidebarGroup, t as isSidebarSection, e as sidebarPlacementKey, n as toSidebarSections };
35
+ export { o as isSidebarGroup, i as isSidebarSection, s as sidebarCollapsedCookie, c as sidebarCollapsedKey, r as sidebarPlacementKey, a as toSidebarSections, l as useSidebarCollapsed };