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.
- package/dist/components/AvatarGroup.vue.d.ts +8 -2
- package/dist/components/AvatarGroup.vue_vue_type_script_setup_true_lang.js +57 -23
- package/dist/components/Breadcrumb.vue.d.ts +10 -2
- package/dist/components/Breadcrumb.vue_vue_type_script_setup_true_lang.js +66 -34
- package/dist/components/CommandPalette.vue.d.ts +12 -0
- package/dist/components/CommandPalette.vue_vue_type_script_setup_true_lang.js +122 -85
- package/dist/components/ConfirmPopover.vue.d.ts +1 -1
- package/dist/components/DateRangePicker.vue.d.ts +14 -2
- package/dist/components/DateRangePicker.vue_vue_type_script_setup_true_lang.js +111 -70
- package/dist/components/FileUpload.vue.d.ts +23 -1
- package/dist/components/FileUpload.vue_vue_type_script_setup_true_lang.js +139 -96
- package/dist/components/Input.vue.d.ts +14 -0
- package/dist/components/Input.vue_vue_type_script_setup_true_lang.js +86 -69
- package/dist/components/SignaturePad.vue.d.ts +1 -1
- package/dist/components/Tabs.vue.d.ts +7 -6
- package/dist/components/Tabs.vue_vue_type_script_setup_true_lang.js +65 -30
- package/dist/components/Textarea.vue.d.ts +14 -0
- package/dist/components/Textarea.vue_vue_type_script_setup_true_lang.js +90 -42
- package/dist/components/Toaster.vue_vue_type_script_setup_true_lang.js +42 -41
- package/dist/components/index.js +144 -144
- package/dist/composables/character-count.d.ts +6 -0
- package/dist/composables/character-count.js +18 -0
- package/dist/composables/command-palette.d.ts +7 -0
- package/dist/composables/command-palette.js +8 -2
- package/dist/composables/date.d.ts +25 -0
- package/dist/composables/date.js +59 -16
- package/dist/composables/scroll-fade.d.ts +1 -1
- package/dist/composables/toast.d.ts +16 -1
- package/dist/composables/toast.js +23 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.js +154 -154
- package/dist/theme/avatar.d.ts +21 -0
- package/dist/theme/avatar.js +28 -21
- package/dist/theme/bar-chart.d.ts +3 -3
- package/dist/theme/date-picker.d.ts +9 -0
- package/dist/theme/date-picker.js +3 -0
- package/dist/theme/donut-chart.d.ts +3 -3
- package/dist/theme/file-upload.d.ts +24 -0
- package/dist/theme/file-upload.js +6 -2
- package/dist/theme/input.d.ts +46 -0
- package/dist/theme/input.js +10 -2
- package/dist/theme/line-chart.d.ts +3 -3
- package/dist/theme/tabs.d.ts +18 -3
- package/dist/theme/tabs.js +20 -12
- package/dist/theme/toast.d.ts +9 -0
- package/dist/theme/toast.js +2 -1
- package/package.json +1 -1
package/dist/components/index.js
CHANGED
|
@@ -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 "./
|
|
13
|
-
import f from "./
|
|
14
|
-
import p from "./
|
|
15
|
-
import m from "./
|
|
16
|
-
import h from "./
|
|
17
|
-
import g from "./
|
|
18
|
-
import _ from "./
|
|
19
|
-
import v from "./
|
|
20
|
-
import y from "./
|
|
21
|
-
import b from "./
|
|
22
|
-
import x from "./
|
|
23
|
-
import S from "./
|
|
24
|
-
import C from "./
|
|
25
|
-
import w from "./
|
|
26
|
-
import T from "./
|
|
27
|
-
import E from "./
|
|
28
|
-
import D from "./
|
|
29
|
-
import O from "./
|
|
30
|
-
import k from "./
|
|
31
|
-
import A from "./
|
|
32
|
-
import j from "./
|
|
33
|
-
import M from "./
|
|
34
|
-
import N from "./
|
|
35
|
-
import P from "./
|
|
36
|
-
import F from "./
|
|
37
|
-
import I from "./
|
|
38
|
-
import L from "./
|
|
39
|
-
import R from "./
|
|
40
|
-
import z from "./
|
|
41
|
-
import B from "./
|
|
42
|
-
import V from "./
|
|
43
|
-
import H from "./
|
|
44
|
-
import U from "./
|
|
45
|
-
import W from "./
|
|
46
|
-
import G from "./
|
|
47
|
-
import K from "./
|
|
48
|
-
import q from "./
|
|
49
|
-
import J from "./
|
|
50
|
-
import Y from "./
|
|
51
|
-
import X from "./
|
|
52
|
-
import Z from "./
|
|
53
|
-
import Q from "./
|
|
54
|
-
import $ from "./
|
|
55
|
-
import ee from "./
|
|
56
|
-
import te from "./
|
|
57
|
-
import ne from "./
|
|
58
|
-
import re from "./
|
|
59
|
-
import ie from "./
|
|
60
|
-
import ae from "./
|
|
61
|
-
import oe from "./
|
|
62
|
-
import se from "./
|
|
63
|
-
import ce from "./
|
|
64
|
-
import le from "./
|
|
65
|
-
import ue from "./
|
|
66
|
-
import de from "./
|
|
67
|
-
import fe from "./
|
|
68
|
-
import pe from "./
|
|
69
|
-
import me from "./
|
|
70
|
-
import he from "./
|
|
71
|
-
import ge from "./
|
|
72
|
-
import _e from "./
|
|
73
|
-
import ve from "./
|
|
74
|
-
import ye from "./
|
|
75
|
-
import be from "./
|
|
76
|
-
import xe from "./
|
|
77
|
-
import Se from "./
|
|
78
|
-
import Ce from "./
|
|
79
|
-
import we from "./
|
|
80
|
-
import Te from "./
|
|
81
|
-
import Ee from "./
|
|
82
|
-
import De from "./
|
|
83
|
-
import Oe from "./
|
|
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: () =>
|
|
95
|
-
Badge: () =>
|
|
96
|
-
Banner: () =>
|
|
97
|
-
BarChart: () =>
|
|
98
|
-
Breadcrumb: () =>
|
|
94
|
+
AvatarGroup: () => f,
|
|
95
|
+
Badge: () => p,
|
|
96
|
+
Banner: () => m,
|
|
97
|
+
BarChart: () => g,
|
|
98
|
+
Breadcrumb: () => v,
|
|
99
99
|
Button: () => c,
|
|
100
|
-
ButtonGroup: () =>
|
|
101
|
-
Calendar: () =>
|
|
102
|
-
Card: () =>
|
|
103
|
-
Carousel: () =>
|
|
104
|
-
ChartLegend: () =>
|
|
105
|
-
Checkbox: () =>
|
|
106
|
-
Code: () =>
|
|
107
|
-
Collapsible: () =>
|
|
108
|
-
ColorPicker: () =>
|
|
109
|
-
Combobox: () =>
|
|
110
|
-
CommandPalette: () =>
|
|
111
|
-
ConfirmDialog: () =>
|
|
112
|
-
ConfirmPopover: () =>
|
|
113
|
-
Container: () =>
|
|
114
|
-
ContextMenu: () =>
|
|
115
|
-
DateField: () =>
|
|
116
|
-
DatePicker: () =>
|
|
117
|
-
DateRangePicker: () =>
|
|
118
|
-
DescriptionList: () =>
|
|
119
|
-
Dialog: () =>
|
|
120
|
-
DonutChart: () =>
|
|
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: () =>
|
|
123
|
-
Editable: () =>
|
|
124
|
-
EmptyState: () =>
|
|
125
|
-
FileUpload: () =>
|
|
126
|
-
Form: () =>
|
|
127
|
-
FormField: () =>
|
|
128
|
-
HoverCard: () =>
|
|
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: () =>
|
|
131
|
-
Kbd: () =>
|
|
132
|
-
Label: () =>
|
|
133
|
-
LineChart: () =>
|
|
134
|
-
Menubar: () =>
|
|
135
|
-
NavigationMenu: () =>
|
|
136
|
-
NumberInput: () =>
|
|
137
|
-
PageHeader: () =>
|
|
138
|
-
Pagination: () =>
|
|
139
|
-
PasswordInput: () =>
|
|
140
|
-
PinInput: () =>
|
|
141
|
-
Popover: () =>
|
|
142
|
-
Progress: () =>
|
|
143
|
-
RadioGroup: () =>
|
|
144
|
-
Rating: () =>
|
|
145
|
-
ScrollArea: () =>
|
|
146
|
-
ScrollFade: () =>
|
|
147
|
-
Select: () =>
|
|
148
|
-
Separator: () =>
|
|
149
|
-
Sidebar: () =>
|
|
150
|
-
SignaturePad: () =>
|
|
151
|
-
Skeleton: () =>
|
|
152
|
-
Slider: () =>
|
|
153
|
-
Sparkline: () =>
|
|
154
|
-
Splitter: () =>
|
|
155
|
-
Stat: () =>
|
|
156
|
-
Stepper: () =>
|
|
157
|
-
Switch: () =>
|
|
158
|
-
Table: () =>
|
|
159
|
-
Tabs: () =>
|
|
160
|
-
TagsInput: () =>
|
|
161
|
-
Textarea: () =>
|
|
162
|
-
TimeField: () =>
|
|
163
|
-
Timeline: () =>
|
|
164
|
-
Toaster: () =>
|
|
165
|
-
Toggle: () =>
|
|
166
|
-
ToggleGroup: () =>
|
|
167
|
-
Toolbar: () =>
|
|
168
|
-
Tooltip: () =>
|
|
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
|
|
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 {
|
|
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.
|
package/dist/composables/date.js
CHANGED
|
@@ -1,33 +1,76 @@
|
|
|
1
|
-
import { CalendarDate as e, DateFormatter as t, Time as n,
|
|
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
|
|
4
|
-
function
|
|
5
|
-
if (!(!e || !
|
|
6
|
-
return
|
|
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
|
|
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
|
|
15
|
-
return
|
|
14
|
+
function d() {
|
|
15
|
+
return u(s(i()));
|
|
16
16
|
}
|
|
17
|
-
function
|
|
18
|
-
let
|
|
19
|
-
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
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,
|
|
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
|
|
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
|
-
|
|
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';
|