iryx-ui 0.15.0 → 0.17.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.
Files changed (102) hide show
  1. package/README.md +3 -1
  2. package/dist/component-names.d.ts +1 -1
  3. package/dist/component-names.js +1 -1
  4. package/dist/components/BarChart.vue.d.ts +8 -0
  5. package/dist/components/BarChart.vue_vue_type_script_setup_true_lang.js +169 -151
  6. package/dist/components/Calendar.js +5 -0
  7. package/dist/components/Calendar.vue.d.ts +69 -0
  8. package/dist/components/Calendar.vue_vue_type_script_setup_true_lang.js +168 -0
  9. package/dist/components/Combobox.vue.d.ts +9 -9
  10. package/dist/components/Combobox.vue_vue_type_script_setup_true_lang.js +180 -144
  11. package/dist/components/DateField.js +5 -0
  12. package/dist/components/DateField.vue.d.ts +38 -0
  13. package/dist/components/DateField.vue_vue_type_script_setup_true_lang.js +94 -0
  14. package/dist/components/DatePicker.vue.d.ts +7 -2
  15. package/dist/components/DatePicker.vue_vue_type_script_setup_true_lang.js +73 -124
  16. package/dist/components/DateRangePicker.vue.d.ts +2 -2
  17. package/dist/components/DateRangePicker.vue_vue_type_script_setup_true_lang.js +81 -78
  18. package/dist/components/DonutChart.js +5 -0
  19. package/dist/components/DonutChart.vue.d.ts +96 -0
  20. package/dist/components/DonutChart.vue_vue_type_script_setup_true_lang.js +234 -0
  21. package/dist/components/DropdownMenu.vue.d.ts +13 -6
  22. package/dist/components/DropdownMenu.vue_vue_type_script_setup_true_lang.js +28 -22
  23. package/dist/components/Editable.js +5 -0
  24. package/dist/components/Editable.vue.d.ts +81 -0
  25. package/dist/components/Editable.vue_vue_type_script_setup_true_lang.js +140 -0
  26. package/dist/components/HoverCard.js +5 -0
  27. package/dist/components/HoverCard.vue.d.ts +68 -0
  28. package/dist/components/HoverCard.vue_vue_type_script_setup_true_lang.js +79 -0
  29. package/dist/components/LineChart.vue.d.ts +8 -0
  30. package/dist/components/LineChart.vue_vue_type_script_setup_true_lang.js +160 -141
  31. package/dist/components/Sparkline.vue.d.ts +9 -0
  32. package/dist/components/Sparkline.vue_vue_type_script_setup_true_lang.js +90 -53
  33. package/dist/components/TagsInput.vue.d.ts +2 -2
  34. package/dist/components/TimeField.vue_vue_type_script_setup_true_lang.js +17 -14
  35. package/dist/components/index.d.ts +5 -0
  36. package/dist/components/index.js +124 -114
  37. package/dist/composables/cartesian.d.ts +10 -2
  38. package/dist/composables/chart-reveal.d.ts +45 -0
  39. package/dist/composables/chart-reveal.js +93 -0
  40. package/dist/index.d.ts +6 -0
  41. package/dist/index.js +142 -131
  42. package/dist/theme/accordion.d.ts +0 -15
  43. package/dist/theme/alert.d.ts +0 -3
  44. package/dist/theme/avatar.d.ts +0 -3
  45. package/dist/theme/banner.d.ts +0 -6
  46. package/dist/theme/bar-chart.d.ts +0 -18
  47. package/dist/theme/breadcrumb.d.ts +0 -3
  48. package/dist/theme/calendar.d.ts +62 -0
  49. package/dist/theme/calendar.js +29 -0
  50. package/dist/theme/card.d.ts +0 -6
  51. package/dist/theme/chart-legend.d.ts +0 -3
  52. package/dist/theme/checkbox.d.ts +0 -6
  53. package/dist/theme/color-picker.d.ts +0 -6
  54. package/dist/theme/combobox.js +4 -4
  55. package/dist/theme/command-palette.d.ts +0 -6
  56. package/dist/theme/container.d.ts +0 -3
  57. package/dist/theme/container.js +3 -3
  58. package/dist/theme/date-field.d.ts +65 -0
  59. package/dist/theme/date-field.js +21 -0
  60. package/dist/theme/date-picker.d.ts +0 -195
  61. package/dist/theme/date-picker.js +2 -24
  62. package/dist/theme/donut-chart.d.ts +86 -0
  63. package/dist/theme/donut-chart.js +17 -0
  64. package/dist/theme/dropdown-menu.d.ts +3 -0
  65. package/dist/theme/dropdown-menu.js +1 -0
  66. package/dist/theme/editable.d.ts +77 -0
  67. package/dist/theme/editable.js +26 -0
  68. package/dist/theme/empty-state.d.ts +0 -3
  69. package/dist/theme/file-upload.d.ts +0 -39
  70. package/dist/theme/hover-card.d.ts +92 -0
  71. package/dist/theme/hover-card.js +28 -0
  72. package/dist/theme/index.d.ts +5 -0
  73. package/dist/theme/input.d.ts +0 -18
  74. package/dist/theme/kbd.d.ts +0 -3
  75. package/dist/theme/line-chart.d.ts +0 -18
  76. package/dist/theme/navigation-menu.d.ts +0 -48
  77. package/dist/theme/number-input.d.ts +0 -3
  78. package/dist/theme/page-header.d.ts +0 -3
  79. package/dist/theme/password-input.d.ts +0 -23
  80. package/dist/theme/pin-input.d.ts +0 -3
  81. package/dist/theme/popover.d.ts +0 -6
  82. package/dist/theme/progress.d.ts +0 -51
  83. package/dist/theme/scroll-area.d.ts +0 -3
  84. package/dist/theme/separator.d.ts +0 -3
  85. package/dist/theme/sidebar.d.ts +0 -54
  86. package/dist/theme/skeleton.d.ts +0 -3
  87. package/dist/theme/skeleton.js +1 -1
  88. package/dist/theme/slider.d.ts +0 -6
  89. package/dist/theme/sparkline.d.ts +0 -11
  90. package/dist/theme/sparkline.js +1 -1
  91. package/dist/theme/splitter.d.ts +0 -3
  92. package/dist/theme/stat.d.ts +0 -12
  93. package/dist/theme/stat.js +2 -2
  94. package/dist/theme/switch.d.ts +0 -6
  95. package/dist/theme/table.d.ts +0 -39
  96. package/dist/theme/tabs.d.ts +0 -12
  97. package/dist/theme/time-field.d.ts +0 -3
  98. package/dist/theme/timeline.d.ts +0 -18
  99. package/dist/theme/toast.d.ts +0 -3
  100. package/dist/theme/toggle.d.ts +0 -23
  101. package/dist/theme/tree.d.ts +0 -3
  102. package/package.json +1 -1
@@ -1,20 +1,21 @@
1
1
  import { useIryxUiConfig as e } from "../config.js";
2
2
  import t from "./Icon.js";
3
- import { useFormField as n } from "../composables/form.js";
4
- import { formatIsoDate as r, toCalendarDate as i, toIsoDate as a } from "../composables/date.js";
5
- import { datePickerTheme as ee } from "../theme/date-picker.js";
6
- import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createTextVNode as f, createVNode as p, defineComponent as m, mergeModels as h, normalizeClass as g, openBlock as _, ref as v, renderList as y, shallowRef as b, toDisplayString as x, unref as S, useModel as C, watch as w, withCtx as T } from "vue";
7
- import { ArrowLeft01Icon as E, ArrowRight01Icon as D, Calendar03Icon as te } from "@hugeicons/core-free-icons";
8
- import { PopoverContent as ne, PopoverPortal as re, PopoverRoot as O, PopoverTrigger as k, RangeCalendarCell as A, RangeCalendarCellTrigger as j, RangeCalendarGrid as M, RangeCalendarGridBody as N, RangeCalendarGridHead as P, RangeCalendarGridRow as F, RangeCalendarHeadCell as I, RangeCalendarHeader as L, RangeCalendarHeading as R, RangeCalendarNext as z, RangeCalendarPrev as B, RangeCalendarRoot as V } from "reka-ui";
3
+ import { formatIsoDate as n, toCalendarDate as r, toIsoDate as i } from "../composables/date.js";
4
+ import { calendarTheme as ee } from "../theme/calendar.js";
5
+ import { useFormField as a } from "../composables/form.js";
6
+ import { datePickerTheme as o } from "../theme/date-picker.js";
7
+ import { Fragment as s, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createTextVNode as p, createVNode as m, defineComponent as h, mergeModels as g, normalizeClass as _, openBlock as v, ref as y, renderList as b, shallowRef as x, toDisplayString as S, unref as C, useModel as w, watch as T, withCtx as E } from "vue";
8
+ import { ArrowLeft01Icon as te, ArrowRight01Icon as ne, Calendar03Icon as re } from "@hugeicons/core-free-icons";
9
+ import { PopoverContent as D, PopoverPortal as O, PopoverRoot as k, PopoverTrigger as A, RangeCalendarCell as j, RangeCalendarCellTrigger as M, RangeCalendarGrid as N, RangeCalendarGridBody as P, RangeCalendarGridHead as F, RangeCalendarGridRow as I, RangeCalendarHeadCell as L, RangeCalendarHeader as R, RangeCalendarHeading as z, RangeCalendarNext as B, RangeCalendarPrev as V, RangeCalendarRoot as ie } from "reka-ui";
9
10
  //#region src/components/DateRangePicker.vue?vue&type=script&setup=true&lang.ts
10
11
  var H = [
11
12
  "id",
12
13
  "disabled",
13
14
  "aria-invalid",
14
15
  "aria-describedby"
15
- ], U = { key: 0 }, W = /*@__PURE__*/ m({
16
+ ], U = { key: 0 }, W = /*@__PURE__*/ h({
16
17
  __name: "DateRangePicker",
17
- props: /*@__PURE__*/ h({
18
+ props: /*@__PURE__*/ g({
18
19
  size: {},
19
20
  placeholder: { default: "Pick a date range" },
20
21
  disabled: { type: Boolean },
@@ -48,127 +49,129 @@ var H = [
48
49
  modelModifiers: {}
49
50
  }),
50
51
  emits: ["update:modelValue"],
51
- setup(m) {
52
- let h = m, W = C(m, "modelValue"), G = v(!1), K = n(), q = s(() => h.id ?? K?.id.value), J = s(() => h.invalid ?? K?.invalid.value ?? !1), Y = e(), ie = s(() => h.unstyled ?? Y.unstyled), X = b({
53
- start: i(W.value?.start),
54
- end: i(W.value?.end)
52
+ setup(h) {
53
+ let g = h, W = w(h, "modelValue"), G = y(!1), K = a(), q = c(() => g.id ?? K?.id.value), J = c(() => g.invalid ?? K?.invalid.value ?? !1), Y = e(), ae = c(() => g.unstyled ?? Y.unstyled), X = x({
54
+ start: r(W.value?.start),
55
+ end: r(W.value?.end)
55
56
  });
56
57
  function Z(e) {
57
- return a(e.start) === (W.value?.start ?? null) && a(e.end) === (W.value?.end ?? null);
58
+ return i(e.start) === (W.value?.start ?? null) && i(e.end) === (W.value?.end ?? null);
58
59
  }
59
- w(W, () => {
60
+ T(W, () => {
60
61
  Z(X.value) || (X.value = {
61
- start: i(W.value?.start),
62
- end: i(W.value?.end)
62
+ start: r(W.value?.start),
63
+ end: r(W.value?.end)
63
64
  });
64
- }, { deep: !0 }), w(X, (e) => {
65
+ }, { deep: !0 }), T(X, (e) => {
65
66
  Z(e) || (W.value = {
66
- start: a(e.start),
67
- end: a(e.end)
67
+ start: i(e.start),
68
+ end: i(e.end)
68
69
  });
69
70
  });
70
- let ae = s(() => i(h.min)), oe = s(() => i(h.max)), Q = s(() => {
71
- let e = r(W.value?.start, h.locale, h.format), t = r(W.value?.end, h.locale, h.format);
72
- return !e && !t ? "" : t ? `${e}${h.separator}${t}` : e;
71
+ let oe = c(() => r(g.min)), se = c(() => r(g.max)), Q = c(() => {
72
+ let e = n(W.value?.start, g.locale, g.format), t = n(W.value?.end, g.locale, g.format);
73
+ return !e && !t ? "" : t ? `${e}${g.separator}${t}` : e;
73
74
  });
74
- w(W, (e) => {
75
+ T(W, (e) => {
75
76
  G.value && e?.start && e?.end && (G.value = !1);
76
77
  }, { deep: !0 });
77
- function se() {
78
+ function ce() {
78
79
  W.value = {
79
80
  start: null,
80
81
  end: null
81
82
  }, G.value = !1;
82
83
  }
83
- let ce = s(() => ee({
84
- size: h.size,
85
- invalid: J.value,
86
- range: !0
84
+ let le = c(() => ({
85
+ ...o({
86
+ size: g.size,
87
+ invalid: J.value
88
+ }),
89
+ ...ee({ range: !0 })
87
90
  }));
88
91
  function $(e, t) {
89
- let n = h.ui?.[e];
90
- return ie.value ? [n, t] : ce.value[e]({ class: [n, t] });
92
+ let n = g.ui?.[e];
93
+ return ae.value ? [n, t] : le.value[e]({ class: [n, t] });
91
94
  }
92
- return (e, n) => (_(), c(S(O), {
95
+ return (e, n) => (v(), l(C(k), {
93
96
  open: G.value,
94
97
  "onUpdate:open": n[1] ||= (e) => G.value = e
95
98
  }, {
96
- default: T(() => [p(S(k), { "as-child": "" }, {
97
- default: T(() => [d("button", {
99
+ default: E(() => [m(C(A), { "as-child": "" }, {
100
+ default: E(() => [f("button", {
98
101
  id: q.value,
99
102
  type: "button",
100
- disabled: h.disabled,
103
+ disabled: g.disabled,
101
104
  "aria-invalid": J.value || void 0,
102
- "aria-describedby": S(K)?.describedBy.value,
103
- class: g($("trigger", h.class))
104
- }, [Q.value ? (_(), u("span", U, x(Q.value), 1)) : (_(), u("span", {
105
+ "aria-describedby": C(K)?.describedBy.value,
106
+ class: _($("trigger", g.class))
107
+ }, [Q.value ? (v(), d("span", U, S(Q.value), 1)) : (v(), d("span", {
105
108
  key: 1,
106
- class: g($("placeholder"))
107
- }, x(h.placeholder), 3)), p(t, { icon: S(te) }, null, 8, ["icon"])], 10, H)]),
109
+ class: _($("placeholder"))
110
+ }, S(g.placeholder), 3)), m(t, { icon: C(re) }, null, 8, ["icon"])], 10, H)]),
108
111
  _: 1
109
- }), p(S(re), null, {
110
- default: T(() => [p(S(ne), {
111
- class: g($("content")),
112
+ }), m(C(O), null, {
113
+ default: E(() => [m(C(D), {
114
+ class: _($("content")),
112
115
  "side-offset": 4,
113
116
  align: "start"
114
117
  }, {
115
- default: T(() => [p(S(V), {
118
+ default: E(() => [m(C(ie), {
116
119
  modelValue: X.value,
117
120
  "onUpdate:modelValue": n[0] ||= (e) => X.value = e,
118
- "min-value": ae.value,
119
- "max-value": oe.value,
120
- locale: h.locale,
121
- "week-starts-on": h.weekStartsOn,
122
- "number-of-months": h.months,
121
+ "min-value": oe.value,
122
+ "max-value": se.value,
123
+ locale: g.locale,
124
+ "week-starts-on": g.weekStartsOn,
125
+ "number-of-months": g.months,
123
126
  "fixed-weeks": "",
124
127
  "initial-focus": ""
125
128
  }, {
126
- default: T(({ grid: e, weekDays: n }) => [p(S(L), { class: g($("header")) }, {
127
- default: T(() => [
128
- p(S(B), {
129
- "aria-label": h.previousLabel,
130
- class: g($("nav"))
129
+ default: E(({ grid: e, weekDays: n }) => [m(C(R), { class: _($("header")) }, {
130
+ default: E(() => [
131
+ m(C(V), {
132
+ "aria-label": g.previousLabel,
133
+ class: _($("nav"))
131
134
  }, {
132
- default: T(() => [p(t, { icon: S(E) }, null, 8, ["icon"])]),
135
+ default: E(() => [m(t, { icon: C(te) }, null, 8, ["icon"])]),
133
136
  _: 1
134
137
  }, 8, ["aria-label", "class"]),
135
- p(S(R), { class: g($("heading")) }, null, 8, ["class"]),
136
- p(S(z), {
137
- "aria-label": h.nextLabel,
138
- class: g($("nav"))
138
+ m(C(z), { class: _($("heading")) }, null, 8, ["class"]),
139
+ m(C(B), {
140
+ "aria-label": g.nextLabel,
141
+ class: _($("nav"))
139
142
  }, {
140
- default: T(() => [p(t, { icon: S(D) }, null, 8, ["icon"])]),
143
+ default: E(() => [m(t, { icon: C(ne) }, null, 8, ["icon"])]),
141
144
  _: 1
142
145
  }, 8, ["aria-label", "class"])
143
146
  ]),
144
147
  _: 1
145
- }, 8, ["class"]), d("div", { class: g($("months")) }, [(_(!0), u(o, null, y(e, (e) => (_(), c(S(M), {
148
+ }, 8, ["class"]), f("div", { class: _($("months")) }, [(v(!0), d(s, null, b(e, (e) => (v(), l(C(N), {
146
149
  key: e.value.toString(),
147
- class: g($("grid"))
150
+ class: _($("grid"))
148
151
  }, {
149
- default: T(() => [p(S(P), null, {
150
- default: T(() => [p(S(F), null, {
151
- default: T(() => [(_(!0), u(o, null, y(n, (e) => (_(), c(S(I), {
152
+ default: E(() => [m(C(F), null, {
153
+ default: E(() => [m(C(I), null, {
154
+ default: E(() => [(v(!0), d(s, null, b(n, (e) => (v(), l(C(L), {
152
155
  key: e,
153
- class: g($("headCell"))
156
+ class: _($("headCell"))
154
157
  }, {
155
- default: T(() => [f(x(e), 1)]),
158
+ default: E(() => [p(S(e), 1)]),
156
159
  _: 2
157
160
  }, 1032, ["class"]))), 128))]),
158
161
  _: 2
159
162
  }, 1024)]),
160
163
  _: 2
161
- }, 1024), p(S(N), null, {
162
- default: T(() => [(_(!0), u(o, null, y(e.rows, (t, n) => (_(), c(S(F), { key: `week-${n}` }, {
163
- default: T(() => [(_(!0), u(o, null, y(t, (t) => (_(), c(S(A), {
164
+ }, 1024), m(C(P), null, {
165
+ default: E(() => [(v(!0), d(s, null, b(e.rows, (t, n) => (v(), l(C(I), { key: `week-${n}` }, {
166
+ default: E(() => [(v(!0), d(s, null, b(t, (t) => (v(), l(C(j), {
164
167
  key: t.toString(),
165
168
  date: t,
166
- class: g($("cell"))
169
+ class: _($("cell"))
167
170
  }, {
168
- default: T(() => [p(S(j), {
171
+ default: E(() => [m(C(M), {
169
172
  day: t,
170
173
  month: e.value,
171
- class: g($("cellTrigger"))
174
+ class: _($("cellTrigger"))
172
175
  }, null, 8, [
173
176
  "day",
174
177
  "month",
@@ -190,14 +193,14 @@ var H = [
190
193
  "locale",
191
194
  "week-starts-on",
192
195
  "number-of-months"
193
- ]), h.clearable ? (_(), u("div", {
196
+ ]), g.clearable ? (v(), d("div", {
194
197
  key: 0,
195
- class: g($("footer"))
196
- }, [d("button", {
198
+ class: _($("footer"))
199
+ }, [f("button", {
197
200
  type: "button",
198
- class: g($("action")),
199
- onClick: se
200
- }, x(h.clearLabel), 3)], 2)) : l("", !0)]),
201
+ class: _($("action")),
202
+ onClick: ce
203
+ }, S(g.clearLabel), 3)], 2)) : u("", !0)]),
201
204
  _: 1
202
205
  }, 8, ["class"])]),
203
206
  _: 1
@@ -0,0 +1,5 @@
1
+ import e from "./DonutChart.vue_vue_type_script_setup_true_lang.js";
2
+ //#region src/components/DonutChart.vue
3
+ var t = e;
4
+ //#endregion
5
+ export { t as default };
@@ -0,0 +1,96 @@
1
+ import type { ChartAnimate } from '../composables/chart-reveal';
2
+ import type { SparseValue } from '../composables/scale';
3
+ /**
4
+ * One slice. Unlike the cartesian charts there is no second axis to hold a
5
+ * series, so the row *is* the identity: its `label` names it and its `slot`
6
+ * pins its colour.
7
+ */
8
+ export interface DonutChartDatum {
9
+ label: string;
10
+ /** `null` is a missing reading — the slice is dropped, which is not a zero. */
11
+ value?: SparseValue;
12
+ /**
13
+ * Pin this slice to a palette slot (0-based) instead of taking its position
14
+ * in the array. Pin every slice that can be filtered out, so the survivors
15
+ * keep the colours the reader already learned.
16
+ */
17
+ slot?: number;
18
+ }
19
+ export interface DonutChartProps {
20
+ data?: readonly DonutChartDatum[];
21
+ /**
22
+ * Rendered height in px. The ring is a circle centred in whatever width the
23
+ * container gives, so this is also its diameter once the box is wide enough.
24
+ */
25
+ size?: number;
26
+ /**
27
+ * Ring thickness in px. Defaults to two fifths of the radius, which keeps
28
+ * the hole large enough to hold a total at every size. Ignored when `pie`.
29
+ */
30
+ thickness?: number;
31
+ /**
32
+ * Fill the middle in and draw a pie instead.
33
+ *
34
+ * The ring is the better default: a pie asks the reader to compare angles
35
+ * and areas, a donut only arc lengths, and the hole is somewhere to put the
36
+ * total the slices add up to.
37
+ */
38
+ pie?: boolean;
39
+ /**
40
+ * The gap between neighbouring slices, in px. `0` closes it and lets them
41
+ * touch.
42
+ *
43
+ * A width rather than an angle, and held the same all the way across: each
44
+ * edge is pushed half a gap off its own radius, so the divider reads as a
45
+ * line instead of a wedge that widens towards the rim. In a pie that is
46
+ * also why a slice stops a hair short of the centre — two parallel edges
47
+ * meet before they reach it.
48
+ */
49
+ gap?: number;
50
+ /**
51
+ * Sweep the ring open on the first paint. Skipped for a reader who has
52
+ * asked for reduced motion, and played once — not again when the data
53
+ * changes underneath it.
54
+ */
55
+ animate?: ChartAnimate;
56
+ /** Drop the legend. */
57
+ legend?: boolean;
58
+ /** Locale and options for every number shown — the total and the tooltip. */
59
+ locale?: string;
60
+ format?: Intl.NumberFormatOptions;
61
+ /**
62
+ * Accessible name for the figure. The slices are hidden from assistive tech
63
+ * and the data is exposed as a table instead, so this names what that is.
64
+ */
65
+ label?: string;
66
+ /** Skip built-in classes; you take over styling entirely. */
67
+ unstyled?: boolean;
68
+ class?: string;
69
+ ui?: Partial<Record<'root' | 'svg' | 'slice' | 'center' | 'tooltip' | 'tooltipLabel' | 'tooltipValue' | 'tooltipShare' | 'table', string>>;
70
+ }
71
+ type __VLS_Slots = {
72
+ /**
73
+ * The hole. Given the total and its formatted form, so the usual figure
74
+ * plus caption is one line of markup.
75
+ */
76
+ center?: (props: {
77
+ total: number;
78
+ formatted: string;
79
+ }) => unknown;
80
+ };
81
+ declare const __VLS_base: import("vue").DefineComponent<DonutChartProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DonutChartProps> & Readonly<{}>, {
82
+ size: number;
83
+ unstyled: boolean;
84
+ data: readonly DonutChartDatum[];
85
+ legend: boolean;
86
+ animate: ChartAnimate;
87
+ gap: number;
88
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
89
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
90
+ declare const _default: typeof __VLS_export;
91
+ export default _default;
92
+ type __VLS_WithSlots<T, S> = T & {
93
+ new (): {
94
+ $slots: S;
95
+ };
96
+ };
@@ -0,0 +1,234 @@
1
+ import { useIryxUiConfig as e } from "../config.js";
2
+ import { useElementSize as t } from "../composables/element-size.js";
3
+ import { clampTooltip as n, seriesColor as r, slotOf as i, warnOnSlotOverflow as a } from "../composables/cartesian.js";
4
+ import { useChartAnimation as o, useChartProgress as s } from "../composables/chart-reveal.js";
5
+ import c from "./ChartLegend.js";
6
+ import { donutChartTheme as l } from "../theme/donut-chart.js";
7
+ import { Fragment as u, computed as d, createBlock as f, createCommentVNode as p, createElementBlock as m, createElementVNode as h, defineComponent as g, normalizeClass as _, normalizeStyle as v, openBlock as y, ref as b, renderList as x, renderSlot as ee, toDisplayString as S, unref as C } from "vue";
8
+ //#region src/components/DonutChart.vue?vue&type=script&setup=true&lang.ts
9
+ var te = ["role", "aria-label"], w = [
10
+ "width",
11
+ "height",
12
+ "viewBox"
13
+ ], ne = [
14
+ "cx",
15
+ "cy",
16
+ "r",
17
+ "fill",
18
+ "stroke",
19
+ "stroke-width"
20
+ ], re = ["d", "onPointerenter"], ie = { scope: "row" }, T = /*@__PURE__*/ g({
21
+ __name: "DonutChart",
22
+ props: {
23
+ data: { default: () => [] },
24
+ size: { default: 240 },
25
+ thickness: {},
26
+ pie: { type: Boolean },
27
+ gap: { default: 2 },
28
+ animate: {
29
+ type: [Boolean, Object],
30
+ default: !0
31
+ },
32
+ legend: {
33
+ type: Boolean,
34
+ default: !0
35
+ },
36
+ locale: {},
37
+ format: {},
38
+ label: {},
39
+ unstyled: {
40
+ type: Boolean,
41
+ default: void 0
42
+ },
43
+ class: {},
44
+ ui: {}
45
+ },
46
+ setup(g) {
47
+ let T = g, ae = e(), E = d(() => T.unstyled ?? ae.unstyled), D = b(), { width: O } = t(D), oe = d(() => new Intl.NumberFormat(T.locale, T.format));
48
+ function k(e) {
49
+ return oe.value.format(e);
50
+ }
51
+ let A = d(() => new Intl.NumberFormat(T.locale, {
52
+ style: "percent",
53
+ maximumFractionDigits: 1
54
+ })), j = !1;
55
+ function M() {
56
+ j || process.env.NODE_ENV === "production" || (j = !0, console.warn("[iryx-ui] IDonutChart dropped a negative value. A share of a whole cannot be negative — plot the magnitudes, or use IBarChart, which has a baseline."));
57
+ }
58
+ let N = d(() => {
59
+ let e = T.data.map((e, t) => ({
60
+ datum: e,
61
+ index: t
62
+ })).filter(({ datum: e }) => {
63
+ let t = e.value;
64
+ return typeof t != "number" || !Number.isFinite(t) || t === 0 ? !1 : t < 0 ? (M(), !1) : !0;
65
+ });
66
+ a(e.length);
67
+ let t = e.reduce((e, { datum: t }) => e + t.value, 0);
68
+ return e.map(({ datum: e, index: n }) => ({
69
+ label: e.label,
70
+ value: e.value,
71
+ share: t ? e.value / t : 0,
72
+ color: r(i(e, n)),
73
+ index: n
74
+ }));
75
+ }), P = d(() => N.value.reduce((e, t) => e + t.value, 0)), F = d(() => N.value.map((e) => ({
76
+ key: `${e.index}-${e.label}`,
77
+ name: e.label,
78
+ slot: T.data[e.index]?.slot ?? e.index
79
+ }))), I = d(() => T.legend && N.value.length > 0), L = d(() => ({
80
+ x: O.value / 2,
81
+ y: T.size / 2
82
+ })), R = d(() => Math.max(Math.min(O.value, T.size) / 2, 0)), z = d(() => {
83
+ if (T.pie) return 0;
84
+ let e = Math.min(T.thickness ?? R.value * .4, R.value);
85
+ return Math.max(R.value - e, 0);
86
+ }), B = -Math.PI / 2, V = d(() => Math.max(T.gap, 0) / 2);
87
+ function H(e) {
88
+ return Math.round(e * 100) / 100;
89
+ }
90
+ function U(e, t) {
91
+ return [H(L.value.x + e * Math.cos(t)), H(L.value.y + e * Math.sin(t))];
92
+ }
93
+ let W = d(() => !!(O.value && R.value && N.value.length)), { progress: G } = s(W, o(d(() => T.animate))), K = d(() => {
94
+ if (!W.value) return [];
95
+ let e = G.value, t = B;
96
+ return N.value.flatMap((n) => {
97
+ let r = n.share * Math.PI * 2, i = t;
98
+ t += r;
99
+ let a = B + (i - B) * e, o = r * e;
100
+ return o <= 0 ? [] : [{
101
+ ...n,
102
+ mid: i + r / 2,
103
+ path: se(a, a + o)
104
+ }];
105
+ });
106
+ });
107
+ function q(e, t) {
108
+ let n = V.value;
109
+ return !n || e <= n ? 0 : Math.min(Math.asin(n / e), t / 3);
110
+ }
111
+ function se(e, t) {
112
+ let n = t - e, r = !z.value, i = N.value.length < 2 ? 0 : q(R.value, n), a = e + i, o = t - i, s = +(o - a > Math.PI), [c, l] = U(R.value, a), [u, d] = U(R.value, o);
113
+ if (r) {
114
+ let [t, r] = U(i ? Math.min(V.value / Math.sin(n / 2), R.value / 2) : 0, e + n / 2);
115
+ return `M${c} ${l} A${H(R.value)} ${H(R.value)} 0 ${s} 1 ${u} ${d} L${t} ${r} Z`;
116
+ }
117
+ let f = i ? q(z.value, n) : 0, p = +(n - f * 2 > Math.PI), [m, h] = U(z.value, t - f), [g, _] = U(z.value, e + f);
118
+ return `M${c} ${l} A${H(R.value)} ${H(R.value)} 0 ${s} 1 ${u} ${d} L${m} ${h} A${H(z.value)} ${H(z.value)} 0 ${p} 0 ${g} ${_} Z`;
119
+ }
120
+ let J = d(() => {
121
+ if (!(K.value.length !== 1 || !R.value || G.value < 1)) return {
122
+ ...K.value[0],
123
+ radius: z.value ? (R.value + z.value) / 2 : R.value,
124
+ strokeWidth: R.value - z.value
125
+ };
126
+ }), ce = d(() => J.value ? [] : K.value), Y = b(), X = d(() => {
127
+ if (Y.value == null) return;
128
+ let e = K.value.find((e) => e.index === Y.value);
129
+ if (!e) return;
130
+ let t = k(e.value), r = A.value.format(e.share), [i, a] = U(z.value ? (R.value + z.value) / 2 : R.value / 2, e.mid);
131
+ return {
132
+ label: e.label,
133
+ value: t,
134
+ share: r,
135
+ x: n(i, `${e.label}${t}${r}`, O.value),
136
+ y: a
137
+ };
138
+ }), Z = d(() => l());
139
+ function Q(e, t) {
140
+ let n = T.ui?.[e];
141
+ return E.value ? [n, t] : Z.value[e]({ class: [n, t] });
142
+ }
143
+ function $(e) {
144
+ let t = Y.value != null && Y.value !== e;
145
+ return E.value ? [T.ui?.slice] : Z.value.slice({ class: [T.ui?.slice, t ? Z.value.faded() : void 0] });
146
+ }
147
+ return (e, t) => (y(), m("div", {
148
+ ref_key: "root",
149
+ ref: D,
150
+ role: T.label ? "figure" : void 0,
151
+ "aria-label": T.label,
152
+ class: _(Q("root", T.class))
153
+ }, [
154
+ I.value ? (y(), f(c, {
155
+ key: 0,
156
+ series: F.value,
157
+ active: Y.value == null ? void 0 : N.value.findIndex((e) => e.index === Y.value),
158
+ unstyled: T.unstyled
159
+ }, null, 8, [
160
+ "series",
161
+ "active",
162
+ "unstyled"
163
+ ])) : p("", !0),
164
+ h("div", { class: _(E.value ? void 0 : Z.value.plot()) }, [
165
+ (y(), m("svg", {
166
+ width: C(O),
167
+ height: T.size,
168
+ viewBox: `0 0 ${C(O)} ${T.size}`,
169
+ "aria-hidden": "true",
170
+ class: _(Q("svg"))
171
+ }, [J.value ? (y(), m("circle", {
172
+ key: 0,
173
+ cx: L.value.x,
174
+ cy: L.value.y,
175
+ r: J.value.radius,
176
+ fill: z.value ? "none" : J.value.color,
177
+ stroke: z.value ? J.value.color : "none",
178
+ "stroke-width": z.value ? J.value.strokeWidth : 0,
179
+ class: _($(J.value.index)),
180
+ onPointerenter: t[0] ||= (e) => Y.value = J.value.index,
181
+ onPointerleave: t[1] ||= (e) => Y.value = void 0
182
+ }, null, 42, ne)) : p("", !0), (y(!0), m(u, null, x(ce.value, (e) => (y(), m("path", {
183
+ key: `slice-${e.index}`,
184
+ d: e.path,
185
+ style: v({ fill: e.color }),
186
+ class: _($(e.index)),
187
+ onPointerenter: (t) => Y.value = e.index,
188
+ onPointerleave: t[2] ||= (e) => Y.value = void 0
189
+ }, null, 46, re))), 128))], 10, w)),
190
+ e.$slots.center && z.value ? (y(), m("div", {
191
+ key: 0,
192
+ class: _(Q("center")),
193
+ style: v({
194
+ left: `${L.value.x}px`,
195
+ top: `${L.value.y}px`,
196
+ width: `${z.value * 2 * .82}px`,
197
+ transform: "translate(-50%, -50%)"
198
+ })
199
+ }, [ee(e.$slots, "center", {
200
+ total: P.value,
201
+ formatted: k(P.value)
202
+ })], 6)) : p("", !0),
203
+ X.value ? (y(), m("div", {
204
+ key: 1,
205
+ class: _(Q("tooltip")),
206
+ style: v({
207
+ left: `${X.value.x}px`,
208
+ top: `${X.value.y}px`,
209
+ transform: "translate(-50%, -50%)"
210
+ })
211
+ }, [
212
+ h("span", { class: _(Q("tooltipLabel")) }, S(X.value.label), 3),
213
+ h("span", { class: _(Q("tooltipValue")) }, S(X.value.value), 3),
214
+ h("span", { class: _(Q("tooltipShare")) }, S(X.value.share), 3)
215
+ ], 6)) : p("", !0)
216
+ ], 2),
217
+ h("div", { class: _(Q("table")) }, [h("table", null, [
218
+ h("caption", null, S(T.label), 1),
219
+ t[3] ||= h("thead", null, [h("tr", null, [
220
+ h("th", { scope: "col" }, " Category "),
221
+ h("th", { scope: "col" }, " Value "),
222
+ h("th", { scope: "col" }, " Share ")
223
+ ])], -1),
224
+ h("tbody", null, [(y(!0), m(u, null, x(N.value, (e) => (y(), m("tr", { key: `row-${e.index}` }, [
225
+ h("th", ie, S(e.label), 1),
226
+ h("td", null, S(k(e.value)), 1),
227
+ h("td", null, S(A.value.format(e.share)), 1)
228
+ ]))), 128))])
229
+ ])], 2)
230
+ ], 10, te));
231
+ }
232
+ });
233
+ //#endregion
234
+ export { T as default };
@@ -4,6 +4,7 @@ export interface DropdownMenuProps {
4
4
  items?: DropdownMenuEntry[];
5
5
  /** Which edge of the trigger to align to. */
6
6
  align?: 'start' | 'center' | 'end';
7
+ alignOffset?: number;
7
8
  side?: 'top' | 'right' | 'bottom' | 'left';
8
9
  sideOffset?: number;
9
10
  /** Skip built-in classes; you take over styling entirely. */
@@ -12,6 +13,7 @@ export interface DropdownMenuProps {
12
13
  /** Override classes per slot, e.g. `{ item: 'py-2' }`. */
13
14
  ui?: {
14
15
  content?: string;
16
+ header?: string;
15
17
  item?: string;
16
18
  label?: string;
17
19
  separator?: string;
@@ -20,16 +22,21 @@ export interface DropdownMenuProps {
20
22
  };
21
23
  }
22
24
  type __VLS_Props = DropdownMenuProps;
25
+ type __VLS_Slots = {
26
+ /** What opens the menu. */
27
+ trigger?: () => unknown;
28
+ /**
29
+ * A block above the items — an account's name and address, a workspace, a
30
+ * plan. Not a menu row: it is not focusable and nothing selects it.
31
+ */
32
+ header?: () => unknown;
33
+ /** Replaces the items entirely. */
34
+ default?: () => unknown;
35
+ };
23
36
  type __VLS_ModelProps = {
24
37
  'open'?: boolean;
25
38
  };
26
39
  type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
27
- declare var __VLS_14: {}, __VLS_28: {};
28
- type __VLS_Slots = {} & {
29
- trigger?: (props: typeof __VLS_14) => any;
30
- } & {
31
- default?: (props: typeof __VLS_28) => any;
32
- };
33
40
  declare const __VLS_base: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
34
41
  "update:open": (value: boolean) => any;
35
42
  }, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{