iryx-ui 0.24.1 → 0.26.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 (47) hide show
  1. package/dist/components/AvatarGroup.vue.d.ts +8 -2
  2. package/dist/components/AvatarGroup.vue_vue_type_script_setup_true_lang.js +57 -23
  3. package/dist/components/Breadcrumb.vue.d.ts +10 -2
  4. package/dist/components/Breadcrumb.vue_vue_type_script_setup_true_lang.js +66 -34
  5. package/dist/components/CommandPalette.vue.d.ts +12 -0
  6. package/dist/components/CommandPalette.vue_vue_type_script_setup_true_lang.js +122 -85
  7. package/dist/components/ConfirmPopover.vue.d.ts +1 -1
  8. package/dist/components/DateRangePicker.vue.d.ts +14 -2
  9. package/dist/components/DateRangePicker.vue_vue_type_script_setup_true_lang.js +111 -70
  10. package/dist/components/FileUpload.vue.d.ts +23 -1
  11. package/dist/components/FileUpload.vue_vue_type_script_setup_true_lang.js +139 -96
  12. package/dist/components/Input.vue.d.ts +14 -0
  13. package/dist/components/Input.vue_vue_type_script_setup_true_lang.js +86 -69
  14. package/dist/components/SignaturePad.vue.d.ts +1 -1
  15. package/dist/components/Tabs.vue.d.ts +7 -6
  16. package/dist/components/Tabs.vue_vue_type_script_setup_true_lang.js +65 -30
  17. package/dist/components/Textarea.vue.d.ts +14 -0
  18. package/dist/components/Textarea.vue_vue_type_script_setup_true_lang.js +90 -42
  19. package/dist/components/Toaster.vue_vue_type_script_setup_true_lang.js +42 -41
  20. package/dist/components/index.js +144 -144
  21. package/dist/composables/character-count.d.ts +6 -0
  22. package/dist/composables/character-count.js +18 -0
  23. package/dist/composables/command-palette.d.ts +7 -0
  24. package/dist/composables/command-palette.js +8 -2
  25. package/dist/composables/date.d.ts +25 -0
  26. package/dist/composables/date.js +59 -16
  27. package/dist/composables/scroll-fade.d.ts +1 -1
  28. package/dist/composables/toast.d.ts +16 -1
  29. package/dist/composables/toast.js +23 -2
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +154 -154
  32. package/dist/theme/avatar.d.ts +21 -0
  33. package/dist/theme/avatar.js +28 -21
  34. package/dist/theme/bar-chart.d.ts +3 -3
  35. package/dist/theme/date-picker.d.ts +9 -0
  36. package/dist/theme/date-picker.js +3 -0
  37. package/dist/theme/donut-chart.d.ts +3 -3
  38. package/dist/theme/file-upload.d.ts +24 -0
  39. package/dist/theme/file-upload.js +6 -2
  40. package/dist/theme/input.d.ts +46 -0
  41. package/dist/theme/input.js +10 -2
  42. package/dist/theme/line-chart.d.ts +3 -3
  43. package/dist/theme/tabs.d.ts +18 -3
  44. package/dist/theme/tabs.js +20 -12
  45. package/dist/theme/toast.d.ts +9 -0
  46. package/dist/theme/toast.js +2 -1
  47. package/package.json +1 -1
@@ -9,78 +9,78 @@ import s from "./AspectRatio.js";
9
9
  import c from "./Button.js";
10
10
  import l from "./AuthProviders.js";
11
11
  import u from "./Avatar.js";
12
- import d from "./AvatarGroup.js";
13
- import f from "./Badge.js";
14
- import p from "./Banner.js";
15
- import m from "./ChartLegend.js";
16
- import h from "./BarChart.js";
17
- import g from "./Breadcrumb.js";
18
- import _ from "./ButtonGroup.js";
19
- import v from "./Calendar.js";
20
- import y from "./Card.js";
21
- import b from "./Carousel.js";
22
- import x from "./Checkbox.js";
23
- import S from "./Code.js";
24
- import C from "./Collapsible.js";
25
- import w from "./ColorPicker.js";
26
- import T from "./Combobox.js";
27
- import E from "./Kbd.js";
28
- import D from "./CommandPalette.js";
29
- import O from "./Dialog.js";
30
- import k from "./ConfirmDialog.js";
31
- import A from "./Popover.js";
32
- import j from "./ConfirmPopover.js";
33
- import M from "./Container.js";
34
- import N from "./ContextMenu.js";
35
- import P from "./DateField.js";
36
- import F from "./DatePicker.js";
37
- import I from "./DateRangePicker.js";
38
- import L from "./DescriptionList.js";
39
- import R from "./DonutChart.js";
40
- import z from "./DropdownMenu.js";
41
- import B from "./Editable.js";
42
- import V from "./EmptyState.js";
43
- import H from "./FileUpload.js";
44
- import U from "./Form.js";
45
- import W from "./Label.js";
46
- import G from "./FormField.js";
47
- import K from "./HoverCard.js";
48
- import q from "./Input.js";
49
- import J from "./LineChart.js";
50
- import Y from "./Menubar.js";
51
- import X from "./NavigationMenu.js";
52
- import Z from "./NumberInput.js";
53
- import Q from "./PageHeader.js";
54
- import $ from "./Pagination.js";
55
- import ee from "./PasswordInput.js";
56
- import te from "./PinInput.js";
57
- import ne from "./Progress.js";
58
- import re from "./RadioGroup.js";
59
- import ie from "./Rating.js";
60
- import ae from "./ScrollArea.js";
61
- import oe from "./ScrollFade.js";
62
- import se from "./Select.js";
63
- import ce from "./Separator.js";
64
- import le from "./Sidebar.js";
65
- import ue from "./SignaturePad.js";
66
- import de from "./Skeleton.js";
67
- import fe from "./Slider.js";
68
- import pe from "./Sparkline.js";
69
- import me from "./Splitter.js";
70
- import he from "./Stat.js";
71
- import ge from "./Stepper.js";
72
- import _e from "./Switch.js";
73
- import ve from "./Table.js";
74
- import ye from "./Tabs.js";
75
- import be from "./TagsInput.js";
76
- import xe from "./Textarea.js";
77
- import Se from "./TimeField.js";
78
- import Ce from "./Timeline.js";
79
- import we from "./Toaster.js";
80
- import Te from "./Toggle.js";
81
- import Ee from "./ToggleGroup.js";
82
- import De from "./Toolbar.js";
83
- import Oe from "./Tooltip.js";
12
+ import d from "./Tooltip.js";
13
+ import f from "./AvatarGroup.js";
14
+ import p from "./Badge.js";
15
+ import m from "./Banner.js";
16
+ import h from "./ChartLegend.js";
17
+ import g from "./BarChart.js";
18
+ import _ from "./DropdownMenu.js";
19
+ import v from "./Breadcrumb.js";
20
+ import y from "./ButtonGroup.js";
21
+ import b from "./Calendar.js";
22
+ import x from "./Card.js";
23
+ import S from "./Carousel.js";
24
+ import C from "./Checkbox.js";
25
+ import w from "./Code.js";
26
+ import T from "./Collapsible.js";
27
+ import E from "./ColorPicker.js";
28
+ import D from "./Combobox.js";
29
+ import O from "./Kbd.js";
30
+ import k from "./CommandPalette.js";
31
+ import A from "./Dialog.js";
32
+ import j from "./ConfirmDialog.js";
33
+ import M from "./Popover.js";
34
+ import N from "./ConfirmPopover.js";
35
+ import P from "./Container.js";
36
+ import F from "./ContextMenu.js";
37
+ import I from "./DateField.js";
38
+ import L from "./DatePicker.js";
39
+ import R from "./DateRangePicker.js";
40
+ import z from "./DescriptionList.js";
41
+ import B from "./DonutChart.js";
42
+ import V from "./Editable.js";
43
+ import H from "./EmptyState.js";
44
+ import U from "./Progress.js";
45
+ import W from "./FileUpload.js";
46
+ import G from "./Form.js";
47
+ import K from "./Label.js";
48
+ import q from "./FormField.js";
49
+ import J from "./HoverCard.js";
50
+ import Y from "./Input.js";
51
+ import X from "./LineChart.js";
52
+ import Z from "./Menubar.js";
53
+ import Q from "./NavigationMenu.js";
54
+ import $ from "./NumberInput.js";
55
+ import ee from "./PageHeader.js";
56
+ import te from "./Pagination.js";
57
+ import ne from "./PasswordInput.js";
58
+ import re from "./PinInput.js";
59
+ import ie from "./RadioGroup.js";
60
+ import ae from "./Rating.js";
61
+ import oe from "./ScrollArea.js";
62
+ import se from "./ScrollFade.js";
63
+ import ce from "./Select.js";
64
+ import le from "./Separator.js";
65
+ import ue from "./Sidebar.js";
66
+ import de from "./SignaturePad.js";
67
+ import fe from "./Skeleton.js";
68
+ import pe from "./Slider.js";
69
+ import me from "./Sparkline.js";
70
+ import he from "./Splitter.js";
71
+ import ge from "./Stat.js";
72
+ import _e from "./Stepper.js";
73
+ import ve from "./Switch.js";
74
+ import ye from "./Table.js";
75
+ import be from "./Tabs.js";
76
+ import xe from "./TagsInput.js";
77
+ import Se from "./Textarea.js";
78
+ import Ce from "./TimeField.js";
79
+ import we from "./Timeline.js";
80
+ import Te from "./Toaster.js";
81
+ import Ee from "./Toggle.js";
82
+ import De from "./ToggleGroup.js";
83
+ import Oe from "./Toolbar.js";
84
84
  import ke from "./Tree.js";
85
85
  //#region src/components/index.ts
86
86
  var Ae = /* @__PURE__ */ e({
@@ -91,81 +91,81 @@ var Ae = /* @__PURE__ */ e({
91
91
  AspectRatio: () => s,
92
92
  AuthProviders: () => l,
93
93
  Avatar: () => u,
94
- AvatarGroup: () => d,
95
- Badge: () => f,
96
- Banner: () => p,
97
- BarChart: () => h,
98
- Breadcrumb: () => g,
94
+ AvatarGroup: () => f,
95
+ Badge: () => p,
96
+ Banner: () => m,
97
+ BarChart: () => g,
98
+ Breadcrumb: () => v,
99
99
  Button: () => c,
100
- ButtonGroup: () => _,
101
- Calendar: () => v,
102
- Card: () => y,
103
- Carousel: () => b,
104
- ChartLegend: () => m,
105
- Checkbox: () => x,
106
- Code: () => S,
107
- Collapsible: () => C,
108
- ColorPicker: () => w,
109
- Combobox: () => T,
110
- CommandPalette: () => D,
111
- ConfirmDialog: () => k,
112
- ConfirmPopover: () => j,
113
- Container: () => M,
114
- ContextMenu: () => N,
115
- DateField: () => P,
116
- DatePicker: () => F,
117
- DateRangePicker: () => I,
118
- DescriptionList: () => L,
119
- Dialog: () => O,
120
- DonutChart: () => R,
100
+ ButtonGroup: () => y,
101
+ Calendar: () => b,
102
+ Card: () => x,
103
+ Carousel: () => S,
104
+ ChartLegend: () => h,
105
+ Checkbox: () => C,
106
+ Code: () => w,
107
+ Collapsible: () => T,
108
+ ColorPicker: () => E,
109
+ Combobox: () => D,
110
+ CommandPalette: () => k,
111
+ ConfirmDialog: () => j,
112
+ ConfirmPopover: () => N,
113
+ Container: () => P,
114
+ ContextMenu: () => F,
115
+ DateField: () => I,
116
+ DatePicker: () => L,
117
+ DateRangePicker: () => R,
118
+ DescriptionList: () => z,
119
+ Dialog: () => A,
120
+ DonutChart: () => B,
121
121
  Drawer: () => a,
122
- DropdownMenu: () => z,
123
- Editable: () => B,
124
- EmptyState: () => V,
125
- FileUpload: () => H,
126
- Form: () => U,
127
- FormField: () => G,
128
- HoverCard: () => K,
122
+ DropdownMenu: () => _,
123
+ Editable: () => V,
124
+ EmptyState: () => H,
125
+ FileUpload: () => W,
126
+ Form: () => G,
127
+ FormField: () => q,
128
+ HoverCard: () => J,
129
129
  Icon: () => t,
130
- Input: () => q,
131
- Kbd: () => E,
132
- Label: () => W,
133
- LineChart: () => J,
134
- Menubar: () => Y,
135
- NavigationMenu: () => X,
136
- NumberInput: () => Z,
137
- PageHeader: () => Q,
138
- Pagination: () => $,
139
- PasswordInput: () => ee,
140
- PinInput: () => te,
141
- Popover: () => A,
142
- Progress: () => ne,
143
- RadioGroup: () => re,
144
- Rating: () => ie,
145
- ScrollArea: () => ae,
146
- ScrollFade: () => oe,
147
- Select: () => se,
148
- Separator: () => ce,
149
- Sidebar: () => le,
150
- SignaturePad: () => ue,
151
- Skeleton: () => de,
152
- Slider: () => fe,
153
- Sparkline: () => pe,
154
- Splitter: () => me,
155
- Stat: () => he,
156
- Stepper: () => ge,
157
- Switch: () => _e,
158
- Table: () => ve,
159
- Tabs: () => ye,
160
- TagsInput: () => be,
161
- Textarea: () => xe,
162
- TimeField: () => Se,
163
- Timeline: () => Ce,
164
- Toaster: () => we,
165
- Toggle: () => Te,
166
- ToggleGroup: () => Ee,
167
- Toolbar: () => De,
168
- Tooltip: () => Oe,
130
+ Input: () => Y,
131
+ Kbd: () => O,
132
+ Label: () => K,
133
+ LineChart: () => X,
134
+ Menubar: () => Z,
135
+ NavigationMenu: () => Q,
136
+ NumberInput: () => $,
137
+ PageHeader: () => ee,
138
+ Pagination: () => te,
139
+ PasswordInput: () => ne,
140
+ PinInput: () => re,
141
+ Popover: () => M,
142
+ Progress: () => U,
143
+ RadioGroup: () => ie,
144
+ Rating: () => ae,
145
+ ScrollArea: () => oe,
146
+ ScrollFade: () => se,
147
+ Select: () => ce,
148
+ Separator: () => le,
149
+ Sidebar: () => ue,
150
+ SignaturePad: () => de,
151
+ Skeleton: () => fe,
152
+ Slider: () => pe,
153
+ Sparkline: () => me,
154
+ Splitter: () => he,
155
+ Stat: () => ge,
156
+ Stepper: () => _e,
157
+ Switch: () => ve,
158
+ Table: () => ye,
159
+ Tabs: () => be,
160
+ TagsInput: () => xe,
161
+ Textarea: () => Se,
162
+ TimeField: () => Ce,
163
+ Timeline: () => we,
164
+ Toaster: () => Te,
165
+ Toggle: () => Ee,
166
+ ToggleGroup: () => De,
167
+ Toolbar: () => Oe,
168
+ Tooltip: () => d,
169
169
  Tree: () => ke
170
170
  });
171
171
  //#endregion
@@ -0,0 +1,6 @@
1
+ export declare function defaultCountLabel(remaining: number): string;
2
+ export declare function useCharacterCount(value: () => string | number | null | undefined, max: () => number | undefined): {
3
+ remaining: import("vue").ComputedRef<number | undefined>;
4
+ nearLimit: import("vue").ComputedRef<boolean>;
5
+ text: import("vue").ComputedRef<string>;
6
+ };
@@ -0,0 +1,18 @@
1
+ import { computed as e } from "vue";
2
+ //#region src/composables/character-count.ts
3
+ function t(e) {
4
+ return `${e} ${e === 1 ? "character" : "characters"} left`;
5
+ }
6
+ function n(t, n) {
7
+ let r = e(() => String(t() ?? "").length), i = e(() => {
8
+ let e = n();
9
+ return e == null ? void 0 : e - r.value;
10
+ });
11
+ 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
+ };
16
+ }
17
+ //#endregion
18
+ export { t as defaultCountLabel, n as useCharacterCount };
@@ -2,6 +2,11 @@ import type { IconLike } from './icon';
2
2
  export interface CommandItem {
3
3
  /** What the reader searches for and reads. */
4
4
  label: string;
5
+ /**
6
+ * Stable identity for the recent list. Falls back to the group and label,
7
+ * so set it when a label can change (a translated app, a renamed page).
8
+ */
9
+ id?: string;
5
10
  icon?: IconLike;
6
11
  /**
7
12
  * Displayed at the trailing edge, split on spaces into separate keys.
@@ -27,6 +32,8 @@ export type CommandEntry = CommandItem | CommandGroup;
27
32
  export declare function isCommandGroup(entry: CommandEntry): entry is CommandGroup;
28
33
  /** Normalise to groups, so the template has a single path to render. */
29
34
  export declare function toCommandGroups(entries: CommandEntry[] | undefined): CommandGroup[];
35
+ export declare function commandId(item: CommandItem, group: string): string;
36
+ export declare function pushRecent(recent: string[], id: string, limit: number): string[];
30
37
  /**
31
38
  * Everything a query should match against: the label, the group it sits in,
32
39
  * and any keywords. Joined rather than tested separately so a query spanning
@@ -18,15 +18,21 @@ function n(e) {
18
18
  return n;
19
19
  }
20
20
  function r(e, t) {
21
+ return e.id ?? `${t}/${e.label}`;
22
+ }
23
+ function i(e, t, n) {
24
+ return [t, ...e.filter((e) => e !== t)].slice(0, Math.max(0, n));
25
+ }
26
+ function a(e, t) {
21
27
  return [
22
28
  e.label,
23
29
  t,
24
30
  ...e.keywords ?? []
25
31
  ].join(" ");
26
32
  }
27
- function i(t, n) {
33
+ function o(t, n) {
28
34
  let r = n.toLowerCase().split("+").map((e) => e.trim()), i = r.at(-1) ?? "", a = r.includes("mod"), o = r.includes("ctrl") || r.includes("control"), s = r.includes("meta") || r.includes("cmd"), c = r.includes("shift"), l = r.includes("alt") || r.includes("option"), u = e() ? t.metaKey : t.ctrlKey;
29
35
  return a && !u || o && !t.ctrlKey || s && !t.metaKey || c !== t.shiftKey || l !== t.altKey ? !1 : t.key.toLowerCase() === i;
30
36
  }
31
37
  //#endregion
32
- export { r as commandHaystack, t as isCommandGroup, i as matchesHotkey, n as toCommandGroups };
38
+ export { a as commandHaystack, r as commandId, t as isCommandGroup, o as matchesHotkey, i as pushRecent, n as toCommandGroups };
@@ -12,6 +12,31 @@ export declare function toCalendarDate(iso: string | null | undefined): Calendar
12
12
  export declare function toIsoDate(date: DateValue | null | undefined): string | null;
13
13
  /** Today in the viewer's own zone, as an ISO date string. */
14
14
  export declare function isoToday(): string;
15
+ /** One shortcut in `IDateRangePicker`'s preset list. */
16
+ export interface DateRangePreset {
17
+ label: string;
18
+ /** A function is re-run each time the picker opens, so "Today" stays today. */
19
+ range: {
20
+ start: string | null;
21
+ end: string | null;
22
+ } | (() => {
23
+ start: string | null;
24
+ end: string | null;
25
+ });
26
+ }
27
+ export interface CommonDateRangePresetLabels {
28
+ today: string;
29
+ yesterday: string;
30
+ last7Days: string;
31
+ last30Days: string;
32
+ thisMonth: string;
33
+ lastMonth: string;
34
+ }
35
+ /**
36
+ * The usual dashboard shortcuts, relative to today in the viewer's zone.
37
+ * Pass `labels` to translate them.
38
+ */
39
+ export declare function commonDateRangePresets(labels?: Partial<CommonDateRangePresetLabels>): DateRangePreset[];
15
40
  /**
16
41
  * Render an ISO date for display. Returns `''` for absent or malformed input
17
42
  * so a caller can fall back to a placeholder.
@@ -1,33 +1,76 @@
1
- import { CalendarDate as e, DateFormatter as t, Time as n, getLocalTimeZone as r, parseDate as i, today as a } from "@internationalized/date";
1
+ import { CalendarDate as e, DateFormatter as t, Time as n, endOfMonth as r, getLocalTimeZone as i, parseDate as a, startOfMonth as o, today as s } from "@internationalized/date";
2
2
  //#region src/composables/date.ts
3
- var o = /^\d{4}-\d{2}-\d{2}$/;
4
- function s(e) {
5
- if (!(!e || !o.test(e))) try {
6
- return i(e);
3
+ var c = /^\d{4}-\d{2}-\d{2}$/;
4
+ function l(e) {
5
+ if (!(!e || !c.test(e))) try {
6
+ return a(e);
7
7
  } catch {
8
8
  return;
9
9
  }
10
10
  }
11
- function c(e) {
11
+ function u(e) {
12
12
  return e ? `${e.year.toString().padStart(4, "0")}-${e.month.toString().padStart(2, "0")}-${e.day.toString().padStart(2, "0")}` : null;
13
13
  }
14
- function l() {
15
- return c(a(r()));
14
+ function d() {
15
+ return u(s(i()));
16
16
  }
17
- function u(e, n, i = { dateStyle: "medium" }) {
18
- let a = s(e);
19
- return a ? new t(n ?? "en-US", i).format(a.toDate(r())) : "";
17
+ function f(e = {}) {
18
+ let t = {
19
+ today: "Today",
20
+ yesterday: "Yesterday",
21
+ last7Days: "Last 7 days",
22
+ last30Days: "Last 30 days",
23
+ thisMonth: "This month",
24
+ lastMonth: "Last month",
25
+ ...e
26
+ }, n = () => s(i()), a = (e, t) => ({
27
+ start: u(e),
28
+ end: u(t)
29
+ });
30
+ return [
31
+ {
32
+ label: t.today,
33
+ range: () => a(n(), n())
34
+ },
35
+ {
36
+ label: t.yesterday,
37
+ range: () => a(n().subtract({ days: 1 }), n().subtract({ days: 1 }))
38
+ },
39
+ {
40
+ label: t.last7Days,
41
+ range: () => a(n().subtract({ days: 6 }), n())
42
+ },
43
+ {
44
+ label: t.last30Days,
45
+ range: () => a(n().subtract({ days: 29 }), n())
46
+ },
47
+ {
48
+ label: t.thisMonth,
49
+ range: () => a(o(n()), r(n()))
50
+ },
51
+ {
52
+ label: t.lastMonth,
53
+ range: () => {
54
+ let e = o(n()).subtract({ months: 1 });
55
+ return a(e, r(e));
56
+ }
57
+ }
58
+ ];
20
59
  }
21
- var d = /^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$/;
22
- function f(e) {
23
- if (!e || !d.test(e)) return;
60
+ function p(e, n, r = { dateStyle: "medium" }) {
61
+ let a = l(e);
62
+ return a ? new t(n ?? "en-US", r).format(a.toDate(i())) : "";
63
+ }
64
+ var m = /^(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d)?$/;
65
+ function h(e) {
66
+ if (!e || !m.test(e)) return;
24
67
  let [t, r, i] = e.split(":").map(Number);
25
68
  return new n(t, r, i ?? 0);
26
69
  }
27
- function p(e) {
70
+ function g(e) {
28
71
  if (!e) return null;
29
72
  let t = (e) => String(e).padStart(2, "0"), n = `${t(e.hour)}:${t(e.minute)}`;
30
73
  return e.second ? `${n}:${t(e.second)}` : n;
31
74
  }
32
75
  //#endregion
33
- export { e as CalendarDate, n as Time, u as formatIsoDate, l as isoToday, s as toCalendarDate, c as toIsoDate, p as toIsoTime, f as toTime };
76
+ export { e as CalendarDate, n as Time, f as commonDateRangePresets, p as formatIsoDate, d as isoToday, l as toCalendarDate, u as toIsoDate, g as toIsoTime, h as toTime };
@@ -15,7 +15,7 @@ export interface ScrollEdges {
15
15
  * panel that fits on a desktop overflows on a phone. A fade painted on a
16
16
  * container that does not actually scroll is a lie about what is there.
17
17
  */
18
- export declare function useScrollEdges(target: Ref<HTMLElement | undefined>, axis: Ref<'vertical' | 'horizontal'>): ScrollEdges;
18
+ export declare function useScrollEdges(target: Readonly<Ref<HTMLElement | undefined>>, axis: Readonly<Ref<'vertical' | 'horizontal'>>): ScrollEdges;
19
19
  /**
20
20
  * The mask that fades the edges with something past them.
21
21
  *
@@ -1,4 +1,4 @@
1
- export type ToastVariant = 'neutral' | 'success' | 'warning' | 'danger' | 'info';
1
+ export type ToastVariant = 'neutral' | 'success' | 'warning' | 'danger' | 'info' | 'loading';
2
2
  export interface ToastOptions {
3
3
  title?: string;
4
4
  description?: string;
@@ -11,6 +11,12 @@ export interface ToastOptions {
11
11
  onClick: () => void;
12
12
  };
13
13
  }
14
+ type Message<T> = ToastOptions | string | ((value: T) => ToastOptions | string);
15
+ export interface ToastPromiseMessages<T> {
16
+ loading: ToastOptions | string;
17
+ success: Message<T>;
18
+ error: Message<unknown>;
19
+ }
14
20
  export interface ToastRecord extends ToastOptions {
15
21
  id: number;
16
22
  }
@@ -23,6 +29,14 @@ export interface ToastApi {
23
29
  warning: (options: ToastOptions | string) => number;
24
30
  danger: (options: ToastOptions | string) => number;
25
31
  info: (options: ToastOptions | string) => number;
32
+ /** Replace an open toast's content in place. Does nothing once it has closed. */
33
+ update: (id: number, options: ToastOptions | string) => void;
34
+ /**
35
+ * One toast for a piece of async work: a spinner while the promise is
36
+ * pending, then the success or error message. Returns the toast's id; await
37
+ * your own promise for its result.
38
+ */
39
+ promise: <T>(promise: Promise<T>, messages: ToastPromiseMessages<T>) => number;
26
40
  /** Dismiss one toast by id. */
27
41
  dismiss: (id: number) => void;
28
42
  /** Dismiss every open toast. */
@@ -40,3 +54,4 @@ export interface ToastApi {
40
54
  * ```
41
55
  */
42
56
  export declare function useToast(): ToastApi;
57
+ export {};
@@ -21,7 +21,26 @@ function a() {
21
21
  variant: t
22
22
  });
23
23
  }
24
- function a(e) {
24
+ function a(e, n) {
25
+ t.value = t.value.map((t) => t.id === e ? {
26
+ ...i(n),
27
+ id: e
28
+ } : t);
29
+ }
30
+ function o(t, n) {
31
+ let r = e({
32
+ duration: 0,
33
+ ...i(n.loading),
34
+ variant: "loading"
35
+ }), o = (e, t, n) => {
36
+ a(r, {
37
+ variant: n,
38
+ ...i(typeof e == "function" ? e(t) : e)
39
+ });
40
+ };
41
+ return t.then((e) => o(n.success, e, "success"), (e) => o(n.error, e, "danger")), r;
42
+ }
43
+ function s(e) {
25
44
  t.value = t.value.filter((t) => t.id !== e);
26
45
  }
27
46
  return {
@@ -30,7 +49,9 @@ function a() {
30
49
  warning: r("warning"),
31
50
  danger: r("danger"),
32
51
  info: r("info"),
33
- dismiss: a,
52
+ update: a,
53
+ promise: o,
54
+ dismiss: s,
34
55
  clear: () => t.value = []
35
56
  };
36
57
  }
package/dist/index.d.ts CHANGED
@@ -40,7 +40,7 @@ export type { DrawerProps, DrawerSide, DrawerSnapPoint } from './components/Draw
40
40
  export type { DropdownMenuProps } from './components/DropdownMenu.vue';
41
41
  export type { EditableProps } from './components/Editable.vue';
42
42
  export type { EmptyStateProps } from './components/EmptyState.vue';
43
- export type { FileRejection, FileUploadProps } from './components/FileUpload.vue';
43
+ export type { FileRejection, FileUploadProps, FileUploadStatus } from './components/FileUpload.vue';
44
44
  export type { FormProps } from './components/Form.vue';
45
45
  export type { FormFieldProps } from './components/FormField.vue';
46
46
  export type { HoverCardProps } from './components/HoverCard.vue';