@thekestongroup/ui 0.11.1 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/dist/components/AppShell/AppShell.vue.d.ts +7 -0
  2. package/dist/components/CardSelect/CardSelect.vue.d.ts +1 -1
  3. package/dist/components/CheckboxGroup/CheckboxGroup.vue.d.ts +1 -1
  4. package/dist/components/Footer/Footer.vue.d.ts +66 -0
  5. package/dist/components/Footer/footer.d.ts +6 -0
  6. package/dist/components/Footer/links.d.ts +8 -0
  7. package/dist/components/FormField/FormField.vue.d.ts +1 -1
  8. package/dist/components/Header/Header.vue.d.ts +1 -1
  9. package/dist/components/Input/Input.vue.d.ts +1 -1
  10. package/dist/components/InputCode/InputCode.vue.d.ts +1 -1
  11. package/dist/components/InputDate/InputDate.vue.d.ts +1 -1
  12. package/dist/components/InputNumber/InputNumber.vue.d.ts +1 -1
  13. package/dist/components/InputPassword/InputPassword.vue.d.ts +1 -1
  14. package/dist/components/InputRichText/InputRichText.vue.d.ts +1 -1
  15. package/dist/components/InputTextArea/InputTextArea.vue.d.ts +1 -1
  16. package/dist/components/RadioGroup/RadioGroup.vue.d.ts +1 -1
  17. package/dist/components/Select/Select.vue.d.ts +1 -1
  18. package/dist/components/Slideover/Slideover.vue.d.ts +1 -1
  19. package/dist/i18n/en.d.ts +6 -0
  20. package/dist/index.d.ts +3 -0
  21. package/dist/keston-ui.js +687 -528
  22. package/package.json +1 -1
  23. package/src/components/AppShell/AppShell.stories.ts +8 -0
  24. package/src/components/AppShell/AppShell.vue +14 -3
  25. package/src/components/Avatar/Avatar.vue +6 -3
  26. package/src/components/Card/Card.stories.ts +1 -1
  27. package/src/components/Checklist/Checklist.stories.ts +1 -1
  28. package/src/components/Footer/Footer.stories.ts +82 -0
  29. package/src/components/Footer/Footer.vue +123 -0
  30. package/src/components/Footer/footer.test.ts +41 -0
  31. package/src/components/Footer/footer.ts +15 -0
  32. package/src/components/Footer/links.ts +19 -0
  33. package/src/components/Input/Input.vue +1 -0
  34. package/src/components/StatTile/StatTile.stories.ts +1 -1
  35. package/src/examples/AppPages.stories.ts +1 -1
  36. package/src/examples/SchoolPages.stories.ts +2 -2
  37. package/src/i18n/en.ts +6 -0
  38. package/src/index.ts +3 -0
  39. package/src/lib/parseDate.ts +1 -1
@@ -1,4 +1,5 @@
1
1
  import { HTMLAttributes } from 'vue';
2
+ import { FooterProps } from '../Footer/Footer.vue';
2
3
  import { HeaderProps, HeaderUser, HeaderUserAction } from '../Header/Header.vue';
3
4
  import { SidebarItem, SidebarProps } from '../Sidebar/Sidebar.vue';
4
5
  /**
@@ -20,6 +21,10 @@ import { SidebarItem, SidebarProps } from '../Sidebar/Sidebar.vue';
20
21
  * The account menu (top right) is the Header's: pass `user` and listen for
21
22
  * account-settings, switch-account, log-out (and sign-in when signed out).
22
23
  *
24
+ * The footer: pass `footer` (the Footer's props, e.g. `{ appName, version }`) to put the
25
+ * Keston Group footer at the bottom of the page, under the content. It sits at the bottom of the
26
+ * screen on short pages and after the content on long ones.
27
+ *
23
28
  * Slots: default (the page), header-leading, header-middle, header-trailing,
24
29
  * account, account-menu and organisation (passed to Header), sidebar-header and sidebar-footer (passed to Sidebar;
25
30
  * sidebar-header is only shown on wide screens, as the Slideover has its own
@@ -42,6 +47,8 @@ export interface AppShellProps {
42
47
  sections?: SidebarProps['sections'];
43
48
  /** Wide screens: show the header's menu button, which collapses the sidebar to icons. */
44
49
  collapsible?: boolean;
50
+ /** Show the Keston Group footer under the page. The Footer's props: `{ appName, version, … }`. Without it there is no footer. */
51
+ footer?: FooterProps;
45
52
  /** Component used for sidebar items with `to`, and the title link, e.g. RouterLink. */
46
53
  linkComponent?: SidebarProps['linkComponent'];
47
54
  /** 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;
@@ -100,8 +100,8 @@ declare const __VLS_base: import('vue').DefineComponent<HeaderProps, {}, {}, {},
100
100
  "onSign-in"?: (() => any) | undefined;
101
101
  }>, {
102
102
  menu: boolean;
103
- sticky: boolean;
104
103
  linkComponent: string | Component;
104
+ sticky: boolean;
105
105
  menuOpen: boolean;
106
106
  userActions: HeaderUserAction[];
107
107
  signIn: boolean;
@@ -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>;
@@ -112,7 +112,7 @@ declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {
112
112
  modal: boolean;
113
113
  close: boolean;
114
114
  overlay: boolean;
115
- initialFocus: "none" | "close" | "auto";
115
+ initialFocus: "none" | "auto" | "close";
116
116
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
117
117
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
118
118
  declare const _default: typeof __VLS_export;
package/dist/i18n/en.d.ts CHANGED
@@ -48,6 +48,12 @@ export declare const en: {
48
48
  chip: {
49
49
  remove: string;
50
50
  };
51
+ footer: {
52
+ label: string;
53
+ version: string;
54
+ build: string;
55
+ copyright: string;
56
+ };
51
57
  formField: {
52
58
  about: string;
53
59
  };
package/dist/index.d.ts CHANGED
@@ -7,6 +7,9 @@ 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 Footer } from './components/Footer/Footer.vue';
11
+ export type { FooterLink, FooterProps } from './components/Footer/Footer.vue';
12
+ export { kestonFooterLinks, kestonGroupLinks } from './components/Footer/links';
10
13
  export { default as Avatar } from './components/Avatar/Avatar.vue';
11
14
  export type { AvatarProps, AvatarUser } from './components/Avatar/Avatar.vue';
12
15
  export { default as AvatarGroup } from './components/AvatarGroup/AvatarGroup.vue';