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.
- package/README.md +3 -1
- package/dist/component-names.d.ts +1 -1
- package/dist/component-names.js +1 -1
- package/dist/components/BarChart.vue.d.ts +8 -0
- package/dist/components/BarChart.vue_vue_type_script_setup_true_lang.js +169 -151
- package/dist/components/Calendar.js +5 -0
- package/dist/components/Calendar.vue.d.ts +69 -0
- package/dist/components/Calendar.vue_vue_type_script_setup_true_lang.js +168 -0
- package/dist/components/Combobox.vue.d.ts +9 -9
- package/dist/components/Combobox.vue_vue_type_script_setup_true_lang.js +180 -144
- package/dist/components/DateField.js +5 -0
- package/dist/components/DateField.vue.d.ts +38 -0
- package/dist/components/DateField.vue_vue_type_script_setup_true_lang.js +94 -0
- package/dist/components/DatePicker.vue.d.ts +7 -2
- package/dist/components/DatePicker.vue_vue_type_script_setup_true_lang.js +73 -124
- package/dist/components/DateRangePicker.vue.d.ts +2 -2
- package/dist/components/DateRangePicker.vue_vue_type_script_setup_true_lang.js +81 -78
- package/dist/components/DonutChart.js +5 -0
- package/dist/components/DonutChart.vue.d.ts +96 -0
- package/dist/components/DonutChart.vue_vue_type_script_setup_true_lang.js +234 -0
- package/dist/components/DropdownMenu.vue.d.ts +13 -6
- package/dist/components/DropdownMenu.vue_vue_type_script_setup_true_lang.js +28 -22
- package/dist/components/Editable.js +5 -0
- package/dist/components/Editable.vue.d.ts +81 -0
- package/dist/components/Editable.vue_vue_type_script_setup_true_lang.js +140 -0
- package/dist/components/HoverCard.js +5 -0
- package/dist/components/HoverCard.vue.d.ts +68 -0
- package/dist/components/HoverCard.vue_vue_type_script_setup_true_lang.js +79 -0
- package/dist/components/LineChart.vue.d.ts +8 -0
- package/dist/components/LineChart.vue_vue_type_script_setup_true_lang.js +160 -141
- package/dist/components/Sparkline.vue.d.ts +9 -0
- package/dist/components/Sparkline.vue_vue_type_script_setup_true_lang.js +90 -53
- package/dist/components/TagsInput.vue.d.ts +2 -2
- package/dist/components/TimeField.vue_vue_type_script_setup_true_lang.js +17 -14
- package/dist/components/index.d.ts +5 -0
- package/dist/components/index.js +124 -114
- package/dist/composables/cartesian.d.ts +10 -2
- package/dist/composables/chart-reveal.d.ts +45 -0
- package/dist/composables/chart-reveal.js +93 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +142 -131
- package/dist/theme/accordion.d.ts +0 -15
- package/dist/theme/alert.d.ts +0 -3
- package/dist/theme/avatar.d.ts +0 -3
- package/dist/theme/banner.d.ts +0 -6
- package/dist/theme/bar-chart.d.ts +0 -18
- package/dist/theme/breadcrumb.d.ts +0 -3
- package/dist/theme/calendar.d.ts +62 -0
- package/dist/theme/calendar.js +29 -0
- package/dist/theme/card.d.ts +0 -6
- package/dist/theme/chart-legend.d.ts +0 -3
- package/dist/theme/checkbox.d.ts +0 -6
- package/dist/theme/color-picker.d.ts +0 -6
- package/dist/theme/combobox.js +4 -4
- package/dist/theme/command-palette.d.ts +0 -6
- package/dist/theme/container.d.ts +0 -3
- package/dist/theme/container.js +3 -3
- package/dist/theme/date-field.d.ts +65 -0
- package/dist/theme/date-field.js +21 -0
- package/dist/theme/date-picker.d.ts +0 -195
- package/dist/theme/date-picker.js +2 -24
- package/dist/theme/donut-chart.d.ts +86 -0
- package/dist/theme/donut-chart.js +17 -0
- package/dist/theme/dropdown-menu.d.ts +3 -0
- package/dist/theme/dropdown-menu.js +1 -0
- package/dist/theme/editable.d.ts +77 -0
- package/dist/theme/editable.js +26 -0
- package/dist/theme/empty-state.d.ts +0 -3
- package/dist/theme/file-upload.d.ts +0 -39
- package/dist/theme/hover-card.d.ts +92 -0
- package/dist/theme/hover-card.js +28 -0
- package/dist/theme/index.d.ts +5 -0
- package/dist/theme/input.d.ts +0 -18
- package/dist/theme/kbd.d.ts +0 -3
- package/dist/theme/line-chart.d.ts +0 -18
- package/dist/theme/navigation-menu.d.ts +0 -48
- package/dist/theme/number-input.d.ts +0 -3
- package/dist/theme/page-header.d.ts +0 -3
- package/dist/theme/password-input.d.ts +0 -23
- package/dist/theme/pin-input.d.ts +0 -3
- package/dist/theme/popover.d.ts +0 -6
- package/dist/theme/progress.d.ts +0 -51
- package/dist/theme/scroll-area.d.ts +0 -3
- package/dist/theme/separator.d.ts +0 -3
- package/dist/theme/sidebar.d.ts +0 -54
- package/dist/theme/skeleton.d.ts +0 -3
- package/dist/theme/skeleton.js +1 -1
- package/dist/theme/slider.d.ts +0 -6
- package/dist/theme/sparkline.d.ts +0 -11
- package/dist/theme/sparkline.js +1 -1
- package/dist/theme/splitter.d.ts +0 -3
- package/dist/theme/stat.d.ts +0 -12
- package/dist/theme/stat.js +2 -2
- package/dist/theme/switch.d.ts +0 -6
- package/dist/theme/table.d.ts +0 -39
- package/dist/theme/tabs.d.ts +0 -12
- package/dist/theme/time-field.d.ts +0 -3
- package/dist/theme/timeline.d.ts +0 -18
- package/dist/theme/toast.d.ts +0 -3
- package/dist/theme/toggle.d.ts +0 -23
- package/dist/theme/tree.d.ts +0 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Consumed by the Vue plugin (global registration) and the Nuxt module
|
|
4
4
|
* (auto-imports). Keep in sync with `src/components/index.ts`.
|
|
5
5
|
*/
|
|
6
|
-
export declare const componentNames: readonly ["Accordion", "Alert", "App", "AppShell", "AspectRatio", "Avatar", "AvatarGroup", "Badge", "BarChart", "Banner", "Breadcrumb", "Button", "ButtonGroup", "Card", "ChartLegend", "Checkbox", "ColorPicker", "Combobox", "Collapsible", "CommandPalette", "Container", "ConfirmDialog", "ContextMenu", "DatePicker", "DateRangePicker", "Dialog", "Drawer", "DropdownMenu", "EmptyState", "FileUpload", "Form", "FormField", "Icon", "Input", "Kbd", "Label", "LineChart", "NavigationMenu", "NumberInput", "Menubar", "PageHeader", "Pagination", "PasswordInput", "PinInput", "Popover", "Progress", "RadioGroup", "ScrollArea", "ScrollFade", "Select", "Separator", "Sidebar", "SignaturePad", "Skeleton", "Slider", "Sparkline", "Splitter", "Stat", "Stepper", "Switch", "Table", "Tabs", "TagsInput", "Textarea", "Toaster", "Toggle", "ToggleGroup", "TimeField", "Timeline", "Toolbar", "Tooltip", "Tree"];
|
|
6
|
+
export declare const componentNames: readonly ["Accordion", "Alert", "App", "AppShell", "AspectRatio", "Avatar", "AvatarGroup", "Badge", "BarChart", "Banner", "Breadcrumb", "Button", "ButtonGroup", "Calendar", "Card", "ChartLegend", "Checkbox", "ColorPicker", "Combobox", "Collapsible", "CommandPalette", "Container", "ConfirmDialog", "ContextMenu", "DateField", "DatePicker", "DateRangePicker", "Dialog", "DonutChart", "Drawer", "DropdownMenu", "Editable", "EmptyState", "FileUpload", "Form", "FormField", "HoverCard", "Icon", "Input", "Kbd", "Label", "LineChart", "NavigationMenu", "NumberInput", "Menubar", "PageHeader", "Pagination", "PasswordInput", "PinInput", "Popover", "Progress", "RadioGroup", "ScrollArea", "ScrollFade", "Select", "Separator", "Sidebar", "SignaturePad", "Skeleton", "Slider", "Sparkline", "Splitter", "Stat", "Stepper", "Switch", "Table", "Tabs", "TagsInput", "Textarea", "Toaster", "Toggle", "ToggleGroup", "TimeField", "Timeline", "Toolbar", "Tooltip", "Tree"];
|
|
7
7
|
export type ComponentName = (typeof componentNames)[number];
|
package/dist/component-names.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
//#region src/component-names.ts
|
|
2
|
-
var e = /* @__PURE__ */ "Accordion.Alert.App.AppShell.AspectRatio.Avatar.AvatarGroup.Badge.BarChart.Banner.Breadcrumb.Button.ButtonGroup.Card.ChartLegend.Checkbox.ColorPicker.Combobox.Collapsible.CommandPalette.Container.ConfirmDialog.ContextMenu.DatePicker.DateRangePicker.Dialog.Drawer.DropdownMenu.EmptyState.FileUpload.Form.FormField.Icon.Input.Kbd.Label.LineChart.NavigationMenu.NumberInput.Menubar.PageHeader.Pagination.PasswordInput.PinInput.Popover.Progress.RadioGroup.ScrollArea.ScrollFade.Select.Separator.Sidebar.SignaturePad.Skeleton.Slider.Sparkline.Splitter.Stat.Stepper.Switch.Table.Tabs.TagsInput.Textarea.Toaster.Toggle.ToggleGroup.TimeField.Timeline.Toolbar.Tooltip.Tree".split(".");
|
|
2
|
+
var e = /* @__PURE__ */ "Accordion.Alert.App.AppShell.AspectRatio.Avatar.AvatarGroup.Badge.BarChart.Banner.Breadcrumb.Button.ButtonGroup.Calendar.Card.ChartLegend.Checkbox.ColorPicker.Combobox.Collapsible.CommandPalette.Container.ConfirmDialog.ContextMenu.DateField.DatePicker.DateRangePicker.Dialog.DonutChart.Drawer.DropdownMenu.Editable.EmptyState.FileUpload.Form.FormField.HoverCard.Icon.Input.Kbd.Label.LineChart.NavigationMenu.NumberInput.Menubar.PageHeader.Pagination.PasswordInput.PinInput.Popover.Progress.RadioGroup.ScrollArea.ScrollFade.Select.Separator.Sidebar.SignaturePad.Skeleton.Slider.Sparkline.Splitter.Stat.Stepper.Switch.Table.Tabs.TagsInput.Textarea.Toaster.Toggle.ToggleGroup.TimeField.Timeline.Toolbar.Tooltip.Tree".split(".");
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as componentNames };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ChartSeries } from '../composables/cartesian';
|
|
2
|
+
import type { ChartAnimate } from '../composables/chart-reveal';
|
|
2
3
|
import type { SparseValue } from '../composables/scale';
|
|
3
4
|
/**
|
|
4
5
|
* A row. `value` is the single-series shortcut; with `series` set, each entry
|
|
@@ -37,6 +38,12 @@ export interface BarChartProps {
|
|
|
37
38
|
ticks?: number;
|
|
38
39
|
/** Drop the value axis and its gridlines. */
|
|
39
40
|
axis?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Grow the bars out of the baseline on the first paint. Skipped for a
|
|
43
|
+
* reader who has asked for reduced motion, and played once — not again when
|
|
44
|
+
* the data changes underneath it.
|
|
45
|
+
*/
|
|
46
|
+
animate?: ChartAnimate;
|
|
40
47
|
/** Drop the legend. Only honoured for a single series — see below. */
|
|
41
48
|
legend?: boolean;
|
|
42
49
|
/** Word for the stacked tooltip's sum — override for non-English apps. */
|
|
@@ -95,6 +102,7 @@ declare const __VLS_base: import("vue").DefineComponent<BarChartProps, {}, {}, {
|
|
|
95
102
|
orientation: "vertical" | "horizontal";
|
|
96
103
|
data: readonly BarChartDatum[];
|
|
97
104
|
legend: boolean;
|
|
105
|
+
animate: ChartAnimate;
|
|
98
106
|
height: number;
|
|
99
107
|
ticks: number;
|
|
100
108
|
axis: boolean;
|
|
@@ -1,39 +1,40 @@
|
|
|
1
1
|
import { useIryxUiConfig as e } from "../config.js";
|
|
2
2
|
import { useElementSize as t } from "../composables/element-size.js";
|
|
3
3
|
import { cartesianLayout as n, clampTooltip as r, seriesColor as i, slotOf as a, tooltipHalfWidth as o, warnOnSlotOverflow as s } from "../composables/cartesian.js";
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import { useChartAnimation as c, useChartReveal as l } from "../composables/chart-reveal.js";
|
|
5
|
+
import { barChartTheme as u } from "../theme/bar-chart.js";
|
|
6
|
+
import d from "./ChartLegend.js";
|
|
7
|
+
import { Fragment as f, computed as p, createBlock as m, createCommentVNode as h, createElementBlock as g, createElementVNode as _, defineComponent as v, guardReactiveProps as y, normalizeClass as b, normalizeProps as x, normalizeStyle as S, openBlock as C, ref as w, renderList as T, renderSlot as E, toDisplayString as D, unref as O } from "vue";
|
|
7
8
|
//#region src/components/BarChart.vue?vue&type=script&setup=true&lang.ts
|
|
8
|
-
var ee = ["role", "aria-label"],
|
|
9
|
+
var ee = ["role", "aria-label"], te = [
|
|
9
10
|
"width",
|
|
10
11
|
"height",
|
|
11
12
|
"viewBox"
|
|
12
|
-
],
|
|
13
|
+
], ne = [
|
|
13
14
|
"x1",
|
|
14
15
|
"y1",
|
|
15
16
|
"x2",
|
|
16
17
|
"y2"
|
|
17
|
-
],
|
|
18
|
+
], re = [
|
|
18
19
|
"x",
|
|
19
20
|
"y",
|
|
20
21
|
"text-anchor",
|
|
21
22
|
"dominant-baseline"
|
|
22
|
-
],
|
|
23
|
+
], ie = ["d"], k = [
|
|
23
24
|
"x",
|
|
24
25
|
"y",
|
|
25
26
|
"text-anchor",
|
|
26
27
|
"dominant-baseline"
|
|
27
|
-
],
|
|
28
|
+
], ae = [
|
|
28
29
|
"x",
|
|
29
30
|
"y",
|
|
30
31
|
"width",
|
|
31
32
|
"height",
|
|
32
33
|
"onPointerenter"
|
|
33
|
-
],
|
|
34
|
+
], oe = {
|
|
34
35
|
key: 2,
|
|
35
36
|
class: "flex items-center gap-1.5 border-t border-border pt-1"
|
|
36
|
-
},
|
|
37
|
+
}, se = { scope: "row" }, ce = .7, A = /*@__PURE__*/ v({
|
|
37
38
|
__name: "BarChart",
|
|
38
39
|
props: {
|
|
39
40
|
data: { default: () => [] },
|
|
@@ -46,6 +47,10 @@ var ee = ["role", "aria-label"], D = [
|
|
|
46
47
|
type: Boolean,
|
|
47
48
|
default: !0
|
|
48
49
|
},
|
|
50
|
+
animate: {
|
|
51
|
+
type: [Boolean, Object],
|
|
52
|
+
default: !0
|
|
53
|
+
},
|
|
49
54
|
legend: {
|
|
50
55
|
type: Boolean,
|
|
51
56
|
default: !0
|
|
@@ -61,60 +66,60 @@ var ee = ["role", "aria-label"], D = [
|
|
|
61
66
|
class: {},
|
|
62
67
|
ui: {}
|
|
63
68
|
},
|
|
64
|
-
setup(
|
|
65
|
-
let
|
|
66
|
-
function
|
|
67
|
-
return
|
|
69
|
+
setup(v) {
|
|
70
|
+
let A = v, j = e(), M = p(() => A.unstyled ?? j.unstyled), N = w(), { width: P } = t(N), le = p(() => new Intl.NumberFormat(A.locale, A.format));
|
|
71
|
+
function F(e) {
|
|
72
|
+
return le.value.format(e);
|
|
68
73
|
}
|
|
69
|
-
let
|
|
70
|
-
let e =
|
|
74
|
+
let I = p(() => {
|
|
75
|
+
let e = A.series?.length ? [...A.series] : [{ key: "value" }];
|
|
71
76
|
return s(e.length), e;
|
|
72
|
-
}),
|
|
73
|
-
function
|
|
77
|
+
}), L = p(() => I.value.length > 1), ue = p(() => L.value || A.legend && I.value[0].name != null);
|
|
78
|
+
function R(e, t) {
|
|
74
79
|
let n = e[t];
|
|
75
80
|
return typeof n == "number" && Number.isFinite(n) ? n : null;
|
|
76
81
|
}
|
|
77
|
-
let
|
|
78
|
-
function
|
|
82
|
+
let z = p(() => A.orientation === "horizontal"), B = p(() => A.stacked && L.value);
|
|
83
|
+
function V(e) {
|
|
79
84
|
let t = 0, n = 0;
|
|
80
|
-
for (let r of
|
|
81
|
-
let i =
|
|
85
|
+
for (let r of I.value) {
|
|
86
|
+
let i = R(e, r.key);
|
|
82
87
|
i != null && (i >= 0 ? t += i : n += i);
|
|
83
88
|
}
|
|
84
89
|
return [t, n];
|
|
85
90
|
}
|
|
86
|
-
let
|
|
87
|
-
orientation:
|
|
88
|
-
values:
|
|
89
|
-
categories:
|
|
90
|
-
longestLabel: Math.max(...
|
|
91
|
-
width:
|
|
92
|
-
height:
|
|
93
|
-
tickCount:
|
|
94
|
-
showAxis:
|
|
95
|
-
formatTick:
|
|
91
|
+
let H = p(() => n({
|
|
92
|
+
orientation: A.orientation,
|
|
93
|
+
values: B.value ? A.data.flatMap(V) : A.data.flatMap((e) => I.value.map((t) => R(e, t.key))),
|
|
94
|
+
categories: A.data.length,
|
|
95
|
+
longestLabel: Math.max(...A.data.map((e) => e.label.length), 1),
|
|
96
|
+
width: P.value,
|
|
97
|
+
height: A.height,
|
|
98
|
+
tickCount: A.ticks,
|
|
99
|
+
showAxis: A.axis,
|
|
100
|
+
formatTick: F,
|
|
96
101
|
includeZero: !0
|
|
97
|
-
})),
|
|
98
|
-
if (!
|
|
99
|
-
let e =
|
|
100
|
-
return
|
|
101
|
-
let a = 0, o = 0, s =
|
|
102
|
-
let i =
|
|
102
|
+
})), U = p(() => H.value.plot), W = p(() => H.value.y), G = p(() => H.value.bandWidth), de = p(() => G.value * ce), K = p(() => Math.max(2, Math.min(24, de.value / (B.value ? 1 : I.value.length)))), q = p(() => {
|
|
103
|
+
if (!P.value || !A.data.length) return [];
|
|
104
|
+
let e = H.value.value(0), t = I.value.length, n = +(t > 1 && !B.value);
|
|
105
|
+
return A.data.flatMap((r, i) => {
|
|
106
|
+
let a = 0, o = 0, s = I.value.reduce((e, t, n) => {
|
|
107
|
+
let i = R(r, t.key);
|
|
103
108
|
return i != null && i >= 0 ? n : e;
|
|
104
|
-
}, -1), c =
|
|
105
|
-
let i =
|
|
109
|
+
}, -1), c = I.value.reduce((e, t, n) => {
|
|
110
|
+
let i = R(r, t.key);
|
|
106
111
|
return i != null && i < 0 ? n : e;
|
|
107
112
|
}, -1);
|
|
108
|
-
return
|
|
109
|
-
let d =
|
|
113
|
+
return I.value.flatMap((l, u) => {
|
|
114
|
+
let d = R(r, l.key);
|
|
110
115
|
if (d == null) return [];
|
|
111
116
|
let f = e, p;
|
|
112
|
-
if (
|
|
117
|
+
if (B.value) {
|
|
113
118
|
let e = d >= 0 ? a : o, t = e + d;
|
|
114
|
-
f =
|
|
115
|
-
} else p =
|
|
116
|
-
let m =
|
|
117
|
-
return [
|
|
119
|
+
f = H.value.value(e), p = H.value.value(t), d >= 0 ? a = t : o = t;
|
|
120
|
+
} else p = H.value.value(d);
|
|
121
|
+
let m = B.value ? K.value : K.value * t, h = H.value.bandCentre(i) - m / 2 + (B.value ? 0 : K.value * u) + n, g = Math.max(K.value - n * 2, 1), _ = B.value ? Math.min(2, Math.abs(p - f) / 2) : 0, v = Math.max(Math.abs(p - f) - _, 0), y = p < f ? p + _ : f, b = !B.value || u === (d >= 0 ? s : c);
|
|
122
|
+
return [z.value ? {
|
|
118
123
|
x: y,
|
|
119
124
|
y: h,
|
|
120
125
|
width: v,
|
|
@@ -136,7 +141,7 @@ var ee = ["role", "aria-label"], D = [
|
|
|
136
141
|
});
|
|
137
142
|
});
|
|
138
143
|
});
|
|
139
|
-
function
|
|
144
|
+
function fe(e) {
|
|
140
145
|
let { x: t, y: n, width: r, height: i } = e, a = t + r;
|
|
141
146
|
if (!e.capped) return `M${t} ${n} L${a} ${n} L${a} ${n + i} L${t} ${n + i} Z`;
|
|
142
147
|
let o = n + i, s = Math.min(4, r / 2, i / 2, e.direction === "up" || e.direction === "down" ? i : r);
|
|
@@ -147,154 +152,167 @@ var ee = ["role", "aria-label"], D = [
|
|
|
147
152
|
default: return `M${a} ${n} L${t + s} ${n} Q${t} ${n} ${t} ${n + s} L${t} ${o - s} Q${t} ${o} ${t + s} ${o} L${a} ${o} Z`;
|
|
148
153
|
}
|
|
149
154
|
}
|
|
150
|
-
let
|
|
151
|
-
if (
|
|
152
|
-
let e =
|
|
155
|
+
let J = p(() => H.value.labelStep), Y = w(), X = p(() => {
|
|
156
|
+
if (Y.value == null) return;
|
|
157
|
+
let e = A.data[Y.value];
|
|
153
158
|
if (!e) return;
|
|
154
|
-
let t =
|
|
159
|
+
let t = I.value.map((t, n) => ({
|
|
155
160
|
name: t.name ?? t.key,
|
|
156
161
|
color: i(a(t, n)),
|
|
157
|
-
value:
|
|
162
|
+
value: R(e, t.key)
|
|
158
163
|
})).filter((e) => e.value != null).map((e) => ({
|
|
159
164
|
...e,
|
|
160
|
-
value:
|
|
165
|
+
value: F(e.value)
|
|
161
166
|
}));
|
|
162
167
|
if (!t.length) return;
|
|
163
|
-
let n =
|
|
164
|
-
if (
|
|
165
|
-
let i =
|
|
166
|
-
let n =
|
|
167
|
-
return n == null ? -Infinity :
|
|
168
|
-
})), a = "x".repeat(s), l = o(a), u = i + l + 8, d = u + l <=
|
|
168
|
+
let n = B.value ? F(V(e).reduce((e, t) => e + t, 0)) : void 0, s = L.value ? Math.max(e.label.length, n ? n.length + 6 : 0, ...t.map((e) => e.name.length + e.value.length + 3)) : e.label.length + t[0].value.length + 2, c = H.value.bandCentre(Y.value);
|
|
169
|
+
if (z.value) {
|
|
170
|
+
let i = B.value ? H.value.value(V(e)[0]) : Math.max(...I.value.map((t) => {
|
|
171
|
+
let n = R(e, t.key);
|
|
172
|
+
return n == null ? -Infinity : H.value.value(n);
|
|
173
|
+
})), a = "x".repeat(s), l = o(a), u = i + l + 8, d = u + l <= P.value;
|
|
169
174
|
return {
|
|
170
175
|
label: e.label,
|
|
171
176
|
rows: t,
|
|
172
177
|
total: n,
|
|
173
|
-
multi:
|
|
174
|
-
x: r(d ? u : i - l - 8, a,
|
|
178
|
+
multi: L.value,
|
|
179
|
+
x: r(d ? u : i - l - 8, a, P.value),
|
|
175
180
|
y: c
|
|
176
181
|
};
|
|
177
182
|
}
|
|
178
|
-
let l =
|
|
179
|
-
let n =
|
|
180
|
-
return n == null ? Infinity : Math.min(
|
|
183
|
+
let l = B.value ? H.value.value(V(e)[0]) : Math.min(...I.value.map((t) => {
|
|
184
|
+
let n = R(e, t.key);
|
|
185
|
+
return n == null ? Infinity : Math.min(H.value.value(n), H.value.value(0));
|
|
181
186
|
}));
|
|
182
187
|
return {
|
|
183
188
|
label: e.label,
|
|
184
189
|
rows: t,
|
|
185
190
|
total: n,
|
|
186
|
-
multi:
|
|
187
|
-
x: r(c, "x".repeat(s),
|
|
191
|
+
multi: L.value,
|
|
192
|
+
x: r(c, "x".repeat(s), P.value),
|
|
188
193
|
y: l
|
|
189
194
|
};
|
|
190
|
-
}),
|
|
191
|
-
function
|
|
192
|
-
let n =
|
|
193
|
-
return
|
|
195
|
+
}), Z = p(() => u());
|
|
196
|
+
function Q(e, t) {
|
|
197
|
+
let n = A.ui?.[e];
|
|
198
|
+
return M.value ? [n, t] : Z.value[e]({ class: [n, t] });
|
|
199
|
+
}
|
|
200
|
+
let pe = p(() => !!(P.value && q.value.length)), $ = c(p(() => A.animate)), { revealed: me } = l(pe, $);
|
|
201
|
+
function he(e) {
|
|
202
|
+
let t = H.value.value(0), n = z.value ? e.y + e.height / 2 : e.x + e.width / 2, r = z.value ? "scaleX" : "scaleY";
|
|
203
|
+
return {
|
|
204
|
+
transformOrigin: z.value ? `${t}px ${n}px` : `${n}px ${t}px`,
|
|
205
|
+
transform: `${r}(${+!!me.value})`,
|
|
206
|
+
transition: `transform ${$.value.duration}ms ${$.value.css}`,
|
|
207
|
+
transitionDelay: `${Math.min(e.categoryIndex * 30, 200)}ms`
|
|
208
|
+
};
|
|
194
209
|
}
|
|
195
|
-
function
|
|
196
|
-
let t =
|
|
197
|
-
return
|
|
210
|
+
function ge(e) {
|
|
211
|
+
let t = Y.value != null && Y.value !== e.categoryIndex;
|
|
212
|
+
return M.value ? [A.ui?.bar] : Z.value.bar({ class: [A.ui?.bar, t ? Z.value.faded() : void 0] });
|
|
198
213
|
}
|
|
199
|
-
return (e, t) => (
|
|
214
|
+
return (e, t) => (C(), g("div", {
|
|
200
215
|
ref_key: "root",
|
|
201
|
-
ref:
|
|
202
|
-
role:
|
|
203
|
-
"aria-label":
|
|
204
|
-
class:
|
|
216
|
+
ref: N,
|
|
217
|
+
role: A.label ? "figure" : void 0,
|
|
218
|
+
"aria-label": A.label,
|
|
219
|
+
class: b(Q("root", A.class))
|
|
205
220
|
}, [
|
|
206
|
-
|
|
221
|
+
ue.value ? (C(), m(d, {
|
|
207
222
|
key: 0,
|
|
208
|
-
series:
|
|
209
|
-
unstyled:
|
|
210
|
-
}, null, 8, ["series", "unstyled"])) :
|
|
211
|
-
|
|
212
|
-
width:
|
|
213
|
-
height:
|
|
214
|
-
viewBox: `0 0 ${
|
|
223
|
+
series: I.value,
|
|
224
|
+
unstyled: A.unstyled
|
|
225
|
+
}, null, 8, ["series", "unstyled"])) : h("", !0),
|
|
226
|
+
_("div", { class: b(M.value ? void 0 : Z.value.plot()) }, [(C(), g("svg", {
|
|
227
|
+
width: O(P),
|
|
228
|
+
height: A.height,
|
|
229
|
+
viewBox: `0 0 ${O(P)} ${A.height}`,
|
|
215
230
|
"aria-hidden": "true",
|
|
216
|
-
class:
|
|
231
|
+
class: b(Q("svg"))
|
|
217
232
|
}, [
|
|
218
|
-
|
|
219
|
-
x1:
|
|
220
|
-
y1:
|
|
221
|
-
x2:
|
|
222
|
-
y2:
|
|
233
|
+
A.axis ? (C(!0), g(f, { key: 0 }, T(H.value.ticks, (e) => (C(), g("g", { key: `tick-${e}` }, [_("line", {
|
|
234
|
+
x1: z.value ? H.value.value(e) : U.value.left,
|
|
235
|
+
y1: z.value ? U.value.top : W.value(e),
|
|
236
|
+
x2: z.value ? H.value.value(e) : U.value.left + U.value.width,
|
|
237
|
+
y2: z.value ? U.value.top + U.value.height : W.value(e),
|
|
223
238
|
"stroke-width": "1",
|
|
224
|
-
class:
|
|
225
|
-
}, null, 10,
|
|
226
|
-
x:
|
|
227
|
-
y:
|
|
228
|
-
"text-anchor":
|
|
229
|
-
"dominant-baseline":
|
|
230
|
-
class:
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
(
|
|
239
|
+
class: b(Q("grid"))
|
|
240
|
+
}, null, 10, ne), _("text", {
|
|
241
|
+
x: z.value ? H.value.value(e) : U.value.left - O(8),
|
|
242
|
+
y: z.value ? U.value.top + U.value.height + 14 : W.value(e),
|
|
243
|
+
"text-anchor": z.value ? "middle" : "end",
|
|
244
|
+
"dominant-baseline": z.value ? void 0 : "middle",
|
|
245
|
+
class: b(Q("tick"))
|
|
246
|
+
}, D(F(e)), 11, re)]))), 128)) : h("", !0),
|
|
247
|
+
E(e.$slots, "underlay", x(y(H.value))),
|
|
248
|
+
(C(!0), g(f, null, T(q.value, (e, t) => (C(), g("path", {
|
|
234
249
|
key: `bar-${e.categoryIndex}-${e.seriesIndex}-${t}`,
|
|
235
|
-
d:
|
|
236
|
-
style:
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
250
|
+
d: fe(e),
|
|
251
|
+
style: S({
|
|
252
|
+
fill: O(i)(O(a)(I.value[e.seriesIndex], e.seriesIndex)),
|
|
253
|
+
...he(e)
|
|
254
|
+
}),
|
|
255
|
+
class: b(ge(e))
|
|
256
|
+
}, null, 14, ie))), 128)),
|
|
257
|
+
(C(!0), g(f, null, T(A.data, (e, t) => (C(), g(f, { key: `label-${e.label}-${t}` }, [t % J.value === 0 ? (C(), g("text", {
|
|
240
258
|
key: 0,
|
|
241
|
-
x:
|
|
242
|
-
y:
|
|
243
|
-
"text-anchor":
|
|
244
|
-
"dominant-baseline":
|
|
245
|
-
class:
|
|
246
|
-
},
|
|
247
|
-
|
|
248
|
-
(
|
|
259
|
+
x: z.value ? U.value.left - O(8) : H.value.bandCentre(t),
|
|
260
|
+
y: z.value ? H.value.bandCentre(t) : U.value.top + U.value.height + 14,
|
|
261
|
+
"text-anchor": z.value ? "end" : "middle",
|
|
262
|
+
"dominant-baseline": z.value ? "middle" : void 0,
|
|
263
|
+
class: b(Q("category"))
|
|
264
|
+
}, D(e.label), 11, k)) : h("", !0)], 64))), 128)),
|
|
265
|
+
E(e.$slots, "overlay", x(y(H.value))),
|
|
266
|
+
(C(!0), g(f, null, T(A.data, (e, n) => (C(), g("rect", {
|
|
249
267
|
key: `hit-${e.label}-${n}`,
|
|
250
|
-
x:
|
|
251
|
-
y:
|
|
252
|
-
width:
|
|
253
|
-
height:
|
|
254
|
-
class:
|
|
255
|
-
onPointerenter: (e) =>
|
|
256
|
-
onPointerleave: t[0] ||= (e) =>
|
|
257
|
-
}, null, 42,
|
|
258
|
-
], 10,
|
|
268
|
+
x: z.value ? U.value.left : U.value.left + G.value * n,
|
|
269
|
+
y: z.value ? U.value.top + G.value * n : U.value.top,
|
|
270
|
+
width: z.value ? U.value.width : G.value,
|
|
271
|
+
height: z.value ? G.value : U.value.height,
|
|
272
|
+
class: b(M.value ? void 0 : Z.value.hit()),
|
|
273
|
+
onPointerenter: (e) => Y.value = n,
|
|
274
|
+
onPointerleave: t[0] ||= (e) => Y.value = void 0
|
|
275
|
+
}, null, 42, ae))), 128))
|
|
276
|
+
], 10, te)), X.value ? (C(), g("div", {
|
|
259
277
|
key: 0,
|
|
260
|
-
class:
|
|
261
|
-
style:
|
|
262
|
-
left: `${
|
|
263
|
-
top: `${
|
|
264
|
-
transform:
|
|
278
|
+
class: b(Q("tooltip", X.value.multi ? "flex-col items-start gap-1" : void 0)),
|
|
279
|
+
style: S({
|
|
280
|
+
left: `${X.value.x}px`,
|
|
281
|
+
top: `${X.value.y}px`,
|
|
282
|
+
transform: z.value ? "translate(-50%, -50%)" : "translate(-50%, -100%) translateY(-8px)"
|
|
265
283
|
})
|
|
266
284
|
}, [
|
|
267
|
-
|
|
268
|
-
|
|
285
|
+
_("span", { class: b(Q("tooltipLabel")) }, D(X.value.label), 3),
|
|
286
|
+
X.value.multi ? (C(!0), g(f, { key: 0 }, T(X.value.rows, (e) => (C(), g("span", {
|
|
269
287
|
key: e.name,
|
|
270
288
|
class: "flex items-center gap-1.5"
|
|
271
289
|
}, [
|
|
272
|
-
|
|
290
|
+
_("span", {
|
|
273
291
|
class: "size-2 shrink-0 rounded-full",
|
|
274
|
-
style:
|
|
292
|
+
style: S({ background: e.color })
|
|
275
293
|
}, null, 4),
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
]))), 128)) : (
|
|
294
|
+
_("span", { class: b(Q("tooltipLabel")) }, D(e.name), 3),
|
|
295
|
+
_("span", { class: b(Q("tooltipValue")) }, D(e.value), 3)
|
|
296
|
+
]))), 128)) : (C(), g("span", {
|
|
279
297
|
key: 1,
|
|
280
|
-
class:
|
|
281
|
-
},
|
|
282
|
-
|
|
283
|
-
t[1] ||=
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
])) :
|
|
287
|
-
], 6)) :
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
298
|
+
class: b(Q("tooltipValue"))
|
|
299
|
+
}, D(X.value.rows[0].value), 3)),
|
|
300
|
+
X.value.total ? (C(), g("span", oe, [
|
|
301
|
+
t[1] ||= _("span", { class: "size-2 shrink-0" }, null, -1),
|
|
302
|
+
_("span", { class: b(Q("tooltipLabel")) }, D(A.totalLabel), 3),
|
|
303
|
+
_("span", { class: b(Q("tooltipValue")) }, D(X.value.total), 3)
|
|
304
|
+
])) : h("", !0)
|
|
305
|
+
], 6)) : h("", !0)], 2),
|
|
306
|
+
_("div", { class: b(Q("table")) }, [_("table", null, [
|
|
307
|
+
_("caption", null, D(A.label), 1),
|
|
308
|
+
_("thead", null, [_("tr", null, [t[2] ||= _("th", { scope: "col" }, " Category ", -1), (C(!0), g(f, null, T(I.value, (e) => (C(), g("th", {
|
|
291
309
|
key: e.key,
|
|
292
310
|
scope: "col"
|
|
293
|
-
},
|
|
294
|
-
|
|
311
|
+
}, D(e.name ?? "Value"), 1))), 128))])]),
|
|
312
|
+
_("tbody", null, [(C(!0), g(f, null, T(A.data, (e, t) => (C(), g("tr", { key: `row-${e.label}-${t}` }, [_("th", se, D(e.label), 1), (C(!0), g(f, null, T(I.value, (t) => (C(), g("td", { key: t.key }, D(R(e, t.key) == null ? "—" : F(R(e, t.key))), 1))), 128))]))), 128))])
|
|
295
313
|
])], 2)
|
|
296
314
|
], 10, ee));
|
|
297
315
|
}
|
|
298
316
|
});
|
|
299
317
|
//#endregion
|
|
300
|
-
export {
|
|
318
|
+
export { A as default };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
export interface CalendarProps {
|
|
2
|
+
/** Earliest selectable date, as an ISO `YYYY-MM-DD` string. */
|
|
3
|
+
min?: string;
|
|
4
|
+
/** Latest selectable date, as an ISO `YYYY-MM-DD` string. */
|
|
5
|
+
max?: string;
|
|
6
|
+
/** Locale for the month names and weekday initials. */
|
|
7
|
+
locale?: string;
|
|
8
|
+
/** 0 is Sunday. Defaults to the locale's own convention. */
|
|
9
|
+
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
10
|
+
/** How the weekday headings read — `narrow` is `M`, `short` is `Mon`. */
|
|
11
|
+
weekdayFormat?: 'narrow' | 'short' | 'long';
|
|
12
|
+
/** Months shown side by side. */
|
|
13
|
+
months?: number;
|
|
14
|
+
/** Page a month at a time rather than a full view. Only matters past one month. */
|
|
15
|
+
pagedNavigation?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Keep every month six rows tall. On by default: without it the calendar
|
|
18
|
+
* changes height as you page through, which moves everything below it.
|
|
19
|
+
*/
|
|
20
|
+
fixedWeeks?: boolean;
|
|
21
|
+
/** Grey out the days that belong to the neighbouring months. */
|
|
22
|
+
disableDaysOutsideCurrentView?: boolean;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** Selectable but not changeable. */
|
|
25
|
+
readonly?: boolean;
|
|
26
|
+
/** Move focus to the selected day, or today, on mount. */
|
|
27
|
+
initialFocus?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Refuse a date — a taken slot, a closed day. Given an ISO `YYYY-MM-DD`
|
|
30
|
+
* string. Unavailable days are struck through rather than hidden, so the
|
|
31
|
+
* reader can see the day exists and is spoken for.
|
|
32
|
+
*/
|
|
33
|
+
isUnavailable?: (date: string) => boolean;
|
|
34
|
+
/** Keep a date selected when it is clicked a second time. */
|
|
35
|
+
preventDeselect?: boolean;
|
|
36
|
+
/** Names the whole calendar for a screen reader. */
|
|
37
|
+
label?: string;
|
|
38
|
+
/** Navigation labels — override for non-English apps. */
|
|
39
|
+
previousLabel?: string;
|
|
40
|
+
nextLabel?: string;
|
|
41
|
+
/** Skip built-in classes; you take over styling entirely. */
|
|
42
|
+
unstyled?: boolean;
|
|
43
|
+
class?: string;
|
|
44
|
+
/** Override classes per slot, e.g. `{ cellTrigger: 'rounded-full' }`. */
|
|
45
|
+
ui?: Partial<Record<'root' | 'header' | 'heading' | 'nav' | 'months' | 'grid' | 'headCell' | 'cell' | 'cellTrigger', string>>;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* A month grid that is always on screen, for the cases a popover is wrong for:
|
|
49
|
+
* a booking page, an availability view, a date beside the thing it applies to.
|
|
50
|
+
* [`IDatePicker`](/components/date-picker) is this same grid behind a field.
|
|
51
|
+
*/
|
|
52
|
+
type __VLS_Props = CalendarProps;
|
|
53
|
+
type __VLS_ModelProps = {
|
|
54
|
+
/** ISO `YYYY-MM-DD`, never a `Date`. See `composables/date.ts` for why. */
|
|
55
|
+
modelValue?: string | null;
|
|
56
|
+
};
|
|
57
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
58
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
59
|
+
"update:modelValue": (value: string | null) => any;
|
|
60
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
61
|
+
"onUpdate:modelValue"?: ((value: string | null) => any) | undefined;
|
|
62
|
+
}>, {
|
|
63
|
+
unstyled: boolean;
|
|
64
|
+
fixedWeeks: boolean;
|
|
65
|
+
previousLabel: string;
|
|
66
|
+
nextLabel: string;
|
|
67
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
68
|
+
declare const _default: typeof __VLS_export;
|
|
69
|
+
export default _default;
|