@thekestongroup/ui 0.3.0 → 0.4.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 +18 -9
- package/dist/components/EmptyState/EmptyState.vue.d.ts +55 -0
- package/dist/index.d.ts +2 -0
- package/dist/keston-ui.js +191 -125
- package/package.json +5 -1
- package/src/components/AppShell/AppShell.vue +10 -1
- package/src/components/EmptyState/EmptyState.stories.ts +99 -0
- package/src/components/EmptyState/EmptyState.vue +87 -0
- package/src/components/Notification/NotificationPane.vue +8 -9
- package/src/components/Table/Table.stories.ts +14 -8
- package/src/components/Table/Table.vue +4 -1
- package/src/index.ts +2 -0
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
The component library for every Keston product. Built with Vue 3, [Reka UI](https://reka-ui.com)
|
|
4
4
|
(behaviour and accessibility) and [Tailwind CSS v4](https://tailwindcss.com) (styling).
|
|
5
|
-
Published as `@thekestongroup/ui`.
|
|
5
|
+
Published as `@thekestongroup/ui`. Docs and Storybook: https://ui.keston.co.
|
|
6
6
|
|
|
7
7
|
## Getting started
|
|
8
8
|
|
|
@@ -111,11 +111,20 @@ Versions follow [semver](https://semver.org): **patch** = bug fix,
|
|
|
111
111
|
prop, component or token).
|
|
112
112
|
|
|
113
113
|
1. With each change, run `pnpm changeset` and commit the file it creates.
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
Merging only collects changes: nothing is released yet.
|
|
115
|
+
2. When you want a release, run the **Release** workflow: Actions → Release →
|
|
116
|
+
Run workflow, or:
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
gh workflow run release.yml -R thekestongroup/ui
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
It tests and builds, works out the version from the changesets waiting,
|
|
123
|
+
updates `package.json` and `CHANGELOG.md`, commits and tags that on
|
|
124
|
+
`main`, and creates a GitHub Release. Then it starts the **Publish**
|
|
125
|
+
workflow, which stages the release on npm (trusted publishing, no token
|
|
126
|
+
needed). With no changesets waiting, it stops without releasing.
|
|
127
|
+
3. Approve the staged release on npmjs.com to make it live.
|
|
128
|
+
|
|
129
|
+
If staging on npm fails, run **Publish** again by hand on the release's tag
|
|
130
|
+
(e.g. `v0.4.0`); it skips a version that's already on npm.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Component, HTMLAttributes } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* What to show where a list, table or panel has nothing in it yet: an icon,
|
|
4
|
+
* a short title, a line of explanation, and optionally what to do about it
|
|
5
|
+
* (e.g. a Button). "No connected apps", "You're all caught up", "No
|
|
6
|
+
* applications yet".
|
|
7
|
+
*
|
|
8
|
+
* Slots: title, description, actions (under the text, e.g. a Button),
|
|
9
|
+
* default (anything else, under the description). To animate the icon, pass
|
|
10
|
+
* classes in `ui.icon`.
|
|
11
|
+
*/
|
|
12
|
+
export interface EmptyStateProps {
|
|
13
|
+
/** Short and specific, e.g. "No connected apps". */
|
|
14
|
+
title?: string;
|
|
15
|
+
/** What this space is for, or what to do next. */
|
|
16
|
+
description?: string;
|
|
17
|
+
/** A Lucide (or any) icon component, shown above the title. */
|
|
18
|
+
icon?: Component;
|
|
19
|
+
/**
|
|
20
|
+
* Make the title a heading, at this level, to fit the page outline (e.g. 2
|
|
21
|
+
* when it fills a page's main area). Without it the title is plain text,
|
|
22
|
+
* as in a panel or table that already has a heading.
|
|
23
|
+
*/
|
|
24
|
+
headingLevel?: 2 | 3 | 4;
|
|
25
|
+
/**
|
|
26
|
+
* - sm: compact, for panels, popovers and tables.
|
|
27
|
+
* - md (default): for a Card or a page's main area.
|
|
28
|
+
*/
|
|
29
|
+
size?: 'sm' | 'md';
|
|
30
|
+
class?: HTMLAttributes['class'];
|
|
31
|
+
/** Extra classes for the parts. */
|
|
32
|
+
ui?: {
|
|
33
|
+
icon?: HTMLAttributes['class'];
|
|
34
|
+
title?: HTMLAttributes['class'];
|
|
35
|
+
description?: HTMLAttributes['class'];
|
|
36
|
+
actions?: HTMLAttributes['class'];
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
type __VLS_Slots = {
|
|
40
|
+
default?(): unknown;
|
|
41
|
+
title?(): unknown;
|
|
42
|
+
description?(): unknown;
|
|
43
|
+
actions?(): unknown;
|
|
44
|
+
};
|
|
45
|
+
declare const __VLS_base: import('vue').DefineComponent<EmptyStateProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<EmptyStateProps> & Readonly<{}>, {
|
|
46
|
+
size: "sm" | "md";
|
|
47
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
48
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
49
|
+
declare const _default: typeof __VLS_export;
|
|
50
|
+
export default _default;
|
|
51
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
52
|
+
new (): {
|
|
53
|
+
$slots: S;
|
|
54
|
+
};
|
|
55
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -61,6 +61,8 @@ export { default as RelativeTime } from './components/RelativeTime/RelativeTime.
|
|
|
61
61
|
export type { RelativeTimeProps } from './components/RelativeTime/RelativeTime.vue';
|
|
62
62
|
export { default as Age } from './components/Age/Age.vue';
|
|
63
63
|
export type { AgeProps } from './components/Age/Age.vue';
|
|
64
|
+
export { default as EmptyState } from './components/EmptyState/EmptyState.vue';
|
|
65
|
+
export type { EmptyStateProps } from './components/EmptyState/EmptyState.vue';
|
|
64
66
|
export { default as Breadcrumb } from './components/Breadcrumb/Breadcrumb.vue';
|
|
65
67
|
export type { BreadcrumbProps, BreadcrumbItem } from './components/Breadcrumb/Breadcrumb.vue';
|
|
66
68
|
export { default as Sidebar } from './components/Sidebar/Sidebar.vue';
|
package/dist/keston-ui.js
CHANGED
|
@@ -1283,7 +1283,7 @@ var ar = ["data-collapsed"], or = ["aria-label"], sr = ["data-level"], cr = {
|
|
|
1283
1283
|
title: e.title || "Menu",
|
|
1284
1284
|
ui: {
|
|
1285
1285
|
content: "max-w-72",
|
|
1286
|
-
header: "h-12
|
|
1286
|
+
header: "h-12 justify-center px-5 py-0",
|
|
1287
1287
|
title: "text-base font-bold",
|
|
1288
1288
|
body: "flex p-0"
|
|
1289
1289
|
}
|
|
@@ -3934,15 +3934,71 @@ var ta = [
|
|
|
3934
3934
|
text: p.value
|
|
3935
3935
|
}, null, 8, ["status", "text"])], 2));
|
|
3936
3936
|
}
|
|
3937
|
-
}), Ha =
|
|
3937
|
+
}), Ha = /* @__PURE__ */ f({
|
|
3938
|
+
__name: "EmptyState",
|
|
3939
|
+
props: {
|
|
3940
|
+
title: {},
|
|
3941
|
+
description: {},
|
|
3942
|
+
icon: {},
|
|
3943
|
+
headingLevel: {},
|
|
3944
|
+
size: { default: "md" },
|
|
3945
|
+
class: { type: [
|
|
3946
|
+
Boolean,
|
|
3947
|
+
null,
|
|
3948
|
+
String,
|
|
3949
|
+
Object,
|
|
3950
|
+
Array
|
|
3951
|
+
] },
|
|
3952
|
+
ui: {}
|
|
3953
|
+
},
|
|
3954
|
+
setup(e) {
|
|
3955
|
+
let t = e, n = {
|
|
3956
|
+
sm: {
|
|
3957
|
+
root: "gap-2 px-4 py-10",
|
|
3958
|
+
icon: "size-6",
|
|
3959
|
+
title: "text-sm",
|
|
3960
|
+
description: "text-sm"
|
|
3961
|
+
},
|
|
3962
|
+
md: {
|
|
3963
|
+
root: "gap-2 px-4 py-12",
|
|
3964
|
+
icon: "size-8",
|
|
3965
|
+
title: "text-base",
|
|
3966
|
+
description: "text-sm"
|
|
3967
|
+
}
|
|
3968
|
+
};
|
|
3969
|
+
return (r, i) => (C(), s("div", { class: v(j(X)("flex flex-col items-center text-center", n[e.size].root, t.class)) }, [
|
|
3970
|
+
e.icon ? (C(), s("div", {
|
|
3971
|
+
key: 0,
|
|
3972
|
+
class: v(j(X)("flex text-black/45", e.size === "md" && "mb-1", e.ui?.icon)),
|
|
3973
|
+
"aria-hidden": "true"
|
|
3974
|
+
}, [(C(), a(O(e.icon), { class: v(n[e.size].icon) }, null, 8, ["class"]))], 2)) : o("", !0),
|
|
3975
|
+
r.$slots.title || e.title ? (C(), a(O(e.headingLevel ? `h${e.headingLevel}` : "p"), {
|
|
3976
|
+
key: 1,
|
|
3977
|
+
class: v(j(X)("font-bold text-black", n[e.size].title, e.ui?.title))
|
|
3978
|
+
}, {
|
|
3979
|
+
default: z(() => [D(r.$slots, "title", {}, () => [u(A(e.title), 1)])]),
|
|
3980
|
+
_: 3
|
|
3981
|
+
}, 8, ["class"])) : o("", !0),
|
|
3982
|
+
r.$slots.description || e.description ? (C(), s("p", {
|
|
3983
|
+
key: 2,
|
|
3984
|
+
class: v(j(X)("max-w-sm text-black/65", n[e.size].description, e.ui?.description))
|
|
3985
|
+
}, [D(r.$slots, "description", {}, () => [u(A(e.description), 1)])], 2)) : o("", !0),
|
|
3986
|
+
D(r.$slots, "default"),
|
|
3987
|
+
r.$slots.actions ? (C(), s("div", {
|
|
3988
|
+
key: 3,
|
|
3989
|
+
class: v(j(X)("mt-2 flex flex-wrap justify-center gap-2", e.ui?.actions))
|
|
3990
|
+
}, [D(r.$slots, "actions")], 2)) : o("", !0)
|
|
3991
|
+
], 2));
|
|
3992
|
+
}
|
|
3993
|
+
}), Ua = new Intl.Collator("en-GB", {
|
|
3938
3994
|
numeric: !0,
|
|
3939
3995
|
sensitivity: "base"
|
|
3940
3996
|
});
|
|
3941
|
-
function
|
|
3997
|
+
function Wa(e, t) {
|
|
3942
3998
|
let n = e == null || e === "", r = t == null || t === "";
|
|
3943
|
-
return n || r ? n === r ? 0 : n ? 1 : -1 : typeof e == "number" && typeof t == "number" ? e - t : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : typeof e == "boolean" && typeof t == "boolean" ? Number(e) - Number(t) :
|
|
3999
|
+
return n || r ? n === r ? 0 : n ? 1 : -1 : typeof e == "number" && typeof t == "number" ? e - t : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : typeof e == "boolean" && typeof t == "boolean" ? Number(e) - Number(t) : Ua.compare(String(e), String(t));
|
|
3944
4000
|
}
|
|
3945
|
-
function
|
|
4001
|
+
function Ga(e, t, n) {
|
|
3946
4002
|
let r = n && t.find((e) => e.key === n.key);
|
|
3947
4003
|
if (!n || !r) return [...e];
|
|
3948
4004
|
let i = r.sortValue ?? ((e) => e[r.key]), a = n.direction === "asc" ? 1 : -1;
|
|
@@ -3952,10 +4008,10 @@ function Wa(e, t, n) {
|
|
|
3952
4008
|
value: i(e)
|
|
3953
4009
|
})).sort((e, t) => {
|
|
3954
4010
|
let n = e.value === null || e.value === void 0 || e.value === "", r = t.value === null || t.value === void 0 || t.value === "";
|
|
3955
|
-
return (n || r ?
|
|
4011
|
+
return (n || r ? Wa(e.value, t.value) : a * Wa(e.value, t.value)) || e.index - t.index;
|
|
3956
4012
|
}).map((e) => e.row);
|
|
3957
4013
|
}
|
|
3958
|
-
function
|
|
4014
|
+
function Ka(e, t) {
|
|
3959
4015
|
return e?.key === t ? e.direction === "asc" ? {
|
|
3960
4016
|
key: t,
|
|
3961
4017
|
direction: "desc"
|
|
@@ -3965,18 +4021,18 @@ function Ga(e, t) {
|
|
|
3965
4021
|
};
|
|
3966
4022
|
}
|
|
3967
4023
|
// src/components/Table/Table.vue?vue&type=script&setup=true&lang.ts
|
|
3968
|
-
var
|
|
4024
|
+
var qa = [
|
|
3969
4025
|
"tabindex",
|
|
3970
4026
|
"role",
|
|
3971
4027
|
"aria-labelledby",
|
|
3972
4028
|
"aria-label"
|
|
3973
|
-
],
|
|
4029
|
+
], Ja = ["aria-busy"], Ya = ["aria-sort"], Xa = {
|
|
3974
4030
|
key: 0,
|
|
3975
4031
|
class: "sr-only"
|
|
3976
|
-
},
|
|
4032
|
+
}, Za = ["onClick"], Qa = { key: 0 }, $a = ["colspan"], eo = {
|
|
3977
4033
|
key: 0,
|
|
3978
4034
|
class: "inline-flex items-center gap-2"
|
|
3979
|
-
},
|
|
4035
|
+
}, to = "outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus forced-colors:not-focus-visible:outline-0", no = "outline-2 -outline-offset-2 outline-transparent focus-visible:outline-focus forced-colors:not-focus-visible:outline-0", ro = /* @__PURE__ */ f({
|
|
3980
4036
|
__name: "Table",
|
|
3981
4037
|
props: /*@__PURE__*/ h({
|
|
3982
4038
|
columns: {},
|
|
@@ -4003,7 +4059,7 @@ var Ka = [
|
|
|
4003
4059
|
}),
|
|
4004
4060
|
emits: ["update:sort"],
|
|
4005
4061
|
setup(e) {
|
|
4006
|
-
let t = e, r = P(e, "sort"), l = `${N()}-caption`, f = i(() => t.manualSort ? t.rows :
|
|
4062
|
+
let t = e, r = P(e, "sort"), l = `${N()}-caption`, f = i(() => t.manualSort ? t.rows : Ga(t.rows, t.columns, r.value));
|
|
4007
4063
|
function p(e, n) {
|
|
4008
4064
|
return typeof t.rowKey == "function" ? t.rowKey(e, n) : t.rowKey ? e[t.rowKey] : n;
|
|
4009
4065
|
}
|
|
@@ -4024,7 +4080,7 @@ var Ka = [
|
|
|
4024
4080
|
}), x(() => b?.disconnect()), (i, b) => (C(), s("div", {
|
|
4025
4081
|
ref_key: "scroller",
|
|
4026
4082
|
ref: _,
|
|
4027
|
-
class: v(j(X)("relative overflow-auto", y.value &&
|
|
4083
|
+
class: v(j(X)("relative overflow-auto", y.value && no, t.class)),
|
|
4028
4084
|
tabindex: y.value ? 0 : void 0,
|
|
4029
4085
|
role: y.value ? "region" : void 0,
|
|
4030
4086
|
"aria-labelledby": y.value && (e.caption || i.$slots.caption) ? l : void 0,
|
|
@@ -4043,11 +4099,11 @@ var Ka = [
|
|
|
4043
4099
|
scope: "col",
|
|
4044
4100
|
"aria-sort": m(e),
|
|
4045
4101
|
class: v(j(X)("border-b border-black/15 font-bold text-black/65", h.value, g(e)))
|
|
4046
|
-
}, [D(i.$slots, `header-${e.key}`, { column: e }, () => [e.hideLabel ? (C(), s("span",
|
|
4102
|
+
}, [D(i.$slots, `header-${e.key}`, { column: e }, () => [e.hideLabel ? (C(), s("span", Xa, A(e.label), 1)) : e.sortable ? (C(), s("button", {
|
|
4047
4103
|
key: 1,
|
|
4048
4104
|
type: "button",
|
|
4049
|
-
class: v(j(X)("-mx-1 inline-flex cursor-pointer items-center gap-1 rounded px-1 font-bold hover:text-black", e.align === "end" && "flex-row-reverse", r.value?.key === e.key && "text-black",
|
|
4050
|
-
onClick: (t) => r.value = j(
|
|
4105
|
+
class: v(j(X)("-mx-1 inline-flex cursor-pointer items-center gap-1 rounded px-1 font-bold hover:text-black", e.align === "end" && "flex-row-reverse", r.value?.key === e.key && "text-black", to)),
|
|
4106
|
+
onClick: (t) => r.value = j(Ka)(r.value, e.key)
|
|
4051
4107
|
}, [u(A(e.label) + " ", 1), r.value?.key === e.key && r.value.direction === "asc" ? (C(), a(j(G), {
|
|
4052
4108
|
key: 0,
|
|
4053
4109
|
class: "size-4 shrink-0",
|
|
@@ -4060,11 +4116,15 @@ var Ka = [
|
|
|
4060
4116
|
key: 2,
|
|
4061
4117
|
class: "size-4 shrink-0 text-black/40",
|
|
4062
4118
|
"aria-hidden": "true"
|
|
4063
|
-
}))], 10,
|
|
4064
|
-
c("tbody", { class: v(j(X)(e.loading && f.value.length && "opacity-50 transition-opacity")) }, [f.value.length ? o("", !0) : (C(), s("tr",
|
|
4119
|
+
}))], 10, Za)) : (C(), s(n, { key: 2 }, [u(A(e.label), 1)], 64))])], 10, Ya))), 128))])], 2),
|
|
4120
|
+
c("tbody", { class: v(j(X)(e.loading && f.value.length && "opacity-50 transition-opacity")) }, [f.value.length ? o("", !0) : (C(), s("tr", Qa, [c("td", {
|
|
4065
4121
|
colspan: e.columns.length,
|
|
4066
4122
|
class: "px-4 py-8 text-center text-black/65"
|
|
4067
|
-
}, [e.loading ? (C(), s("span",
|
|
4123
|
+
}, [e.loading ? (C(), s("span", eo, [d(xn, { size: "sm" }), b[0] ||= u(" Loading… ", -1)])) : D(i.$slots, "empty", {}, () => [d(Ha, {
|
|
4124
|
+
size: "sm",
|
|
4125
|
+
description: e.emptyText,
|
|
4126
|
+
class: "p-0"
|
|
4127
|
+
}, null, 8, ["description"])], void 0, 1)], 8, $a)])), (C(!0), s(n, null, E(f.value, (t, r) => (C(), s("tr", {
|
|
4068
4128
|
key: p(t, r),
|
|
4069
4129
|
class: v(j(X)("group/row", e.ui?.row))
|
|
4070
4130
|
}, [(C(!0), s(n, null, E(e.columns, (e) => (C(), a(O(e.rowHeader ? "th" : "td"), {
|
|
@@ -4083,24 +4143,24 @@ var Ka = [
|
|
|
4083
4143
|
key: 1,
|
|
4084
4144
|
class: v(j(X)("font-bold *:*:border-t *:*:border-black/15", e.size === "sm" ? "*:*:px-4 *:*:py-2" : "*:*:px-4 *:*:py-3"))
|
|
4085
4145
|
}, [D(i.$slots, "footer")], 2)) : o("", !0)
|
|
4086
|
-
], 10,
|
|
4146
|
+
], 10, Ja)], 10, qa));
|
|
4087
4147
|
}
|
|
4088
|
-
}),
|
|
4148
|
+
}), io = { class: "flex items-center gap-2 text-sm text-black/65" }, ao = { class: "flex flex-wrap items-baseline gap-x-2 gap-y-1" }, oo = { class: "text-2xl font-bold tabular-nums" }, so = {
|
|
4089
4149
|
key: 1,
|
|
4090
4150
|
class: "sr-only"
|
|
4091
|
-
},
|
|
4151
|
+
}, co = {
|
|
4092
4152
|
key: 2,
|
|
4093
4153
|
class: "font-bold tabular-nums"
|
|
4094
|
-
},
|
|
4154
|
+
}, lo = {
|
|
4095
4155
|
key: 3,
|
|
4096
4156
|
class: "text-black/65"
|
|
4097
|
-
},
|
|
4157
|
+
}, uo = {
|
|
4098
4158
|
key: 0,
|
|
4099
4159
|
class: "text-sm text-black/65"
|
|
4100
|
-
},
|
|
4160
|
+
}, fo = {
|
|
4101
4161
|
key: 1,
|
|
4102
4162
|
class: "mt-2 text-sm"
|
|
4103
|
-
},
|
|
4163
|
+
}, po = /* @__PURE__ */ f({
|
|
4104
4164
|
__name: "StatTile",
|
|
4105
4165
|
props: {
|
|
4106
4166
|
label: {},
|
|
@@ -4135,12 +4195,12 @@ var Ka = [
|
|
|
4135
4195
|
ui: { body: "gap-1" }
|
|
4136
4196
|
}, {
|
|
4137
4197
|
default: z(() => [
|
|
4138
|
-
c("p",
|
|
4198
|
+
c("p", io, [e.icon ? (C(), a(O(e.icon), {
|
|
4139
4199
|
key: 0,
|
|
4140
4200
|
class: "size-4 shrink-0",
|
|
4141
4201
|
"aria-hidden": "true"
|
|
4142
4202
|
})) : o("", !0), u(" " + A(e.label), 1)]),
|
|
4143
|
-
c("div",
|
|
4203
|
+
c("div", ao, [c("p", oo, [D(i.$slots, "value", {}, () => [u(A(e.value ?? "—"), 1)])]), e.change || e.trend ? (C(), s("p", {
|
|
4144
4204
|
key: 0,
|
|
4145
4205
|
class: v(j(X)("inline-flex items-center gap-0.5 text-sm", r[n.value]))
|
|
4146
4206
|
}, [
|
|
@@ -4149,29 +4209,29 @@ var Ka = [
|
|
|
4149
4209
|
class: "size-4 shrink-0",
|
|
4150
4210
|
"aria-hidden": "true"
|
|
4151
4211
|
})) : o("", !0),
|
|
4152
|
-
e.trend ? (C(), s("span",
|
|
4153
|
-
e.change ? (C(), s("span",
|
|
4154
|
-
e.changeLabel ? (C(), s("span",
|
|
4212
|
+
e.trend ? (C(), s("span", so, A(d[e.trend]), 1)) : o("", !0),
|
|
4213
|
+
e.change ? (C(), s("span", co, A(e.change), 1)) : o("", !0),
|
|
4214
|
+
e.changeLabel ? (C(), s("span", lo, "\xA0" + A(e.changeLabel), 1)) : o("", !0)
|
|
4155
4215
|
], 2)) : o("", !0)]),
|
|
4156
|
-
e.description || i.$slots.description ? (C(), s("p",
|
|
4157
|
-
i.$slots.footer ? (C(), s("div",
|
|
4216
|
+
e.description || i.$slots.description ? (C(), s("p", uo, [D(i.$slots, "description", {}, () => [u(A(e.description), 1)])])) : o("", !0),
|
|
4217
|
+
i.$slots.footer ? (C(), s("div", fo, [D(i.$slots, "footer")])) : o("", !0)
|
|
4158
4218
|
]),
|
|
4159
4219
|
_: 3
|
|
4160
4220
|
}, 8, ["class"]));
|
|
4161
4221
|
}
|
|
4162
|
-
}),
|
|
4222
|
+
}), mo = { class: "col-span-2 text-black/65 @sm:col-span-1" }, ho = { class: "sr-only" }, go = {
|
|
4163
4223
|
key: 0,
|
|
4164
4224
|
class: "mt-0.5 block text-black/65"
|
|
4165
|
-
},
|
|
4225
|
+
}, _o = {
|
|
4166
4226
|
key: 0,
|
|
4167
4227
|
class: "justify-self-end"
|
|
4168
|
-
},
|
|
4228
|
+
}, vo = { class: "text-black/65" }, yo = { class: "sr-only" }, bo = {
|
|
4169
4229
|
key: 0,
|
|
4170
4230
|
class: "mt-0.5 block font-normal text-black/65"
|
|
4171
|
-
},
|
|
4231
|
+
}, xo = {
|
|
4172
4232
|
key: 1,
|
|
4173
4233
|
class: "mt-1 block font-normal"
|
|
4174
|
-
},
|
|
4234
|
+
}, So = /* @__PURE__ */ f({
|
|
4175
4235
|
__name: "SummaryList",
|
|
4176
4236
|
props: {
|
|
4177
4237
|
items: {},
|
|
@@ -4196,37 +4256,37 @@ var Ka = [
|
|
|
4196
4256
|
key: t.label,
|
|
4197
4257
|
class: v(j(X)("grid grid-cols-[1fr_auto] gap-x-4 gap-y-1 border-b border-black/15 py-3 first:pt-0 last:border-b-0 last:pb-0", i[e.labelWidth]))
|
|
4198
4258
|
}, [
|
|
4199
|
-
c("dt",
|
|
4259
|
+
c("dt", mo, A(t.label), 1),
|
|
4200
4260
|
c("dd", { class: v(j(X)("min-w-0 break-words", t.emphasis && "font-bold", !a.$slots.action && "col-span-2")) }, [D(a.$slots, "value", {
|
|
4201
4261
|
item: t,
|
|
4202
4262
|
index: d
|
|
4203
4263
|
}, () => [r(t.value) ? (C(), s(n, { key: 1 }, [l[0] ||= c("span", {
|
|
4204
4264
|
class: "text-black/40",
|
|
4205
4265
|
"aria-hidden": "true"
|
|
4206
|
-
}, "—", -1), c("span",
|
|
4207
|
-
a.$slots.action ? (C(), s("dd",
|
|
4266
|
+
}, "—", -1), c("span", ho, A(e.emptyLabel), 1)], 64)) : (C(), s(n, { key: 0 }, [u(A(t.value), 1)], 64))]), t.description ? (C(), s("span", go, A(t.description), 1)) : o("", !0)], 2),
|
|
4267
|
+
a.$slots.action ? (C(), s("dd", _o, [D(a.$slots, "action", {
|
|
4208
4268
|
item: t,
|
|
4209
4269
|
index: d
|
|
4210
4270
|
})])) : o("", !0)
|
|
4211
4271
|
], 2))), 128)) : (C(!0), s(n, { key: 1 }, E(e.items, (t, i) => (C(), s("div", {
|
|
4212
4272
|
key: t.label,
|
|
4213
4273
|
class: v(e.layout === "compact" ? "col-span-2 grid grid-cols-subgrid items-baseline" : "flex min-w-0 flex-col gap-1")
|
|
4214
|
-
}, [c("dt",
|
|
4274
|
+
}, [c("dt", vo, A(t.label), 1), c("dd", { class: v(j(X)("min-w-0 break-words", e.layout === "compact" && "text-right font-bold tabular-nums", t.emphasis && "font-bold")) }, [
|
|
4215
4275
|
D(a.$slots, "value", {
|
|
4216
4276
|
item: t,
|
|
4217
4277
|
index: i
|
|
4218
4278
|
}, () => [r(t.value) ? (C(), s(n, { key: 1 }, [l[1] ||= c("span", {
|
|
4219
4279
|
class: "text-black/40",
|
|
4220
4280
|
"aria-hidden": "true"
|
|
4221
|
-
}, "—", -1), c("span",
|
|
4222
|
-
t.description ? (C(), s("span",
|
|
4223
|
-
a.$slots.action ? (C(), s("span",
|
|
4281
|
+
}, "—", -1), c("span", yo, A(e.emptyLabel), 1)], 64)) : (C(), s(n, { key: 0 }, [u(A(t.value), 1)], 64))]),
|
|
4282
|
+
t.description ? (C(), s("span", bo, A(t.description), 1)) : o("", !0),
|
|
4283
|
+
a.$slots.action ? (C(), s("span", xo, [D(a.$slots, "action", {
|
|
4224
4284
|
item: t,
|
|
4225
4285
|
index: i
|
|
4226
4286
|
})])) : o("", !0)
|
|
4227
4287
|
], 2)], 2))), 128))], 2)], 2));
|
|
4228
4288
|
}
|
|
4229
|
-
}),
|
|
4289
|
+
}), Co = { class: "flex h-5 shrink-0 items-center" }, wo = { class: "sr-only" }, To = /* @__PURE__ */ f({
|
|
4230
4290
|
__name: "Checklist",
|
|
4231
4291
|
props: {
|
|
4232
4292
|
items: {},
|
|
@@ -4243,7 +4303,7 @@ var Ka = [
|
|
|
4243
4303
|
return (r, i) => (C(), s("ul", { class: v(j(X)("flex flex-col gap-2 text-sm", t.class)) }, [(C(!0), s(n, null, E(e.items, (e) => (C(), s("li", {
|
|
4244
4304
|
key: e.label,
|
|
4245
4305
|
class: "flex items-start gap-2"
|
|
4246
|
-
}, [c("span",
|
|
4306
|
+
}, [c("span", Co, [e.done ? (C(), a(j(fe), {
|
|
4247
4307
|
key: 0,
|
|
4248
4308
|
class: "size-4 text-green",
|
|
4249
4309
|
"aria-hidden": "true"
|
|
@@ -4251,11 +4311,11 @@ var Ka = [
|
|
|
4251
4311
|
key: 1,
|
|
4252
4312
|
class: "size-4 text-black/40",
|
|
4253
4313
|
"aria-hidden": "true"
|
|
4254
|
-
}))]), c("span", { class: v(e.done ? "text-black" : "text-black/65") }, [u(A(e.label), 1), c("span",
|
|
4314
|
+
}))]), c("span", { class: v(e.done ? "text-black" : "text-black/65") }, [u(A(e.label), 1), c("span", wo, A(e.done ? " (done)" : " (to do)"), 1)], 2)]))), 128))], 2));
|
|
4255
4315
|
}
|
|
4256
4316
|
});
|
|
4257
4317
|
// src/lib/dates.ts
|
|
4258
|
-
function
|
|
4318
|
+
function Eo(e) {
|
|
4259
4319
|
if (e instanceof Date) return e;
|
|
4260
4320
|
if (typeof e == "string" && /^\d{4}-\d{2}-\d{2}$/.test(e)) {
|
|
4261
4321
|
let [t, n, r] = e.split("-").map(Number);
|
|
@@ -4263,59 +4323,59 @@ function To(e) {
|
|
|
4263
4323
|
}
|
|
4264
4324
|
return new Date(e);
|
|
4265
4325
|
}
|
|
4266
|
-
var
|
|
4326
|
+
var Do = [
|
|
4267
4327
|
["year", 31536e3],
|
|
4268
4328
|
["month", 2592e3],
|
|
4269
4329
|
["week", 604800],
|
|
4270
4330
|
["day", 86400],
|
|
4271
4331
|
["hour", 3600],
|
|
4272
4332
|
["minute", 60]
|
|
4273
|
-
],
|
|
4274
|
-
function
|
|
4275
|
-
let n = Math.round((
|
|
4333
|
+
], Oo = new Intl.RelativeTimeFormat("en-GB", { numeric: "auto" });
|
|
4334
|
+
function ko(e, t = /* @__PURE__ */ new Date()) {
|
|
4335
|
+
let n = Math.round((Eo(e).getTime() - t.getTime()) / 1e3);
|
|
4276
4336
|
if (Math.abs(n) < 60) return "Just now";
|
|
4277
|
-
for (let [e, t] of
|
|
4278
|
-
let r =
|
|
4337
|
+
for (let [e, t] of Do) if (Math.abs(n) >= t) {
|
|
4338
|
+
let r = Oo.format(Math.trunc(n / t), e);
|
|
4279
4339
|
return r.charAt(0).toUpperCase() + r.slice(1);
|
|
4280
4340
|
}
|
|
4281
4341
|
return "Just now";
|
|
4282
4342
|
}
|
|
4283
|
-
function
|
|
4284
|
-
let t =
|
|
4343
|
+
function Ao(e) {
|
|
4344
|
+
let t = Eo(e), n = t.toLocaleDateString("en-GB", { weekday: "long" }), r = t.toLocaleTimeString("en-GB", {
|
|
4285
4345
|
hour: "2-digit",
|
|
4286
4346
|
minute: "2-digit"
|
|
4287
4347
|
});
|
|
4288
|
-
return `${n} ${
|
|
4348
|
+
return `${n} ${jo(t)} at ${r}`;
|
|
4289
4349
|
}
|
|
4290
|
-
function
|
|
4291
|
-
return
|
|
4350
|
+
function jo(e) {
|
|
4351
|
+
return Eo(e).toLocaleDateString("en-GB", {
|
|
4292
4352
|
day: "numeric",
|
|
4293
4353
|
month: "long",
|
|
4294
4354
|
year: "numeric"
|
|
4295
4355
|
});
|
|
4296
4356
|
}
|
|
4297
|
-
function
|
|
4298
|
-
let n =
|
|
4357
|
+
function Mo(e, t = /* @__PURE__ */ new Date()) {
|
|
4358
|
+
let n = Eo(e), r = t.getFullYear() - n.getFullYear(), i = t.getMonth() - n.getMonth();
|
|
4299
4359
|
return (i < 0 || i === 0 && t.getDate() < n.getDate()) && r--, r;
|
|
4300
4360
|
}
|
|
4301
|
-
function
|
|
4302
|
-
let n =
|
|
4361
|
+
function No(e, t = /* @__PURE__ */ new Date()) {
|
|
4362
|
+
let n = Eo(e), r = new Date(t.getFullYear(), t.getMonth(), t.getDate()), i = (e) => {
|
|
4303
4363
|
let t = new Date(e, n.getMonth(), n.getDate());
|
|
4304
4364
|
return t.getMonth() === n.getMonth() ? t : new Date(e, 2, 1);
|
|
4305
4365
|
}, a = i(r.getFullYear());
|
|
4306
4366
|
return a < r && (a = i(r.getFullYear() + 1)), Math.round((a.getTime() - r.getTime()) / 864e5);
|
|
4307
4367
|
}
|
|
4308
4368
|
// src/lib/useNow.ts
|
|
4309
|
-
var
|
|
4310
|
-
function
|
|
4369
|
+
var Po = T(/* @__PURE__ */ new Date()), Fo = 0, Io;
|
|
4370
|
+
function Lo() {
|
|
4311
4371
|
return S(() => {
|
|
4312
|
-
|
|
4372
|
+
Fo++ === 0 && (Po.value = /* @__PURE__ */ new Date(), Io = setInterval(() => Po.value = /* @__PURE__ */ new Date(), 3e4));
|
|
4313
4373
|
}), x(() => {
|
|
4314
|
-
--
|
|
4315
|
-
}),
|
|
4374
|
+
--Fo === 0 && clearInterval(Io);
|
|
4375
|
+
}), Po;
|
|
4316
4376
|
}
|
|
4317
4377
|
// src/components/RelativeTime/RelativeTime.vue?vue&type=script&setup=true&lang.ts
|
|
4318
|
-
var
|
|
4378
|
+
var Ro = ["datetime"], zo = /* @__PURE__ */ f({
|
|
4319
4379
|
__name: "RelativeTime",
|
|
4320
4380
|
props: {
|
|
4321
4381
|
date: {},
|
|
@@ -4330,17 +4390,17 @@ var Lo = ["datetime"], Ro = /* @__PURE__ */ f({
|
|
|
4330
4390
|
] }
|
|
4331
4391
|
},
|
|
4332
4392
|
setup(e) {
|
|
4333
|
-
let t = e, n =
|
|
4393
|
+
let t = e, n = Lo(), r = i(() => Eo(t.date)), o = i(() => ko(r.value, t.now ?? n.value)), s = i(() => t.tooltip ? t.tooltip(r.value) : Ao(r.value));
|
|
4334
4394
|
return (e, n) => (C(), a(ia, { text: s.value }, {
|
|
4335
4395
|
default: z(() => [c("time", {
|
|
4336
4396
|
datetime: r.value.toISOString(),
|
|
4337
4397
|
tabindex: "0",
|
|
4338
4398
|
class: v(j(X)("cursor-default rounded-sm underline decoration-current/40 decoration-dotted underline-offset-2", "outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus forced-colors:not-focus-visible:outline-0", t.class))
|
|
4339
|
-
}, A(o.value), 11,
|
|
4399
|
+
}, A(o.value), 11, Ro)]),
|
|
4340
4400
|
_: 1
|
|
4341
4401
|
}, 8, ["text"]));
|
|
4342
4402
|
}
|
|
4343
|
-
}),
|
|
4403
|
+
}), Bo = ["data-birth-date"], Vo = /* @__PURE__ */ f({
|
|
4344
4404
|
__name: "Age",
|
|
4345
4405
|
props: {
|
|
4346
4406
|
birthDate: {},
|
|
@@ -4355,9 +4415,9 @@ var Lo = ["datetime"], Ro = /* @__PURE__ */ f({
|
|
|
4355
4415
|
] }
|
|
4356
4416
|
},
|
|
4357
4417
|
setup(e) {
|
|
4358
|
-
let t = e, r =
|
|
4359
|
-
let e =
|
|
4360
|
-
return `Born ${
|
|
4418
|
+
let t = e, r = Lo(), l = i(() => Eo(t.birthDate)), d = i(() => t.now ?? r.value), f = i(() => Mo(l.value, d.value)), p = i(() => {
|
|
4419
|
+
let e = No(l.value, d.value), t = e === 0 ? " · Birthday today" : e === 1 ? " · Birthday tomorrow" : e <= 7 ? ` · Birthday in ${e} days` : "";
|
|
4420
|
+
return `Born ${jo(l.value)}${t}`;
|
|
4361
4421
|
}), m = i(() => {
|
|
4362
4422
|
let e = l.value;
|
|
4363
4423
|
return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
|
|
@@ -4367,11 +4427,11 @@ var Lo = ["datetime"], Ro = /* @__PURE__ */ f({
|
|
|
4367
4427
|
tabindex: "0",
|
|
4368
4428
|
"data-birth-date": m.value,
|
|
4369
4429
|
class: v(j(X)("cursor-default rounded-sm tabular-nums underline decoration-current/40 decoration-dotted underline-offset-2", "outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus forced-colors:not-focus-visible:outline-0", t.class))
|
|
4370
|
-
}, [u(A(f.value), 1), e.suffix ? (C(), s(n, { key: 0 }, [u("\xA0" + A(e.suffix), 1)], 64)) : o("", !0)], 10,
|
|
4430
|
+
}, [u(A(f.value), 1), e.suffix ? (C(), s(n, { key: 0 }, [u("\xA0" + A(e.suffix), 1)], 64)) : o("", !0)], 10, Bo)]),
|
|
4371
4431
|
_: 1
|
|
4372
4432
|
}, 8, ["text"]));
|
|
4373
4433
|
}
|
|
4374
|
-
}),
|
|
4434
|
+
}), Ho = /* @__PURE__ */ f({
|
|
4375
4435
|
__name: "Link",
|
|
4376
4436
|
props: {
|
|
4377
4437
|
href: {},
|
|
@@ -4416,11 +4476,11 @@ var Lo = ["datetime"], Ro = /* @__PURE__ */ f({
|
|
|
4416
4476
|
"class"
|
|
4417
4477
|
]));
|
|
4418
4478
|
}
|
|
4419
|
-
}),
|
|
4420
|
-
function
|
|
4479
|
+
}), Uo = 0, Wo = () => `notification-${Date.now().toString(36)}-${(Uo++).toString(36)}`;
|
|
4480
|
+
function Go(e, t) {
|
|
4421
4481
|
return t === void 0 ? e.type === "error" ? Infinity : e.action ? e.compact ? 1e4 : Infinity : 6e3 : t;
|
|
4422
4482
|
}
|
|
4423
|
-
function
|
|
4483
|
+
function Ko(e = []) {
|
|
4424
4484
|
let t = w({
|
|
4425
4485
|
items: e.map(n).sort((e, t) => t.createdAt.getTime() - e.createdAt.getTime()),
|
|
4426
4486
|
toasts: [],
|
|
@@ -4430,7 +4490,7 @@ function Go(e = []) {
|
|
|
4430
4490
|
function n(e) {
|
|
4431
4491
|
return {
|
|
4432
4492
|
...e,
|
|
4433
|
-
id: e.id ??
|
|
4493
|
+
id: e.id ?? Wo(),
|
|
4434
4494
|
type: e.type ?? "info",
|
|
4435
4495
|
createdAt: e.createdAt ?? /* @__PURE__ */ new Date(),
|
|
4436
4496
|
read: e.read ?? !1
|
|
@@ -4440,7 +4500,7 @@ function Go(e = []) {
|
|
|
4440
4500
|
let i = n(e);
|
|
4441
4501
|
return t.items = [i, ...t.items.filter((e) => e.id !== i.id)], r.toast !== !1 && !t.paneOpen && (t.toasts = [...t.toasts.filter((e) => e.id !== i.id), {
|
|
4442
4502
|
id: i.id,
|
|
4443
|
-
duration:
|
|
4503
|
+
duration: Go(i, r.duration),
|
|
4444
4504
|
item: i
|
|
4445
4505
|
}]), i.id;
|
|
4446
4506
|
}
|
|
@@ -4489,25 +4549,25 @@ function Go(e = []) {
|
|
|
4489
4549
|
markAllRead: c
|
|
4490
4550
|
};
|
|
4491
4551
|
}
|
|
4492
|
-
var
|
|
4493
|
-
function
|
|
4494
|
-
return
|
|
4552
|
+
var qo;
|
|
4553
|
+
function Jo() {
|
|
4554
|
+
return qo ??= Ko();
|
|
4495
4555
|
}
|
|
4496
4556
|
// src/components/Notification/Notification.vue?vue&type=script&setup=true&lang.ts
|
|
4497
|
-
var
|
|
4557
|
+
var Yo = { class: "sr-only" }, Xo = {
|
|
4498
4558
|
key: 0,
|
|
4499
4559
|
class: "text-black/65 [&_a]:font-bold [&_a]:text-primary [&_a]:underline [&_b]:font-bold [&_b]:text-black [&_strong]:font-bold [&_strong]:text-black"
|
|
4500
|
-
},
|
|
4560
|
+
}, Zo = {
|
|
4501
4561
|
key: 1,
|
|
4502
4562
|
class: "flex items-center gap-1.5 text-xs text-black/65"
|
|
4503
|
-
},
|
|
4563
|
+
}, Qo = {
|
|
4504
4564
|
key: 0,
|
|
4505
4565
|
class: "size-2 shrink-0 rounded-full bg-primary",
|
|
4506
4566
|
"aria-hidden": "true"
|
|
4507
|
-
},
|
|
4567
|
+
}, $o = {
|
|
4508
4568
|
key: 1,
|
|
4509
4569
|
class: "sr-only"
|
|
4510
|
-
},
|
|
4570
|
+
}, es = ["href"], ts = /* @__PURE__ */ f({
|
|
4511
4571
|
__name: "Notification",
|
|
4512
4572
|
props: {
|
|
4513
4573
|
type: { default: "info" },
|
|
@@ -4572,12 +4632,12 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4572
4632
|
c("p", {
|
|
4573
4633
|
id: l,
|
|
4574
4634
|
class: v(j(X)("font-bold", m.value && "min-w-0 flex-1 py-1"))
|
|
4575
|
-
}, [c("span",
|
|
4576
|
-
!m.value && (e.description || t.$slots.default) ? (C(), s("div",
|
|
4577
|
-
e.appearance === "row" && (e.createdAt || e.unread) ? (C(), s("p",
|
|
4578
|
-
e.unread ? (C(), s("span",
|
|
4579
|
-
e.unread ? (C(), s("span",
|
|
4580
|
-
e.createdAt ? (C(), a(
|
|
4635
|
+
}, [c("span", Yo, A(f[e.type].word) + ": ", 1), u(A(e.title), 1)], 2),
|
|
4636
|
+
!m.value && (e.description || t.$slots.default) ? (C(), s("div", Xo, [D(t.$slots, "default", {}, () => [d(p)])])) : o("", !0),
|
|
4637
|
+
e.appearance === "row" && (e.createdAt || e.unread) ? (C(), s("p", Zo, [
|
|
4638
|
+
e.unread ? (C(), s("span", Qo)) : o("", !0),
|
|
4639
|
+
e.unread ? (C(), s("span", $o, "Unread, ")) : o("", !0),
|
|
4640
|
+
e.createdAt ? (C(), a(zo, {
|
|
4581
4641
|
key: 2,
|
|
4582
4642
|
date: e.createdAt,
|
|
4583
4643
|
now: e.now
|
|
@@ -4592,7 +4652,7 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4592
4652
|
"as-child": "",
|
|
4593
4653
|
onClick: h
|
|
4594
4654
|
}, {
|
|
4595
|
-
default: z(() => [c("a", { href: e.action.href }, A(e.action.label), 9,
|
|
4655
|
+
default: z(() => [c("a", { href: e.action.href }, A(e.action.label), 9, es)]),
|
|
4596
4656
|
_: 1
|
|
4597
4657
|
})) : e.action ? (C(), a(Z, {
|
|
4598
4658
|
key: 1,
|
|
@@ -4618,11 +4678,11 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4618
4678
|
}, 8, ["class", "aria-label"])) : o("", !0)
|
|
4619
4679
|
], 2));
|
|
4620
4680
|
}
|
|
4621
|
-
}),
|
|
4681
|
+
}), ns = {
|
|
4622
4682
|
key: 0,
|
|
4623
4683
|
class: "absolute top-1 left-1/2 ml-1 flex h-4 min-w-4 items-center justify-center rounded-full bg-red px-1 text-xs leading-none font-bold text-white ring-2 ring-white",
|
|
4624
4684
|
"aria-hidden": "true"
|
|
4625
|
-
},
|
|
4685
|
+
}, rs = { class: "flex h-11 shrink-0 items-center justify-between gap-2 border-b border-black/15 pr-2 pl-4" }, is = ["inert"], as = /* @__PURE__ */ f({
|
|
4626
4686
|
__name: "NotificationPane",
|
|
4627
4687
|
props: /*@__PURE__*/ h({
|
|
4628
4688
|
notifications: {},
|
|
@@ -4638,7 +4698,7 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4638
4698
|
}),
|
|
4639
4699
|
emits: ["update:open"],
|
|
4640
4700
|
setup(e) {
|
|
4641
|
-
let t = e, r = P(e, "open"), l = i(() => t.notifications ??
|
|
4701
|
+
let t = e, r = P(e, "open"), l = i(() => t.notifications ?? Jo()), f = i(() => l.value.items), p = i(() => l.value.unreadCount.value), m = i(() => p.value > 99 ? "99+" : String(p.value)), h = i(() => p.value ? `${t.label}, ${m.value} unread` : t.label), g = `${N()}-heading`, y = T(), b = T();
|
|
4642
4702
|
L(r, (e) => l.value.setPaneOpen(e), { immediate: !0 }), L(() => l.value.paneRequests, async () => {
|
|
4643
4703
|
r.value = !0, await _(), requestAnimationFrame(() => requestAnimationFrame(() => y.value?.focus()));
|
|
4644
4704
|
}), L(r, (e, t) => {
|
|
@@ -4685,7 +4745,7 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4685
4745
|
ref: x,
|
|
4686
4746
|
"aria-labelledby": g,
|
|
4687
4747
|
class: "flex min-h-0 flex-col"
|
|
4688
|
-
}, [c("div",
|
|
4748
|
+
}, [c("div", rs, [c("h2", {
|
|
4689
4749
|
id: g,
|
|
4690
4750
|
ref_key: "heading",
|
|
4691
4751
|
ref: y,
|
|
@@ -4710,7 +4770,7 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4710
4770
|
}, [(C(!0), s(n, null, E(f.value, (e, n) => (C(), s("li", {
|
|
4711
4771
|
key: e.id,
|
|
4712
4772
|
class: "border-b border-black/15 last:border-b-0"
|
|
4713
|
-
}, [d(
|
|
4773
|
+
}, [d(ts, {
|
|
4714
4774
|
appearance: "row",
|
|
4715
4775
|
type: e.type,
|
|
4716
4776
|
title: e.title,
|
|
@@ -4729,26 +4789,32 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4729
4789
|
"unread",
|
|
4730
4790
|
"onDismiss",
|
|
4731
4791
|
"onAction"
|
|
4732
|
-
])]))), 128))], 42,
|
|
4792
|
+
])]))), 128))], 42, is)) : (C(), a(Ha, {
|
|
4733
4793
|
key: 1,
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
"
|
|
4738
|
-
|
|
4794
|
+
size: "sm",
|
|
4795
|
+
icon: j(K),
|
|
4796
|
+
description: e.emptyText,
|
|
4797
|
+
class: v(j(X)(w.value && "motion-safe:animate-empty-in")),
|
|
4798
|
+
ui: { icon: j(X)("origin-top", w.value && "motion-safe:animate-bell-wobble") }
|
|
4799
|
+
}, null, 8, [
|
|
4800
|
+
"icon",
|
|
4801
|
+
"description",
|
|
4802
|
+
"class",
|
|
4803
|
+
"ui"
|
|
4804
|
+
]))], 512)]),
|
|
4739
4805
|
default: z(() => [d(Z, {
|
|
4740
4806
|
variant: "ghost",
|
|
4741
4807
|
square: "",
|
|
4742
4808
|
"aria-label": h.value,
|
|
4743
4809
|
class: v(j(X)("relative overflow-visible", e.ui?.trigger))
|
|
4744
4810
|
}, {
|
|
4745
|
-
default: z(() => [d(j(re)), p.value ? (C(), s("span",
|
|
4811
|
+
default: z(() => [d(j(re)), p.value ? (C(), s("span", ns, A(m.value), 1)) : o("", !0)]),
|
|
4746
4812
|
_: 1
|
|
4747
4813
|
}, 8, ["aria-label", "class"])]),
|
|
4748
4814
|
_: 1
|
|
4749
4815
|
}, 8, ["open", "ui"]));
|
|
4750
4816
|
}
|
|
4751
|
-
}),
|
|
4817
|
+
}), os = { class: "in-data-expanded:hidden" }, ss = { class: "hidden in-data-expanded:inline" }, cs = 8, ls = .5, us = 80, ds = /* @__PURE__ */ f({
|
|
4752
4818
|
__name: "Toaster",
|
|
4753
4819
|
props: {
|
|
4754
4820
|
notifications: {},
|
|
@@ -4765,15 +4831,15 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4765
4831
|
},
|
|
4766
4832
|
emits: ["more"],
|
|
4767
4833
|
setup(e, { emit: t }) {
|
|
4768
|
-
let r = e, l = t, f = i(() => r.notifications ??
|
|
4834
|
+
let r = e, l = t, f = i(() => r.notifications ?? Jo()), p = i(() => r.position === "top-right"), m = T(typeof window > "u" ? 800 : window.innerHeight), h = () => m.value = window.innerHeight;
|
|
4769
4835
|
S(() => window.addEventListener("resize", h)), x(() => window.removeEventListener("resize", h));
|
|
4770
|
-
let g = i(() => Math.max(m.value -
|
|
4771
|
-
let e = f.value.toasts.slice(-r.limit).reverse(), t = (e) => I.get(e.id) ?? y(e.item), n = e.filter((e) => !H.has(e.id)), i = n.reduce((e, n) => e + t(n) +
|
|
4836
|
+
let g = i(() => Math.max(m.value - us, 108)), y = (e) => e.compact ? 42 : e.action ? 116 : e.description ? 78 : 56, D = i(() => {
|
|
4837
|
+
let e = f.value.toasts.slice(-r.limit).reverse(), t = (e) => I.get(e.id) ?? y(e.item), n = e.filter((e) => !H.has(e.id)), i = n.reduce((e, n) => e + t(n) + cs, -8), a = /* @__PURE__ */ new Set();
|
|
4772
4838
|
if (i <= g.value) n.forEach((e) => a.add(e.id));
|
|
4773
4839
|
else {
|
|
4774
4840
|
let e = 44;
|
|
4775
4841
|
for (let r of n) {
|
|
4776
|
-
let n = e + t(r) + (a.size ?
|
|
4842
|
+
let n = e + t(r) + (a.size ? cs : 0);
|
|
4777
4843
|
if (a.size && n > g.value) break;
|
|
4778
4844
|
a.add(r.id), e = n;
|
|
4779
4845
|
}
|
|
@@ -4828,16 +4894,16 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4828
4894
|
}
|
|
4829
4895
|
let G = i(() => {
|
|
4830
4896
|
let e = O.value.filter((e) => !H.has(e.id)), t = /* @__PURE__ */ new Map(), n = [], i = 0;
|
|
4831
|
-
for (let t of e) n.push(i), i += (I.get(t.id) ?? 0) +
|
|
4832
|
-
let a = Math.max(i -
|
|
4897
|
+
for (let t of e) n.push(i), i += (I.get(t.id) ?? 0) + cs;
|
|
4898
|
+
let a = Math.max(i - cs, 0), o = Math.min(r.maxHeight, g.value), s = 0;
|
|
4833
4899
|
for (; s < e.length && (s === 0 || n[s] + (I.get(e[s].id) ?? 0) <= o);) s++;
|
|
4834
|
-
let c = e[s - 1], l = n[s - 1] ?? 0, u = c ? I.get(c.id) ?? 0 : 0, d = l + u +
|
|
4900
|
+
let c = e[s - 1], l = n[s - 1] ?? 0, u = c ? I.get(c.id) ?? 0 : 0, d = l + u + cs;
|
|
4835
4901
|
e.forEach((r, i) => {
|
|
4836
4902
|
let a = i >= s;
|
|
4837
4903
|
t.set(r.id, {
|
|
4838
4904
|
spread: n[i],
|
|
4839
4905
|
stacked: a ? d : n[i],
|
|
4840
|
-
scale: a ?
|
|
4906
|
+
scale: a ? ls : 1,
|
|
4841
4907
|
opacity: +!a,
|
|
4842
4908
|
z: e.length - i
|
|
4843
4909
|
});
|
|
@@ -4848,7 +4914,7 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4848
4914
|
places: t,
|
|
4849
4915
|
spreadHeight: a + (k.value > 0 ? 44 : 0),
|
|
4850
4916
|
stackedHeight: p,
|
|
4851
|
-
moreOffset: a + (a ?
|
|
4917
|
+
moreOffset: a + (a ? cs : 0),
|
|
4852
4918
|
notInView: f,
|
|
4853
4919
|
pillOffset: d
|
|
4854
4920
|
};
|
|
@@ -4857,10 +4923,10 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4857
4923
|
let t = H.has(e) ? U.get(e) : G.value.places.get(e), n = p.value ? 1 : -1, r = (e) => `${n * e}px`, i = {
|
|
4858
4924
|
"--toast-spread": r(G.value.moreOffset),
|
|
4859
4925
|
"--toast-stacked": r(G.value.pillOffset),
|
|
4860
|
-
"--toast-scale":
|
|
4926
|
+
"--toast-scale": ls,
|
|
4861
4927
|
"--toast-opacity": 0,
|
|
4862
4928
|
"--toast-spread-opacity": 0,
|
|
4863
|
-
"--toast-spread-scale":
|
|
4929
|
+
"--toast-spread-scale": ls,
|
|
4864
4930
|
"--toast-z": 0
|
|
4865
4931
|
};
|
|
4866
4932
|
if (!t && M.has(e) || t && !V.has(e) && N.has(e)) return i;
|
|
@@ -4918,7 +4984,7 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4918
4984
|
class: v(j(X)("absolute inset-x-0 z-(--toast-z) list-none rounded", "outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus forced-colors:not-focus-visible:outline-0", p.value ? "top-0 origin-top" : "bottom-0 origin-bottom", "translate-y-(--toast-stacked) scale-(--toast-scale) opacity-(--toast-opacity)", "data-expanded:translate-y-(--toast-spread) data-expanded:scale-(--toast-spread-scale) data-expanded:opacity-(--toast-spread-opacity)", "transition-[translate,scale,opacity] duration-300 ease-out motion-reduce:transition-none", "data-[state=closed]:animate-fade-out", "data-[swipe=move]:translate-x-(--reka-toast-swipe-move-x) data-[swipe=move]:transition-none", "data-[swipe=cancel]:translate-x-0", "data-[swipe=end]:animate-slide-out-right")),
|
|
4919
4985
|
"onUpdate:open": (t) => W(e.id, t)
|
|
4920
4986
|
}, {
|
|
4921
|
-
default: z(() => [d(
|
|
4987
|
+
default: z(() => [d(ts, {
|
|
4922
4988
|
ref_for: !0,
|
|
4923
4989
|
ref: (t) => ee(e.id, t),
|
|
4924
4990
|
type: e.item.type,
|
|
@@ -4961,11 +5027,11 @@ var Jo = { class: "sr-only" }, Yo = {
|
|
|
4961
5027
|
type: "button",
|
|
4962
5028
|
class: v(j(X)("flex cursor-pointer items-center justify-center overflow-hidden border border-black/15 bg-white font-bold whitespace-nowrap text-black shadow-md hover:bg-surface-elevated", "h-7 w-24 rounded-2xl text-xs", k.value && "in-data-expanded:h-9 in-data-expanded:w-full in-data-expanded:rounded in-data-expanded:text-sm", "transition-[width,height,border-radius,font-size,background-color] duration-300 ease-out motion-reduce:transition-none", "outline-2 outline-offset-1 outline-transparent focus-visible:outline-focus forced-colors:not-focus-visible:outline-0")),
|
|
4963
5029
|
onClick: ie
|
|
4964
|
-
}, [k.value ? (C(), s(n, { key: 0 }, [c("span",
|
|
5030
|
+
}, [k.value ? (C(), s(n, { key: 0 }, [c("span", os, "+" + A(G.value.notInView) + " more", 1), c("span", ss, "+" + A(k.value) + " more", 1)], 64)) : (C(), s(n, { key: 1 }, [u("+" + A(G.value.notInView) + " more", 1)], 64)), i[0] ||= c("span", { class: "sr-only" }, "\xA0notifications", -1)], 2)], 6)) : o("", !0)]),
|
|
4965
5031
|
_: 1
|
|
4966
5032
|
}, 8, ["style", "class"])]),
|
|
4967
5033
|
_: 1
|
|
4968
5034
|
}));
|
|
4969
5035
|
}
|
|
4970
5036
|
});
|
|
4971
|
-
export {
|
|
5037
|
+
export { Vo as Age, Mr as AppShell, qn as Avatar, Qr as AvatarGroup, rr as Badge, Vr as Breadcrumb, Z as Button, Pi as Calendar, ni as Card, ja as Checkbox, To as Checklist, ai as Chip, ci as Divider, Ha as EmptyState, bi as FormField, tr as Header, di as InfoTip, Si as Input, ha as InputCode, ra as InputDate, Ti as InputNumber, ua as InputPassword, sa as InputRichText, Ho as Link, ts as Notification, as as NotificationPane, Gr as PageHeader, jn as Popover, br as Progress, Ra as RadioGroup, zo as RelativeTime, ka as Select, _r as Sidebar, Or as Slideover, xn as Spinner, po as StatTile, So as SummaryList, Va as Switch, ro as Table, ds as Toaster, ia as Tooltip, Mo as age, X as cn, Ko as createNotifications, No as daysToBirthday, jo as formatDate, Ao as formatDateTime, ko as relativeTime, ir as sidebarTrail, Ga as sortRows, Eo as toDate, Jo as useNotifications, Lo as useNow };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thekestongroup/ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Keston UI — Vue 3 + Reka UI + Tailwind CSS component library",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"repository": {
|
|
@@ -29,6 +29,9 @@
|
|
|
29
29
|
"build": "vue-tsc -p tsconfig.app.json --noEmit && vite build",
|
|
30
30
|
"typecheck": "vue-tsc -b",
|
|
31
31
|
"build-storybook": "storybook build",
|
|
32
|
+
"docs:dev": "vitepress dev site",
|
|
33
|
+
"docs:build": "vitepress build site && storybook build --quiet -o site/.vitepress/dist/storybook",
|
|
34
|
+
"docs:preview": "vitepress preview site",
|
|
32
35
|
"new": "node scripts/new-component.mjs",
|
|
33
36
|
"changeset": "changeset",
|
|
34
37
|
"test": "vitest run",
|
|
@@ -77,6 +80,7 @@
|
|
|
77
80
|
"typescript": "^6.0.3",
|
|
78
81
|
"vite": "^8.3.5",
|
|
79
82
|
"vite-plugin-dts": "^5.1.2",
|
|
83
|
+
"vitepress": "1.6.4",
|
|
80
84
|
"vitest": "^5.1.0",
|
|
81
85
|
"vue": "^3.5.44",
|
|
82
86
|
"vue-tsc": "^3.3.14"
|
|
@@ -185,7 +185,16 @@ const sidebarId = `${uid}-sidebar`
|
|
|
185
185
|
v-model:open="menuOpen"
|
|
186
186
|
side="left"
|
|
187
187
|
:title="title || 'Menu'"
|
|
188
|
-
:ui="{
|
|
188
|
+
:ui="{
|
|
189
|
+
content: 'max-w-72',
|
|
190
|
+
// The header is a column (it also holds a Progress for steps), so
|
|
191
|
+
// justify-center centres the title row vertically in the 48px bar,
|
|
192
|
+
// and the row keeps the full width: title left, × right. 20px in,
|
|
193
|
+
// so the title lines up with the menu items' icons below it.
|
|
194
|
+
header: 'h-12 justify-center px-5 py-0',
|
|
195
|
+
title: 'text-base font-bold',
|
|
196
|
+
body: 'flex p-0'
|
|
197
|
+
}"
|
|
189
198
|
>
|
|
190
199
|
<template #body>
|
|
191
200
|
<Sidebar
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
|
+
import { AppWindow, BellOff, Inbox, SearchX, Users } from "@lucide/vue";
|
|
3
|
+
import Button from "../Button/Button.vue";
|
|
4
|
+
import Card from "../Card/Card.vue";
|
|
5
|
+
import EmptyState from "./EmptyState.vue";
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: "Components/Data/EmptyState",
|
|
9
|
+
component: EmptyState,
|
|
10
|
+
tags: ["autodocs"],
|
|
11
|
+
argTypes: {
|
|
12
|
+
size: { options: ["sm", "md"], control: { type: "inline-radio" } },
|
|
13
|
+
headingLevel: { options: [undefined, 2, 3, 4], control: { type: "select" } },
|
|
14
|
+
icon: { control: false },
|
|
15
|
+
},
|
|
16
|
+
args: {
|
|
17
|
+
title: "No connected apps",
|
|
18
|
+
description: "When you sign in to an app with your Keston account, it'll show here and you can remove its access.",
|
|
19
|
+
icon: AppWindow,
|
|
20
|
+
size: "md",
|
|
21
|
+
},
|
|
22
|
+
render: (args) => ({
|
|
23
|
+
components: { EmptyState, Card },
|
|
24
|
+
setup: () => ({ args }),
|
|
25
|
+
template: `<Card><EmptyState v-bind="args" /></Card>`,
|
|
26
|
+
}),
|
|
27
|
+
} satisfies Meta<typeof EmptyState>;
|
|
28
|
+
|
|
29
|
+
export default meta;
|
|
30
|
+
type Story = StoryObj<typeof meta>;
|
|
31
|
+
|
|
32
|
+
/** Playground: use the controls below. In a Card, as on a page with nothing in it yet. */
|
|
33
|
+
export const Default: Story = {};
|
|
34
|
+
|
|
35
|
+
/** With what to do next, in the actions slot. */
|
|
36
|
+
export const WithAction: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
title: "No students in this class",
|
|
39
|
+
description: "Add students one by one, or import them from a spreadsheet.",
|
|
40
|
+
icon: Users,
|
|
41
|
+
},
|
|
42
|
+
render: (args) => ({
|
|
43
|
+
components: { EmptyState, Card, Button },
|
|
44
|
+
setup: () => ({ args }),
|
|
45
|
+
template: `
|
|
46
|
+
<Card>
|
|
47
|
+
<EmptyState v-bind="args">
|
|
48
|
+
<template #actions>
|
|
49
|
+
<Button>Import</Button>
|
|
50
|
+
<Button variant="primary">Add a student</Button>
|
|
51
|
+
</template>
|
|
52
|
+
</EmptyState>
|
|
53
|
+
</Card>`,
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** Nothing matched a search or filter: say so, and offer a way back. */
|
|
58
|
+
export const NoResults: Story = {
|
|
59
|
+
args: {
|
|
60
|
+
title: "No results for “Smyth”",
|
|
61
|
+
description: "Check the spelling, or search by student number instead.",
|
|
62
|
+
icon: SearchX,
|
|
63
|
+
},
|
|
64
|
+
render: (args) => ({
|
|
65
|
+
components: { EmptyState, Card, Button },
|
|
66
|
+
setup: () => ({ args }),
|
|
67
|
+
template: `
|
|
68
|
+
<Card>
|
|
69
|
+
<EmptyState v-bind="args">
|
|
70
|
+
<template #actions><Button>Clear search</Button></template>
|
|
71
|
+
</EmptyState>
|
|
72
|
+
</Card>`,
|
|
73
|
+
}),
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** Both sizes: md for a Card or page, sm for panels, popovers and tables. */
|
|
77
|
+
export const Sizes: Story = {
|
|
78
|
+
render: () => ({
|
|
79
|
+
components: { EmptyState, Card },
|
|
80
|
+
setup: () => ({ Inbox, BellOff }),
|
|
81
|
+
template: `
|
|
82
|
+
<div class="grid gap-4 sm:grid-cols-2">
|
|
83
|
+
<Card title="md">
|
|
84
|
+
<EmptyState :icon="Inbox" title="No messages" description="Messages from families show here." />
|
|
85
|
+
</Card>
|
|
86
|
+
<Card title="sm">
|
|
87
|
+
<EmptyState size="sm" :icon="BellOff" description="You're all caught up." />
|
|
88
|
+
</Card>
|
|
89
|
+
</div>`,
|
|
90
|
+
}),
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Filling a page's main area: give the title a heading level so it's in the
|
|
95
|
+
* page outline (screen readers can jump to it).
|
|
96
|
+
*/
|
|
97
|
+
export const AsHeading: Story = {
|
|
98
|
+
args: { headingLevel: 2 },
|
|
99
|
+
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { Component, HTMLAttributes } from 'vue'
|
|
3
|
+
import { cn } from '../../lib/cn'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* What to show where a list, table or panel has nothing in it yet: an icon,
|
|
7
|
+
* a short title, a line of explanation, and optionally what to do about it
|
|
8
|
+
* (e.g. a Button). "No connected apps", "You're all caught up", "No
|
|
9
|
+
* applications yet".
|
|
10
|
+
*
|
|
11
|
+
* Slots: title, description, actions (under the text, e.g. a Button),
|
|
12
|
+
* default (anything else, under the description). To animate the icon, pass
|
|
13
|
+
* classes in `ui.icon`.
|
|
14
|
+
*/
|
|
15
|
+
export interface EmptyStateProps {
|
|
16
|
+
/** Short and specific, e.g. "No connected apps". */
|
|
17
|
+
title?: string
|
|
18
|
+
/** What this space is for, or what to do next. */
|
|
19
|
+
description?: string
|
|
20
|
+
/** A Lucide (or any) icon component, shown above the title. */
|
|
21
|
+
icon?: Component
|
|
22
|
+
/**
|
|
23
|
+
* Make the title a heading, at this level, to fit the page outline (e.g. 2
|
|
24
|
+
* when it fills a page's main area). Without it the title is plain text,
|
|
25
|
+
* as in a panel or table that already has a heading.
|
|
26
|
+
*/
|
|
27
|
+
headingLevel?: 2 | 3 | 4
|
|
28
|
+
/**
|
|
29
|
+
* - sm: compact, for panels, popovers and tables.
|
|
30
|
+
* - md (default): for a Card or a page's main area.
|
|
31
|
+
*/
|
|
32
|
+
size?: 'sm' | 'md'
|
|
33
|
+
class?: HTMLAttributes['class']
|
|
34
|
+
/** Extra classes for the parts. */
|
|
35
|
+
ui?: {
|
|
36
|
+
icon?: HTMLAttributes['class']
|
|
37
|
+
title?: HTMLAttributes['class']
|
|
38
|
+
description?: HTMLAttributes['class']
|
|
39
|
+
actions?: HTMLAttributes['class']
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const props = withDefaults(defineProps<EmptyStateProps>(), {
|
|
44
|
+
size: 'md'
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
defineSlots<{
|
|
48
|
+
default?(): unknown
|
|
49
|
+
title?(): unknown
|
|
50
|
+
description?(): unknown
|
|
51
|
+
actions?(): unknown
|
|
52
|
+
}>()
|
|
53
|
+
|
|
54
|
+
const sizes = {
|
|
55
|
+
sm: { root: 'gap-2 px-4 py-10', icon: 'size-6', title: 'text-sm', description: 'text-sm' },
|
|
56
|
+
md: { root: 'gap-2 px-4 py-12', icon: 'size-8', title: 'text-base', description: 'text-sm' }
|
|
57
|
+
} as const
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<template>
|
|
61
|
+
<div :class="cn('flex flex-col items-center text-center', sizes[size].root, props.class)">
|
|
62
|
+
<div v-if="icon" :class="cn('flex text-black/45', size === 'md' && 'mb-1', ui?.icon)" aria-hidden="true">
|
|
63
|
+
<component :is="icon" :class="sizes[size].icon" />
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<component
|
|
67
|
+
:is="headingLevel ? `h${headingLevel}` : 'p'"
|
|
68
|
+
v-if="$slots.title || title"
|
|
69
|
+
:class="cn('font-bold text-black', sizes[size].title, ui?.title)"
|
|
70
|
+
>
|
|
71
|
+
<slot name="title">{{ title }}</slot>
|
|
72
|
+
</component>
|
|
73
|
+
|
|
74
|
+
<p
|
|
75
|
+
v-if="$slots.description || description"
|
|
76
|
+
:class="cn('max-w-sm text-black/65', sizes[size].description, ui?.description)"
|
|
77
|
+
>
|
|
78
|
+
<slot name="description">{{ description }}</slot>
|
|
79
|
+
</p>
|
|
80
|
+
|
|
81
|
+
<slot />
|
|
82
|
+
|
|
83
|
+
<div v-if="$slots.actions" :class="cn('mt-2 flex flex-wrap justify-center gap-2', ui?.actions)">
|
|
84
|
+
<slot name="actions" />
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
</template>
|
|
@@ -3,6 +3,7 @@ import { computed, nextTick, ref, useId, watch, type HTMLAttributes } from 'vue'
|
|
|
3
3
|
import { Bell, BellOff } from '@lucide/vue'
|
|
4
4
|
import { cn } from '../../lib/cn'
|
|
5
5
|
import Button from '../Button/Button.vue'
|
|
6
|
+
import EmptyState from '../EmptyState/EmptyState.vue'
|
|
6
7
|
import Popover from '../Popover/Popover.vue'
|
|
7
8
|
import Notification from './Notification.vue'
|
|
8
9
|
import { useNotifications, type Notifications } from './notifications'
|
|
@@ -171,16 +172,14 @@ async function finishClear() {
|
|
|
171
172
|
</li>
|
|
172
173
|
</ul>
|
|
173
174
|
|
|
174
|
-
<
|
|
175
|
+
<EmptyState
|
|
175
176
|
v-else
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
{{ emptyText }}
|
|
183
|
-
</div>
|
|
177
|
+
size="sm"
|
|
178
|
+
:icon="BellOff"
|
|
179
|
+
:description="emptyText"
|
|
180
|
+
:class="cn(emptied && 'motion-safe:animate-empty-in')"
|
|
181
|
+
:ui="{ icon: cn('origin-top', emptied && 'motion-safe:animate-bell-wobble') }"
|
|
182
|
+
/>
|
|
184
183
|
</section>
|
|
185
184
|
</template>
|
|
186
185
|
</Popover>
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from "@storybook/vue3-vite";
|
|
2
2
|
import { ref } from "vue";
|
|
3
|
-
import { Ellipsis } from "@lucide/vue";
|
|
3
|
+
import { Ellipsis, Inbox } from "@lucide/vue";
|
|
4
4
|
import Badge from "../Badge/Badge.vue";
|
|
5
5
|
import Button from "../Button/Button.vue";
|
|
6
6
|
import Card from "../Card/Card.vue";
|
|
7
|
+
import EmptyState from "../EmptyState/EmptyState.vue";
|
|
7
8
|
import Table, { type TableProps } from "./Table.vue";
|
|
8
9
|
import type { TableColumn, TableSort } from "./table";
|
|
9
10
|
|
|
@@ -162,20 +163,25 @@ export const StickyHeader: Story = {
|
|
|
162
163
|
},
|
|
163
164
|
};
|
|
164
165
|
|
|
165
|
-
/** No rows yet, with
|
|
166
|
+
/** No rows yet: an EmptyState in the empty slot, with what to do next. */
|
|
166
167
|
export const Empty: Story = {
|
|
167
168
|
args: { rows: [] },
|
|
168
169
|
render: (args) => ({
|
|
169
|
-
components: { Table, Card, Button },
|
|
170
|
-
setup: () => ({ args }),
|
|
170
|
+
components: { Table, Card, Button, EmptyState },
|
|
171
|
+
setup: () => ({ args, Inbox }),
|
|
171
172
|
template: `
|
|
172
173
|
<Card padding="none">
|
|
173
174
|
<Table v-bind="args">
|
|
174
175
|
<template #empty>
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
176
|
+
<EmptyState
|
|
177
|
+
size="sm"
|
|
178
|
+
:icon="Inbox"
|
|
179
|
+
title="No applications yet"
|
|
180
|
+
description="Applications appear here as families send them."
|
|
181
|
+
class="p-0"
|
|
182
|
+
>
|
|
183
|
+
<template #actions><Button size="sm">Share the application form</Button></template>
|
|
184
|
+
</EmptyState>
|
|
179
185
|
</template>
|
|
180
186
|
</Table>
|
|
181
187
|
</Card>`,
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { computed, onBeforeUnmount, onMounted, ref, useId, type HTMLAttributes } from 'vue'
|
|
3
3
|
import { ArrowDown, ArrowUp, ChevronsUpDown } from '@lucide/vue'
|
|
4
4
|
import { cn } from '../../lib/cn'
|
|
5
|
+
import EmptyState from '../EmptyState/EmptyState.vue'
|
|
5
6
|
import Spinner from '../Spinner/Spinner.vue'
|
|
6
7
|
import { nextSort, sortRows, type TableColumn, type TableSort } from './table'
|
|
7
8
|
|
|
@@ -177,7 +178,9 @@ onBeforeUnmount(() => observer?.disconnect())
|
|
|
177
178
|
<Spinner size="sm" />
|
|
178
179
|
Loading…
|
|
179
180
|
</span>
|
|
180
|
-
<slot v-else name="empty">
|
|
181
|
+
<slot v-else name="empty">
|
|
182
|
+
<EmptyState size="sm" :description="emptyText" class="p-0" />
|
|
183
|
+
</slot>
|
|
181
184
|
</td>
|
|
182
185
|
</tr>
|
|
183
186
|
<tr v-for="(row, index) in shownRows" :key="keyOf(row, index)" :class="cn('group/row', ui?.row)">
|
package/src/index.ts
CHANGED
|
@@ -74,6 +74,8 @@ export { default as RelativeTime } from './components/RelativeTime/RelativeTime.
|
|
|
74
74
|
export type { RelativeTimeProps } from './components/RelativeTime/RelativeTime.vue'
|
|
75
75
|
export { default as Age } from './components/Age/Age.vue'
|
|
76
76
|
export type { AgeProps } from './components/Age/Age.vue'
|
|
77
|
+
export { default as EmptyState } from './components/EmptyState/EmptyState.vue'
|
|
78
|
+
export type { EmptyStateProps } from './components/EmptyState/EmptyState.vue'
|
|
77
79
|
|
|
78
80
|
// Navigation
|
|
79
81
|
export { default as Breadcrumb } from './components/Breadcrumb/Breadcrumb.vue'
|