@thekestongroup/ui 0.11.1 → 0.13.1

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 (42) hide show
  1. package/dist/components/AppLauncher/AppLauncher.vue.d.ts +33 -0
  2. package/dist/components/AppLauncher/apps.d.ts +3 -0
  3. package/dist/components/AppShell/AppShell.vue.d.ts +10 -0
  4. package/dist/components/CardSelect/CardSelect.vue.d.ts +1 -1
  5. package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts +1 -1
  6. package/dist/components/Footer/Footer.vue.d.ts +66 -0
  7. package/dist/components/Footer/footer.d.ts +6 -0
  8. package/dist/components/Footer/links.d.ts +8 -0
  9. package/dist/components/FormField/FormField.vue.d.ts +1 -1
  10. package/dist/components/Input/Input.vue.d.ts +1 -1
  11. package/dist/components/InputCode/InputCode.vue.d.ts +1 -1
  12. package/dist/components/InputDate/InputDate.vue.d.ts +1 -1
  13. package/dist/components/InputNumber/InputNumber.vue.d.ts +1 -1
  14. package/dist/components/InputPassword/InputPassword.vue.d.ts +1 -1
  15. package/dist/components/InputRichText/InputRichText.vue.d.ts +1 -1
  16. package/dist/components/InputTextArea/InputTextArea.vue.d.ts +1 -1
  17. package/dist/components/RadioGroup/RadioGroup.vue.d.ts +1 -1
  18. package/dist/components/Select/Select.vue.d.ts +1 -1
  19. package/dist/i18n/en.d.ts +9 -0
  20. package/dist/index.d.ts +6 -0
  21. package/dist/keston-ui.js +1052 -798
  22. package/package.json +1 -1
  23. package/src/components/AppLauncher/AppLauncher.stories.ts +32 -0
  24. package/src/components/AppLauncher/AppLauncher.vue +91 -0
  25. package/src/components/AppLauncher/apps.ts +10 -0
  26. package/src/components/AppShell/AppShell.stories.ts +13 -0
  27. package/src/components/AppShell/AppShell.vue +21 -4
  28. package/src/components/Avatar/Avatar.vue +6 -3
  29. package/src/components/Card/Card.stories.ts +1 -1
  30. package/src/components/Checklist/Checklist.stories.ts +1 -1
  31. package/src/components/Footer/Footer.stories.ts +82 -0
  32. package/src/components/Footer/Footer.vue +123 -0
  33. package/src/components/Footer/footer.test.ts +41 -0
  34. package/src/components/Footer/footer.ts +15 -0
  35. package/src/components/Footer/links.ts +19 -0
  36. package/src/components/Input/Input.vue +1 -0
  37. package/src/components/StatTile/StatTile.stories.ts +1 -1
  38. package/src/examples/AppPages.stories.ts +1 -1
  39. package/src/examples/SchoolPages.stories.ts +2 -2
  40. package/src/i18n/en.ts +7 -0
  41. package/src/index.ts +6 -0
  42. package/src/lib/parseDate.ts +1 -1
@@ -0,0 +1,33 @@
1
+ import { Component, HTMLAttributes } from 'vue';
2
+ export interface AppLauncherApp {
3
+ /** Matches `current` to mark the app you are in. */
4
+ id: string;
5
+ label: string;
6
+ /** A few words on what the app is for. */
7
+ description?: string;
8
+ href: string;
9
+ /** An icon component, or the name of one of the Keston app icons (id, admin, work, utilities, design). */
10
+ icon?: Component | string;
11
+ }
12
+ /**
13
+ * The grid button in the header that opens a panel of the Keston Group's apps, so people can move between
14
+ * them. The same in every app: it lists `kestonApps` and marks the one you are in with `current`. In an app
15
+ * built on AppShell, pass `launcher` to AppShell instead of using this directly.
16
+ *
17
+ * Apps open in the same tab, as moving between Keston apps is moving on, not a side trip (the footer's
18
+ * links are the opposite: they open in a new tab).
19
+ */
20
+ export interface AppLauncherProps {
21
+ /** The apps to list. Default: `kestonApps`. */
22
+ apps?: AppLauncherApp[];
23
+ /** The `id` of the app you are in, shown as the current page. */
24
+ current?: string;
25
+ /** Name of the button for screen readers. Default "Keston apps". */
26
+ label?: string;
27
+ class?: HTMLAttributes['class'];
28
+ }
29
+ declare const _default: typeof __VLS_export;
30
+ export default _default;
31
+ declare const __VLS_export: import('vue').DefineComponent<AppLauncherProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<AppLauncherProps> & Readonly<{}>, {
32
+ apps: AppLauncherApp[];
33
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
@@ -0,0 +1,3 @@
1
+ import { AppLauncherApp } from './AppLauncher.vue';
2
+ /** The Keston Group's apps, as the launcher lists them by default. Apps can pass their own `apps`. */
3
+ export declare const kestonApps: AppLauncherApp[];
@@ -1,4 +1,6 @@
1
1
  import { HTMLAttributes } from 'vue';
2
+ import { AppLauncherProps } from '../AppLauncher/AppLauncher.vue';
3
+ import { FooterProps } from '../Footer/Footer.vue';
2
4
  import { HeaderProps, HeaderUser, HeaderUserAction } from '../Header/Header.vue';
3
5
  import { SidebarItem, SidebarProps } from '../Sidebar/Sidebar.vue';
4
6
  /**
@@ -20,6 +22,10 @@ import { SidebarItem, SidebarProps } from '../Sidebar/Sidebar.vue';
20
22
  * The account menu (top right) is the Header's: pass `user` and listen for
21
23
  * account-settings, switch-account, log-out (and sign-in when signed out).
22
24
  *
25
+ * The footer: pass `footer` (the Footer's props, e.g. `{ appName, version }`) to put the
26
+ * Keston Group footer at the bottom of the page, under the content. It sits at the bottom of the
27
+ * screen on short pages and after the content on long ones.
28
+ *
23
29
  * Slots: default (the page), header-leading, header-middle, header-trailing,
24
30
  * account, account-menu and organisation (passed to Header), sidebar-header and sidebar-footer (passed to Sidebar;
25
31
  * sidebar-header is only shown on wide screens, as the Slideover has its own
@@ -42,6 +48,10 @@ export interface AppShellProps {
42
48
  sections?: SidebarProps['sections'];
43
49
  /** Wide screens: show the header's menu button, which collapses the sidebar to icons. */
44
50
  collapsible?: boolean;
51
+ /** Show the Keston Group footer under the page. The Footer's props: `{ appName, version, … }`. Without it there is no footer. */
52
+ footer?: FooterProps;
53
+ /** Show the app launcher (a grid button for moving between Keston apps) in the header. `true` for the defaults, or the AppLauncher's props: `{ current: 'admin' }`. */
54
+ launcher?: boolean | AppLauncherProps;
45
55
  /** Component used for sidebar items with `to`, and the title link, e.g. RouterLink. */
46
56
  linkComponent?: SidebarProps['linkComponent'];
47
57
  /** Other Header props, e.g. `{ ui: { title: '…' } }`. */
@@ -53,7 +53,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
53
53
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
54
54
  "onUpdate:modelValue"?: ((value: CardSelectValue | undefined) => any) | undefined;
55
55
  }>, {
56
- helperPlacement: "below" | "icon";
56
+ helperPlacement: "icon" | "below";
57
57
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
58
58
  declare const _default: typeof __VLS_export;
59
59
  export default _default;
@@ -39,7 +39,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
39
39
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
40
  "onUpdate:modelValue"?: ((value: CheckboxGroupValue[]) => any) | undefined;
41
41
  }>, {
42
- helperPlacement: "below" | "icon";
42
+ helperPlacement: "icon" | "below";
43
43
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
44
44
  declare const _default: typeof __VLS_export;
45
45
  export default _default;
@@ -0,0 +1,66 @@
1
+ import { Component, HTMLAttributes } from 'vue';
2
+ export interface FooterLink {
3
+ label: string;
4
+ /** A plain link. */
5
+ href?: string;
6
+ /** Link through `linkComponent` (e.g. RouterLink), which receives `to`. */
7
+ to?: unknown;
8
+ /** Open in a new tab. Default true for `href` links (they leave the app), false for `to`. */
9
+ newTab?: boolean;
10
+ }
11
+ /**
12
+ * The bottom of an app's page: on the left Help & support and the legal links (Privacy Policy, Terms & Conditions), and
13
+ * on the right the app's name, version and build (so a bug report can say exactly which build) with
14
+ * the copyright. The same in every Keston app; pass the app's `version` and `build`.
15
+ *
16
+ * Without `links` it shows the Keston Group's footer links (`kestonFooterLinks`). Add to them rather than
17
+ * replacing them with `moreLinks` (e.g. Contact us, or `kestonGroupLinks` to point at the other Keston
18
+ * apps), which follow, after a divider. The version comes from the app's package.json and the build
19
+ * from its CI: in Vite, put them in with `define` (see the spec).
20
+ *
21
+ * Slots: nav (instead of the whole link list), end (after the copyright, e.g. a language switcher).
22
+ */
23
+ export interface FooterProps {
24
+ /** The links on the left. Default: `kestonFooterLinks` (Help & support, Privacy Policy, Terms & Conditions). */
25
+ links?: FooterLink[];
26
+ /** More links after a divider, e.g. Contact us, or `kestonGroupLinks` to point at the other Keston apps. */
27
+ moreLinks?: FooterLink[];
28
+ /** Component used for links with `to`, e.g. RouterLink. */
29
+ linkComponent?: string | Component;
30
+ /** The app's name, shown before its version. */
31
+ appName?: string;
32
+ /** The app's version, e.g. "1.4.2" or "v1.4.2". */
33
+ version?: string;
34
+ /** The build, e.g. a commit "a1b2c3d" or a CI run number, shown after the version so a bug report can name the exact build. */
35
+ build?: string;
36
+ /** Who owns the copyright. */
37
+ holder?: string;
38
+ /** The current year. Default: this year, from the device's clock. */
39
+ year?: number;
40
+ /** The first year, to show a range such as 2024–2026. */
41
+ since?: number;
42
+ class?: HTMLAttributes['class'];
43
+ /** Extra classes for the parts. */
44
+ ui?: {
45
+ links?: HTMLAttributes['class'];
46
+ meta?: HTMLAttributes['class'];
47
+ };
48
+ }
49
+ type __VLS_Slots = {
50
+ nav?(): unknown;
51
+ end?(): unknown;
52
+ };
53
+ declare const __VLS_base: import('vue').DefineComponent<FooterProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FooterProps> & Readonly<{}>, {
54
+ links: FooterLink[];
55
+ moreLinks: FooterLink[];
56
+ linkComponent: string | Component;
57
+ holder: string;
58
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
59
+ declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
60
+ declare const _default: typeof __VLS_export;
61
+ export default _default;
62
+ type __VLS_WithSlots<T, S> = T & {
63
+ new (): {
64
+ $slots: S;
65
+ };
66
+ };
@@ -0,0 +1,6 @@
1
+ /** "2024–2026" when `since` is before `year`, otherwise just the year. */
2
+ export declare function yearRange(year: number, since?: number): string;
3
+ /** "1.4.2" and "v1.4.2" both show as "v1.4.2". Empty for no version. */
4
+ export declare function displayVersion(version?: string): string;
5
+ /** The version without a leading "v", for the screen reader's "Version 1.4.2". */
6
+ export declare function bareVersion(version?: string): string;
@@ -0,0 +1,8 @@
1
+ import { FooterLink } from './Footer.vue';
2
+ /**
3
+ * The links every Keston app shows on the left of its footer: help first, then the legal pages.
4
+ * Apps can pass their own `links`, or add to these with `moreLinks`.
5
+ */
6
+ export declare const kestonFooterLinks: FooterLink[];
7
+ /** Links to the rest of the Keston Group. Not shown by default: pass them as `moreLinks` where an app should offer them. */
8
+ export declare const kestonGroupLinks: FooterLink[];
@@ -54,7 +54,7 @@ type __VLS_Slots = {
54
54
  'label-trailing'?(): unknown;
55
55
  };
56
56
  declare const __VLS_base: import('vue').DefineComponent<FormFieldProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<FormFieldProps> & Readonly<{}>, {
57
- helperPlacement: "below" | "icon";
57
+ helperPlacement: "icon" | "below";
58
58
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
59
59
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
60
60
  declare const _default: typeof __VLS_export;
@@ -46,7 +46,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
46
46
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
47
47
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
48
48
  }>, {
49
- helperPlacement: "below" | "icon";
49
+ helperPlacement: "icon" | "below";
50
50
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
51
51
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
52
52
  declare const _default: typeof __VLS_export;
@@ -47,7 +47,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
47
47
  onComplete?: ((code: string) => any) | undefined;
48
48
  }>, {
49
49
  length: number;
50
- helperPlacement: "below" | "icon";
50
+ helperPlacement: "icon" | "below";
51
51
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
52
52
  declare const _default: typeof __VLS_export;
53
53
  export default _default;
@@ -44,7 +44,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
44
44
  "onUpdate:modelValue"?: ((value: string | undefined) => any) | undefined;
45
45
  }>, {
46
46
  locale: string;
47
- helperPlacement: "below" | "icon";
47
+ helperPlacement: "icon" | "below";
48
48
  prefer: DatePreference;
49
49
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
50
50
  declare const _default: typeof __VLS_export;
@@ -40,7 +40,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
40
40
  "onUpdate:modelValue"?: ((value: number | undefined) => any) | undefined;
41
41
  }>, {
42
42
  step: number;
43
- helperPlacement: "below" | "icon";
43
+ helperPlacement: "icon" | "below";
44
44
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
45
45
  declare const _default: typeof __VLS_export;
46
46
  export default _default;
@@ -41,7 +41,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
41
41
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
42
42
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
43
43
  }>, {
44
- helperPlacement: "below" | "icon";
44
+ helperPlacement: "icon" | "below";
45
45
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
46
46
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
47
47
  declare const _default: typeof __VLS_export;
@@ -40,7 +40,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
40
40
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
41
41
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
42
42
  }>, {
43
- helperPlacement: "below" | "icon";
43
+ helperPlacement: "icon" | "below";
44
44
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
45
45
  declare const _default: typeof __VLS_export;
46
46
  export default _default;
@@ -43,7 +43,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {
43
43
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
44
44
  "onUpdate:modelValue"?: ((value: string) => any) | undefined;
45
45
  }>, {
46
- helperPlacement: "below" | "icon";
46
+ helperPlacement: "icon" | "below";
47
47
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
48
48
  declare const _default: typeof __VLS_export;
49
49
  export default _default;
@@ -39,7 +39,7 @@ declare const __VLS_export: import('vue').DefineComponent<__VLS_PublicProps, {},
39
39
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
40
40
  "onUpdate:modelValue"?: ((value: RadioValue | undefined) => any) | undefined;
41
41
  }>, {
42
- helperPlacement: "below" | "icon";
42
+ helperPlacement: "icon" | "below";
43
43
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
44
44
  declare const _default: typeof __VLS_export;
45
45
  export default _default;
@@ -97,7 +97,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
97
97
  }, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
98
98
  "onUpdate:modelValue"?: ((value: SelectValueType | SelectValueType[] | undefined) => any) | undefined;
99
99
  }>, {
100
- helperPlacement: "below" | "icon";
100
+ helperPlacement: "icon" | "below";
101
101
  options: (string | SelectOption)[];
102
102
  groups: SelectGroupOptions[];
103
103
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
package/dist/i18n/en.d.ts CHANGED
@@ -48,6 +48,15 @@ export declare const en: {
48
48
  chip: {
49
49
  remove: string;
50
50
  };
51
+ appLauncher: {
52
+ label: string;
53
+ };
54
+ footer: {
55
+ label: string;
56
+ version: string;
57
+ build: string;
58
+ copyright: string;
59
+ };
51
60
  formField: {
52
61
  about: string;
53
62
  };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,12 @@ export { default as PageHeader } from './components/PageHeader/PageHeader.vue';
7
7
  export type { PageHeaderAction, PageHeaderProps } from './components/PageHeader/PageHeader.vue';
8
8
  export { default as SettingsRow } from './components/SettingsRow/SettingsRow.vue';
9
9
  export type { SettingsRowProps } from './components/SettingsRow/SettingsRow.vue';
10
+ export { default as AppLauncher } from './components/AppLauncher/AppLauncher.vue';
11
+ export type { AppLauncherApp, AppLauncherProps } from './components/AppLauncher/AppLauncher.vue';
12
+ export { kestonApps } from './components/AppLauncher/apps';
13
+ export { default as Footer } from './components/Footer/Footer.vue';
14
+ export type { FooterLink, FooterProps } from './components/Footer/Footer.vue';
15
+ export { kestonFooterLinks, kestonGroupLinks } from './components/Footer/links';
10
16
  export { default as Avatar } from './components/Avatar/Avatar.vue';
11
17
  export type { AvatarProps, AvatarUser } from './components/Avatar/Avatar.vue';
12
18
  export { default as AvatarGroup } from './components/AvatarGroup/AvatarGroup.vue';